Changes in src/SynTree/Constant.cc [b91bfde:c36298d]
- File:
-
- 1 edited
-
src/SynTree/Constant.cc (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
src/SynTree/Constant.cc
rb91bfde rc36298d 42 42 } 43 43 44 Constant Constant::from_string( const std::string & str ) {45 Type * charType = new BasicType( noQualifiers, BasicType::Char );46 // Adjust the length of the string for the terminator.47 Expression * strSize = new ConstantExpr( Constant::from_ulong( str.size() + 1 ) );48 Type * strType = new ArrayType( noQualifiers, charType, strSize, false, false );49 const std::string strValue = "\"" + str + "\"";50 return Constant( strType, strValue, std::nullopt );51 }52 53 44 Constant Constant::null( Type * ptrtype ) { 54 45 if ( nullptr == ptrtype ) {
Note:
See TracChangeset
for help on using the changeset viewer.