- Timestamp:
- Apr 18, 2024, 5:19:17 PM (3 months ago)
- Branches:
- master
- Children:
- 38093ae
- Parents:
- 60c5b6d
- Location:
- src/AST
- Files:
-
- 1 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
src/AST/Expr.cpp
r60c5b6d r7a780ad 246 246 ConstantExpr * ConstantExpr::from_bool( const CodeLocation & loc, bool b ) { 247 247 return new ConstantExpr{ 248 loc, new BasicType{ Basic Type::Bool }, b ? "1" : "0", (unsigned long long)b };248 loc, new BasicType{ BasicKind::Bool }, b ? "1" : "0", (unsigned long long)b }; 249 249 } 250 250 251 251 ConstantExpr * ConstantExpr::from_int( const CodeLocation & loc, int i ) { 252 252 return new ConstantExpr{ 253 loc, new BasicType{ Basic Type::SignedInt }, std::to_string( i ), (unsigned long long)i };253 loc, new BasicType{ BasicKind::SignedInt }, std::to_string( i ), (unsigned long long)i }; 254 254 } 255 255 256 256 ConstantExpr * ConstantExpr::from_ulong( const CodeLocation & loc, unsigned long i ) { 257 257 return new ConstantExpr{ 258 loc, new BasicType{ Basic Type::LongUnsignedInt }, std::to_string( i ),258 loc, new BasicType{ BasicKind::LongUnsignedInt }, std::to_string( i ), 259 259 (unsigned long long)i }; 260 260 } 261 261 262 262 ConstantExpr * ConstantExpr::from_string( const CodeLocation & loc, const std::string & str ) { 263 const Type * charType = new BasicType( Basic Type::Char );263 const Type * charType = new BasicType( BasicKind::Char ); 264 264 // Adjust the length of the string for the terminator. 265 265 const Expr * strSize = from_ulong( loc, str.size() + 1 ); … … 277 277 278 278 SizeofExpr::SizeofExpr( const CodeLocation & loc, const Expr * e ) 279 : Expr( loc, new BasicType{ Basic Type::LongUnsignedInt } ), expr( e ), type( nullptr ) {}279 : Expr( loc, new BasicType{ BasicKind::LongUnsignedInt } ), expr( e ), type( nullptr ) {} 280 280 281 281 SizeofExpr::SizeofExpr( const CodeLocation & loc, const Type * t ) 282 : Expr( loc, new BasicType{ Basic Type::LongUnsignedInt } ), expr( nullptr ), type( t ) {}282 : Expr( loc, new BasicType{ BasicKind::LongUnsignedInt } ), expr( nullptr ), type( t ) {} 283 283 284 284 // --- AlignofExpr 285 285 286 286 AlignofExpr::AlignofExpr( const CodeLocation & loc, const Expr * e ) 287 : Expr( loc, new BasicType{ Basic Type::LongUnsignedInt } ), expr( e ), type( nullptr ) {}287 : Expr( loc, new BasicType{ BasicKind::LongUnsignedInt } ), expr( e ), type( nullptr ) {} 288 288 289 289 AlignofExpr::AlignofExpr( const CodeLocation & loc, const Type * t ) 290 : Expr( loc, new BasicType{ Basic Type::LongUnsignedInt } ), expr( nullptr ), type( t ) {}290 : Expr( loc, new BasicType{ BasicKind::LongUnsignedInt } ), expr( nullptr ), type( t ) {} 291 291 292 292 // --- OffsetofExpr 293 293 294 294 OffsetofExpr::OffsetofExpr( const CodeLocation & loc, const Type * ty, const DeclWithType * mem ) 295 : Expr( loc, new BasicType{ Basic Type::LongUnsignedInt } ), type( ty ), member( mem ) {295 : Expr( loc, new BasicType{ BasicKind::LongUnsignedInt } ), type( ty ), member( mem ) { 296 296 assert( type ); 297 297 assert( member ); … … 302 302 OffsetPackExpr::OffsetPackExpr( const CodeLocation & loc, const StructInstType * ty ) 303 303 : Expr( loc, new ArrayType{ 304 new BasicType{ Basic Type::LongUnsignedInt }, nullptr, FixedLen, DynamicDim }304 new BasicType{ BasicKind::LongUnsignedInt }, nullptr, FixedLen, DynamicDim } 305 305 ), type( ty ) { 306 306 assert( type ); … … 311 311 LogicalExpr::LogicalExpr( 312 312 const CodeLocation & loc, const Expr * a1, const Expr * a2, LogicalFlag ia ) 313 : Expr( loc, new BasicType{ Basic Type::SignedInt } ), arg1( a1 ), arg2( a2 ), isAnd( ia ) {}313 : Expr( loc, new BasicType{ BasicKind::SignedInt } ), arg1( a1 ), arg2( a2 ), isAnd( ia ) {} 314 314 315 315 // --- CommaExpr -
src/AST/Pass.impl.hpp
r60c5b6d r7a780ad 477 477 CodeLocation{}, "__func__", 478 478 new ast::ArrayType{ 479 new ast::BasicType{ ast::Basic Type::Char, ast::CV::Const },479 new ast::BasicType{ ast::BasicKind::Char, ast::CV::Const }, 480 480 nullptr, VariableLen, DynamicDim 481 481 }, -
src/AST/Type.hpp
r60c5b6d r7a780ad 22 22 #include <vector> 23 23 24 #include "BasicKind.hpp" // for BasicKind 24 25 #include "CVQualifiers.hpp" 25 26 #include "Decl.hpp" // for AggregateDecl subclasses … … 114 115 class BasicType final : public Type { 115 116 public: 116 // GENERATED START, DO NOT EDIT 117 // GENERATED BY BasicTypes-gen.cc 118 enum Kind { 119 Bool, 120 Char, 121 SignedChar, 122 UnsignedChar, 123 ShortSignedInt, 124 ShortUnsignedInt, 125 SignedInt, 126 UnsignedInt, 127 LongSignedInt, 128 LongUnsignedInt, 129 LongLongSignedInt, 130 LongLongUnsignedInt, 131 SignedInt128, 132 UnsignedInt128, 133 uFloat16, 134 uFloat16Complex, 135 uFloat32, 136 uFloat32Complex, 137 Float, 138 FloatComplex, 139 uFloat32x, 140 uFloat32xComplex, 141 uFloat64, 142 uFloat64Complex, 143 Double, 144 DoubleComplex, 145 uFloat64x, 146 uFloat64xComplex, 147 uuFloat80, 148 uFloat128, 149 uFloat128Complex, 150 uuFloat128, 151 LongDouble, 152 LongDoubleComplex, 153 uFloat128x, 154 uFloat128xComplex, 155 NUMBER_OF_BASIC_TYPES 156 } kind; 157 // GENERATED END 158 159 /// xxx -- MAX_INTEGER_TYPE should probably be in BasicTypes-gen.cc, rather than hardcoded here 160 enum { MAX_INTEGER_TYPE = UnsignedInt128 }; 117 BasicKind kind; 161 118 162 119 /// string names of basic types; generated to match with Kind 163 120 static const char *typeNames[]; 164 121 165 BasicType( Kind k, CV::Qualifiers q = {}, std::vector<ptr<Attribute>> && as = {} )122 BasicType( BasicKind k, CV::Qualifiers q = {}, std::vector<ptr<Attribute>> && as = {} ) 166 123 : Type(q, std::move(as)), kind(k) {} 167 124 168 125 /// Check if this type represents an integer type 169 bool isInteger() const { return (unsigned)kind <= (unsigned)MAX_INTEGER_TYPE; }126 bool isInteger() const { return kind <= MAX_INTEGER_TYPE; } 170 127 171 128 const Type * accept( Visitor & v ) const override { return v.visit( this ); } -
src/AST/module.mk
r60c5b6d r7a780ad 18 18 AST/Attribute.cpp \ 19 19 AST/Attribute.hpp \ 20 AST/BasicKind.hpp \ 20 21 AST/Bitfield.hpp \ 21 22 AST/Chain.hpp \
Note: See TracChangeset
for help on using the changeset viewer.