Changes in / [0cc3c47:eeaa3e2]
- Location:
- src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
src/CodeGen/OperatorTable.cc
r0cc3c47 reeaa3e2 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat Jul 15 17:12:22 201713 // Update Count : 1 512 // Last Modified On : Mon Feb 10 18:12:12 2020 13 // Update Count : 17 14 14 // 15 15 … … 87 87 std::map< std::string, OperatorInfo >::const_iterator i = table.find( funcName ); 88 88 if ( i == table.end() ) { 89 if ( isPrefix( funcName, "?`" ) ) { 90 // handle literal suffixes, which are user-defined postfix operators 89 if ( isPrefix( funcName, "?`" ) ) { // user-defined postfix operator ? 91 90 info.inputName = funcName; 92 91 info.symbol = funcName.substr(2); 93 info.outputName = toString( "__ operator_literal_", info.symbol );92 info.outputName = toString( "__postfix_call_", info.symbol ); 94 93 info.type = OT_POSTFIX; 95 94 return true; -
src/Common/utility.h
r0cc3c47 reeaa3e2 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Jul 24 14:28:19 201913 // Update Count : 4112 // Last Modified On : Tue Feb 11 13:00:36 2020 13 // Update Count : 50 14 14 // 15 15 … … 29 29 #include <utility> 30 30 #include <vector> 31 #include <cstring> // memcmp 31 32 32 33 #include "Common/Indenter.h" … … 264 265 } 265 266 266 // / determines if `pref` is a prefix of `str`267 static inline bool isPrefix( const std::string & str, const std::string & pref ) {267 // determines if pref is a prefix of str 268 static inline bool isPrefix( const std::string & str, const std::string & pref, unsigned int start = 0 ) { 268 269 if ( pref.size() > str.size() ) return false; 269 auto its = std::mismatch( pref.begin(), pref.end(), str.begin() );270 return its.first == pref.end();270 return 0 == memcmp( str.c_str() + start, pref.c_str(), pref.size() ); 271 // return prefix == full.substr(0, prefix.size()); // for future, requires c++17 271 272 } 272 273 -
src/SymTab/Demangle.cc
r0cc3c47 reeaa3e2 10 10 // Created On : Thu Jul 19 12:52:41 2018 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Dec 13 14:54:15 201913 // Update Count : 412 // Last Modified On : Tue Feb 11 15:09:18 2020 13 // Update Count : 10 14 14 // 15 15 … … 19 19 #include "CodeGen/GenType.h" 20 20 #include "Common/PassVisitor.h" 21 #include "Common/utility.h" // isPrefix 21 22 #include "Mangler.h" 22 23 #include "SynTree/Type.h" … … 416 417 417 418 bool StringView::isPrefix(const std::string & pref) { 418 if ( pref.size() > str.size()-idx ) return false; 419 auto its = std::mismatch( pref.begin(), pref.end(), std::next(str.begin(), idx) ); 420 if (its.first == pref.end()) { 419 // if ( pref.size() > str.size()-idx ) return false; 420 // auto its = std::mismatch( pref.begin(), pref.end(), std::next(str.begin(), idx) ); 421 // if (its.first == pref.end()) { 422 // idx += pref.size(); 423 // return true; 424 // } 425 426 // This update is untested because there are no tests for this code. 427 if ( ::isPrefix( str, pref, idx ) ) { 421 428 idx += pref.size(); 422 429 return true; … … 429 436 PRINT( std::cerr << "====== " << str.size() << " " << str << std::endl; ) 430 437 if (str.size() < 2+Encoding::manglePrefix.size()) return false; // +2 for at least _1 suffix 431 if ( ! isPrefix(Encoding::manglePrefix) || ! isdigit(str.back())) return false;438 if ( ! isPrefix(Encoding::manglePrefix) || ! isdigit(str.back() ) ) return false; 432 439 433 440 // get name
Note: See TracChangeset
for help on using the changeset viewer.