Changes in / [eeaa3e2:0cc3c47]
- Location:
- src
- Files:
-
- 3 edited
-
CodeGen/OperatorTable.cc (modified) (2 diffs)
-
Common/utility.h (modified) (3 diffs)
-
SymTab/Demangle.cc (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/CodeGen/OperatorTable.cc
reeaa3e2 r0cc3c47 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Mon Feb 10 18:12:12 202013 // Update Count : 1 712 // Last Modified On : Sat Jul 15 17:12:22 2017 13 // Update Count : 15 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, "?`" ) ) { // user-defined postfix operator ? 89 if ( isPrefix( funcName, "?`" ) ) { 90 // handle literal suffixes, which are user-defined postfix operators 90 91 info.inputName = funcName; 91 92 info.symbol = funcName.substr(2); 92 info.outputName = toString( "__ postfix_call_", info.symbol );93 info.outputName = toString( "__operator_literal_", info.symbol ); 93 94 info.type = OT_POSTFIX; 94 95 return true; -
src/Common/utility.h
reeaa3e2 r0cc3c47 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue Feb 11 13:00:36 202013 // Update Count : 5012 // Last Modified On : Wed Jul 24 14:28:19 2019 13 // Update Count : 41 14 14 // 15 15 … … 29 29 #include <utility> 30 30 #include <vector> 31 #include <cstring> // memcmp32 31 33 32 #include "Common/Indenter.h" … … 265 264 } 266 265 267 // determines if pref is a prefix of str268 static inline bool isPrefix( const std::string & str, const std::string & pref , unsigned int start = 0) {266 /// determines if `pref` is a prefix of `str` 267 static inline bool isPrefix( const std::string & str, const std::string & pref ) { 269 268 if ( pref.size() > str.size() ) return false; 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++17269 auto its = std::mismatch( pref.begin(), pref.end(), str.begin() ); 270 return its.first == pref.end(); 272 271 } 273 272 -
src/SymTab/Demangle.cc
reeaa3e2 r0cc3c47 10 10 // Created On : Thu Jul 19 12:52:41 2018 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue Feb 11 15:09:18 202013 // Update Count : 1012 // Last Modified On : Fri Dec 13 14:54:15 2019 13 // Update Count : 4 14 14 // 15 15 … … 19 19 #include "CodeGen/GenType.h" 20 20 #include "Common/PassVisitor.h" 21 #include "Common/utility.h" // isPrefix22 21 #include "Mangler.h" 23 22 #include "SynTree/Type.h" … … 417 416 418 417 bool StringView::isPrefix(const std::string & pref) { 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 ) ) { 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()) { 428 421 idx += pref.size(); 429 422 return true; … … 436 429 PRINT( std::cerr << "====== " << str.size() << " " << str << std::endl; ) 437 430 if (str.size() < 2+Encoding::manglePrefix.size()) return false; // +2 for at least _1 suffix 438 if ( ! isPrefix(Encoding::manglePrefix) || ! isdigit(str.back() )) return false;431 if (! isPrefix(Encoding::manglePrefix) || ! isdigit(str.back())) return false; 439 432 440 433 // get name
Note:
See TracChangeset
for help on using the changeset viewer.