Changeset bc3127d
- Timestamp:
- Sep 1, 2017, 4:26:14 PM (7 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
- Children:
- 5809461, ba2a68b
- Parents:
- 78a0b88
- Location:
- src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
src/CodeGen/OperatorTable.cc
r78a0b88 rbc3127d 19 19 20 20 #include "OperatorTable.h" 21 #include "Common/utility.h" 21 22 22 23 namespace CodeGen { … … 65 66 { "?^=?", "^=", "_operator_bitxorassign", OT_INFIXASSIGN }, 66 67 { "?|=?", "|=", "_operator_bitorassign", OT_INFIXASSIGN }, 67 { "&&", "&&", "&&", OT_LABELADDRESS }, 68 { "0", "0", "_constant_zero", OT_CONSTANT }, 69 { "1", "1", "_constant_one", OT_CONSTANT } 68 { "&&", "&&", "&&", OT_LABELADDRESS } 70 69 }; 71 70 … … 86 85 initialize(); 87 86 } // if 87 88 88 std::map< std::string, OperatorInfo >::const_iterator i = table.find( funcName ); 89 89 if ( i == table.end() ) { 90 if ( isPrefix( funcName, "?`" ) ) { 91 // handle literal suffixes, which are user-defined postfix operators 92 info.inputName = funcName; 93 info.symbol = funcName.substr(2); 94 info.outputName = toString( "__operator_literal_", info.symbol ); 95 info.type = OT_POSTFIX; 96 return true; 97 } 90 98 return false; 91 99 } else { -
src/Common/utility.h
r78a0b88 rbc3127d 222 222 std::cerr << "Warning: "; 223 223 warn_single( params... ); 224 } 225 226 /// determines if `pref` is a prefix of `str` 227 static inline bool isPrefix( const std::string & str, const std::string & pref ) { 228 if ( pref.size() > str.size() ) return false; 229 auto its = std::mismatch( pref.begin(), pref.end(), str.begin() ); 230 return its.first == pref.end(); 224 231 } 225 232 -
src/GenPoly/Box.cc
r78a0b88 rbc3127d 1298 1298 } 1299 1299 1300 /// determines if `pref` is a prefix of `str`1301 bool isPrefix( const std::string & str, const std::string & pref ) {1302 if ( pref.size() > str.size() ) return false;1303 auto its = std::mismatch( pref.begin(), pref.end(), str.begin() );1304 return its.first == pref.end();1305 }1306 1307 1300 DeclarationWithType * Pass2::mutate( FunctionDecl *functionDecl ) { 1308 1301 functionDecl = safe_dynamic_cast< FunctionDecl * > ( handleDecl( functionDecl ) );
Note: See TracChangeset
for help on using the changeset viewer.