Changeset 98538288
- Timestamp:
- Feb 11, 2020, 2:59:04 PM (5 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- cb8a18c
- Parents:
- 686cb63
- Location:
- src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
src/CodeGen/OperatorTable.cc
r686cb63 r98538288 24 24 namespace { 25 25 const OperatorInfo tableValues[] = { 26 { "?[?]", "", "_operator_index", OT_INDEX},27 { "?{}", "=", "_constructor", OT_CTOR},28 { "^?{}", "", "_destructor", OT_DTOR},29 { "?()", "", "_operator_call", OT_CALL},30 { "?++", "++", "_operator_postincr", OT_POSTFIXASSIGN},31 { "?--", "--", "_operator_postdecr", OT_POSTFIXASSIGN},32 { "*?", "*", "_operator_deref", OT_PREFIX},33 { "+?", "+", "_operator_unaryplus", OT_PREFIX},34 { "-?", "-", "_operator_unaryminus", OT_PREFIX},35 { "~?", "~", "_operator_bitnot", OT_PREFIX},36 { "!?", "!", "_operator_lognot", OT_PREFIX},37 { "++?", "++", "_operator_preincr", OT_PREFIXASSIGN},38 { "--?", "--", "_operator_predecr", OT_PREFIXASSIGN},39 { "?\\?", "\\", "_operator_exponential", OT_INFIX},40 { "?*?", "*", "_operator_multiply", OT_INFIX},41 { "?/?", "/", "_operator_divide", OT_INFIX},42 { "?%?", "%", "_operator_modulus", OT_INFIX},43 { "?+?", "+", "_operator_add", OT_INFIX},44 { "?-?", "-", "_operator_subtract", OT_INFIX},45 { "?<<?", "<<", "_operator_shiftleft", OT_INFIX},46 { "?>>?", ">>", "_operator_shiftright", OT_INFIX},47 { "?<?", "<", "_operator_less", OT_INFIX},48 { "?>?", ">", "_operator_greater", OT_INFIX},49 { "?<=?", "<=", "_operator_lessequal", OT_INFIX},50 { "?>=?", ">=", "_operator_greaterequal", OT_INFIX},51 { "?==?", "==", "_operator_equal", OT_INFIX},52 { "?!=?", "!=", "_operator_notequal", OT_INFIX},53 { "?&?", "&", "_operator_bitand", OT_INFIX},54 { "?^?", "^", "_operator_bitxor", OT_INFIX},55 { "?|?", "|", "_operator_bitor", OT_INFIX},56 { "?=?", "=", "_operator_assign", OT_INFIXASSIGN},57 { "?\\=?", "\\=", "_operator_expassign", OT_INFIXASSIGN},58 { "?*=?", "*=", "_operator_multassign", OT_INFIXASSIGN},59 { "?/=?", "/=", "_operator_divassign", OT_INFIXASSIGN},60 { "?%=?", "%=", "_operator_modassign", OT_INFIXASSIGN},61 { "?+=?", "+=", "_operator_addassign", OT_INFIXASSIGN},62 { "?-=?", "-=", "_operator_subassign", OT_INFIXASSIGN},63 { "?<<=?", "<<=", "_operator_shiftleftassign", OT_INFIXASSIGN},64 { "?>>=?", ">>=", "_operator_shiftrightassign", OT_INFIXASSIGN},65 { "?&=?", "&=", "_operator_bitandassign", OT_INFIXASSIGN},66 { "?^=?", "^=", "_operator_bitxorassign", OT_INFIXASSIGN},67 { "?|=?", "|=", "_operator_bitorassign", OT_INFIXASSIGN},26 { "?[?]", "", "_operator_index", "Index", OT_INDEX }, 27 { "?{}", "=", "_constructor", "Constructor", OT_CTOR }, 28 { "^?{}", "", "_destructor", "Destructor", OT_DTOR }, 29 { "?()", "", "_operator_call", "Call Operator", OT_CALL }, 30 { "?++", "++", "_operator_postincr", "Postfix Increment", OT_POSTFIXASSIGN }, 31 { "?--", "--", "_operator_postdecr", "Postfix Decrement", OT_POSTFIXASSIGN }, 32 { "*?", "*", "_operator_deref", "Dereference", OT_PREFIX }, 33 { "+?", "+", "_operator_unaryplus", "Plus", OT_PREFIX }, 34 { "-?", "-", "_operator_unaryminus", "Minus", OT_PREFIX }, 35 { "~?", "~", "_operator_bitnot", "Bitwise Not", OT_PREFIX }, 36 { "!?", "!", "_operator_lognot", "Logical Not", OT_PREFIX }, 37 { "++?", "++", "_operator_preincr", "Prefix Increment", OT_PREFIXASSIGN }, 38 { "--?", "--", "_operator_predecr", "Prefix Decrement", OT_PREFIXASSIGN }, 39 { "?\\?", "\\", "_operator_exponential", "Exponentiation", OT_INFIX }, 40 { "?*?", "*", "_operator_multiply", "Multiplication", OT_INFIX }, 41 { "?/?", "/", "_operator_divide", "Division", OT_INFIX }, 42 { "?%?", "%", "_operator_modulus", "Modulo", OT_INFIX }, 43 { "?+?", "+", "_operator_add", "Addition", OT_INFIX }, 44 { "?-?", "-", "_operator_subtract", "Substraction", OT_INFIX }, 45 { "?<<?", "<<", "_operator_shiftleft", "Shift Left", OT_INFIX }, 46 { "?>>?", ">>", "_operator_shiftright", "Shift Right", OT_INFIX }, 47 { "?<?", "<", "_operator_less", "Less-than", OT_INFIX }, 48 { "?>?", ">", "_operator_greater", "Greater-than", OT_INFIX }, 49 { "?<=?", "<=", "_operator_lessequal", "Less-than-or-Equal", OT_INFIX }, 50 { "?>=?", ">=", "_operator_greaterequal", "Greater-than-or-Equal", OT_INFIX }, 51 { "?==?", "==", "_operator_equal", "Equality", OT_INFIX }, 52 { "?!=?", "!=", "_operator_notequal", "Not-Equal", OT_INFIX }, 53 { "?&?", "&", "_operator_bitand", "Bitwise And", OT_INFIX }, 54 { "?^?", "^", "_operator_bitxor", "Bitwise Xor", OT_INFIX }, 55 { "?|?", "|", "_operator_bitor", "Bitwise Or", OT_INFIX }, 56 { "?=?", "=", "_operator_assign", "Assignment", OT_INFIXASSIGN }, 57 { "?\\=?", "\\=", "_operator_expassign", "Exponentiation Assignment", OT_INFIXASSIGN }, 58 { "?*=?", "*=", "_operator_multassign", "Multiplication Assignment", OT_INFIXASSIGN }, 59 { "?/=?", "/=", "_operator_divassign", "Division Assignment", OT_INFIXASSIGN }, 60 { "?%=?", "%=", "_operator_modassign", "Modulo Assignment", OT_INFIXASSIGN }, 61 { "?+=?", "+=", "_operator_addassign", "Addition Assignment", OT_INFIXASSIGN }, 62 { "?-=?", "-=", "_operator_subassign", "Substrction Assignment", OT_INFIXASSIGN }, 63 { "?<<=?", "<<=", "_operator_shiftleftassign", "Shift Left Assignment", OT_INFIXASSIGN }, 64 { "?>>=?", ">>=", "_operator_shiftrightassign", "Shift Right Assignment", OT_INFIXASSIGN }, 65 { "?&=?", "&=", "_operator_bitandassign", "Bitwise And Assignment", OT_INFIXASSIGN }, 66 { "?^=?", "^=", "_operator_bitxorassign", "Bitwise Xor Assignment", OT_INFIXASSIGN }, 67 { "?|=?", "|=", "_operator_bitorassign", "Bitwise Or Assignment", OT_INFIXASSIGN }, 68 68 }; 69 69 … … 105 105 OperatorInfo info; 106 106 return operatorLookup( funcName, info ); 107 } 108 109 std::string operatorFriendlyName( const std::string & funcName ) { 110 OperatorInfo info; 111 if( operatorLookup( funcName, info ) ) { 112 return info.friendlyName; 113 } 114 return ""; 107 115 } 108 116 -
src/CodeGen/OperatorTable.h
r686cb63 r98538288 38 38 std::string symbol; 39 39 std::string outputName; 40 std::string friendlyName; 40 41 OperatorType type; 41 42 }; … … 43 44 bool isOperator( const std::string & funcName ); 44 45 bool operatorLookup( const std::string & funcName, OperatorInfo & info ); 46 std::string operatorFriendlyName( const std::string & funcName ); 45 47 46 48 bool isConstructor( const std::string & ); -
src/Common/SemanticError.h
r686cb63 r98538288 49 49 struct WarningData { 50 50 const char * const name; 51 const Severity default_severity; 51 52 const char * const message; 52 const Severity default_severity;53 53 }; 54 54 55 55 constexpr WarningData WarningFormats[] = { 56 {"self-assign" , "self assignment of expression: %s" , Severity::Warn}, 57 {"reference-conversion" , "rvalue to reference conversion of rvalue: %s" , Severity::Warn}, 58 {"qualifiers-zero_t-one_t", "questionable use of type qualifier %s with %s", Severity::Warn}, 59 {"aggregate-forward-decl" , "forward declaration of nested aggregate: %s" , Severity::Warn}, 60 {"superfluous-decl" , "declaration does not allocate storage: %s" , Severity::Warn}, 61 {"gcc-attributes" , "invalid attribute: %s" , Severity::Warn}, 56 {"self-assign" , Severity::Warn , "self assignment of expression: %s" }, 57 {"reference-conversion" , Severity::Warn , "rvalue to reference conversion of rvalue: %s" }, 58 {"qualifiers-zero_t-one_t", Severity::Warn , "questionable use of type qualifier %s with %s" }, 59 {"aggregate-forward-decl" , Severity::Warn , "forward declaration of nested aggregate: %s" }, 60 {"superfluous-decl" , Severity::Warn , "declaration does not allocate storage: %s" }, 61 {"gcc-attributes" , Severity::Warn , "invalid attribute: %s" }, 62 {"c++-like-copy" , Severity::Warn , "Constructor from reference is not a valid copy constructor" }, 62 63 }; 63 64 … … 69 70 SuperfluousDecl, 70 71 GccAttributes, 72 CppCopy, 71 73 NUMBER_OF_WARNINGS, // This MUST be the last warning 72 74 }; -
src/SymTab/Validate.cc
r686cb63 r98538288 311 311 Stats::Heap::newPass("validate-A"); 312 312 Stats::Time::BlockGuard guard("validate-A"); 313 VerifyCtorDtorAssign::verify( translationUnit ); // must happen before autogen, because autogen examines existing ctor/dtors 313 314 acceptAll( translationUnit, hoistDecls ); 314 315 ReplaceTypedef::replaceTypedef( translationUnit ); … … 336 337 Stats::Time::BlockGuard guard("validate-C"); 337 338 acceptAll( translationUnit, genericParams ); // check as early as possible - can't happen before LinkReferenceToTypes_old 338 VerifyCtorDtorAssign::verify( translationUnit ); // must happen before autogen, because autogen examines existing ctor/dtors339 339 ReturnChecker::checkFunctionReturns( translationUnit ); 340 340 InitTweak::fixReturnStatements( translationUnit ); // must happen before autogen … … 1182 1182 if ( CodeGen::isCtorDtorAssign( funcDecl->get_name() ) ) { // TODO: also check /=, etc. 1183 1183 if ( params.size() == 0 ) { 1184 SemanticError( funcDecl , "Constructors, destructors, and assignment functions require at least one parameter" );1184 SemanticError( funcDecl->location, "Constructors, destructors, and assignment functions require at least one parameter." ); 1185 1185 } 1186 1186 ReferenceType * refType = dynamic_cast< ReferenceType * >( params.front()->get_type() ); 1187 1187 if ( ! refType ) { 1188 SemanticError( funcDecl , "First parameter of a constructor, destructor, or assignment function must be a reference" );1188 SemanticError( funcDecl->location, "First parameter of a constructor, destructor, or assignment function must be a reference." ); 1189 1189 } 1190 1190 if ( CodeGen::isCtorDtor( funcDecl->get_name() ) && returnVals.size() != 0 ) { 1191 SemanticError( funcDecl, "Constructors and destructors cannot have explicit return values " ); 1191 if(!returnVals.front()->get_type()->isVoid()) { 1192 SemanticError( funcDecl->location, "Constructors and destructors cannot have explicit return values." ); 1193 } 1192 1194 } 1193 1195 }
Note: See TracChangeset
for help on using the changeset viewer.