Changeset 7030dab for src/Common
- Timestamp:
- Apr 6, 2020, 4:46:28 PM (5 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- e3bc51c
- Parents:
- 71d6bd8 (diff), 057298e (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - Location:
- src/Common
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Common/Debug.h
r71d6bd8 r7030dab 9 9 // Author : Rob Schluntz 10 10 // Created On : Fri Sep 1 11:09:14 2017 11 // Last Modified By : Rob Schluntz12 // Last Modified On : Fri Sep 1 11:09:36 201713 // Update Count : 211 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Dec 13 23:39:42 2019 13 // Update Count : 3 14 14 // 15 15 … … 21 21 22 22 #include "CodeGen/Generate.h" 23 #include " Parser/LinkageSpec.h"23 #include "SynTree/LinkageSpec.h" 24 24 #include "SynTree/Declaration.h" 25 25 -
src/Common/PassVisitor.h
r71d6bd8 r7030dab 110 110 virtual void visit( FinallyStmt * finallyStmt ) override final; 111 111 virtual void visit( const FinallyStmt * finallyStmt ) override final; 112 virtual void visit( SuspendStmt * suspendStmt ) override final; 113 virtual void visit( const SuspendStmt * suspendStmt ) override final; 112 114 virtual void visit( WaitForStmt * waitforStmt ) override final; 113 115 virtual void visit( const WaitForStmt * waitforStmt ) override final; … … 276 278 virtual Statement * mutate( CatchStmt * catchStmt ) override final; 277 279 virtual Statement * mutate( FinallyStmt * finallyStmt ) override final; 280 virtual Statement * mutate( SuspendStmt * suspendStmt ) override final; 278 281 virtual Statement * mutate( WaitForStmt * waitforStmt ) override final; 279 282 virtual Declaration * mutate( WithStmt * withStmt ) override final; -
src/Common/PassVisitor.impl.h
r71d6bd8 r7030dab 1522 1522 1523 1523 //-------------------------------------------------------------------------- 1524 // SuspendStmt 1525 template< typename pass_type > 1526 void PassVisitor< pass_type >::visit( SuspendStmt * node ) { 1527 VISIT_START( node ); 1528 1529 maybeAccept_impl( node->then , *this ); 1530 1531 VISIT_END( node ); 1532 } 1533 1534 template< typename pass_type > 1535 void PassVisitor< pass_type >::visit( const SuspendStmt * node ) { 1536 VISIT_START( node ); 1537 1538 maybeAccept_impl( node->then , *this ); 1539 1540 VISIT_END( node ); 1541 } 1542 1543 template< typename pass_type > 1544 Statement * PassVisitor< pass_type >::mutate( SuspendStmt * node ) { 1545 MUTATE_START( node ); 1546 1547 maybeMutate_impl( node->then , *this ); 1548 1549 MUTATE_END( Statement, node ); 1550 } 1551 1552 //-------------------------------------------------------------------------- 1524 1553 // WaitForStmt 1525 1554 template< typename pass_type > … … 3302 3331 VISIT_START( node ); 3303 3332 3304 indexerAdd Struct( node->name );3333 indexerAddUnion( node->name ); 3305 3334 3306 3335 { … … 3317 3346 VISIT_START( node ); 3318 3347 3319 indexerAdd Struct( node->name );3348 indexerAddUnion( node->name ); 3320 3349 3321 3350 { … … 3332 3361 MUTATE_START( node ); 3333 3362 3334 indexerAdd Struct( node->name );3363 indexerAddUnion( node->name ); 3335 3364 3336 3365 { -
src/Common/SemanticError.cc
r71d6bd8 r7030dab 149 149 // Helpers 150 150 namespace ErrorHelpers { 151 Colors colors = Colors::Auto; 152 153 static inline bool with_colors() { 154 return colors == Colors::Auto ? isatty( STDERR_FILENO ) : bool(colors); 155 } 156 151 157 const std::string & error_str() { 152 static std::string str = isatty( STDERR_FILENO) ? "\e[31merror:\e[39m " : "error: ";158 static std::string str = with_colors() ? "\e[31merror:\e[39m " : "error: "; 153 159 return str; 154 160 } 155 161 156 162 const std::string & warning_str() { 157 static std::string str = isatty( STDERR_FILENO) ? "\e[95mwarning:\e[39m " : "warning: ";163 static std::string str = with_colors() ? "\e[95mwarning:\e[39m " : "warning: "; 158 164 return str; 159 165 } 160 166 161 167 const std::string & bold_ttycode() { 162 static std::string str = isatty( STDERR_FILENO) ? "\e[1m" : "";168 static std::string str = with_colors() ? "\e[1m" : ""; 163 169 return str; 164 170 } 165 171 166 172 const std::string & reset_font_ttycode() { 167 static std::string str = isatty( STDERR_FILENO) ? "\e[0m" : "";173 static std::string str = with_colors() ? "\e[0m" : ""; 168 174 return str; 169 175 } -
src/Common/SemanticError.h
r71d6bd8 r7030dab 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 }; … … 97 99 // Helpers 98 100 namespace ErrorHelpers { 101 enum class Colors { 102 Never = false, 103 Always = true, 104 Auto, 105 }; 106 107 extern Colors colors; 108 99 109 const std::string & error_str(); 100 110 const std::string & warning_str(); -
src/Common/Stats/Time.h
r71d6bd8 r7030dab 9 9 // Author : Thierry Delisle 10 10 // Created On : Fri Mar 01 15:14:11 2019 11 // Last Modified By : 11 // Last Modified By : Andrew Beach 12 12 // Last Modified On : 13 13 // Update Count : … … 41 41 f(); 42 42 } 43 44 template<typename ret_t = void, typename func_t, typename... arg_t> 45 inline ret_t TimeCall( 46 const char *, func_t func, arg_t&&... arg) { 47 return func(std::forward<arg_t>(arg)...); 48 } 43 49 # else 44 50 void StartGlobal(); … … 59 65 func(); 60 66 } 67 68 template<typename ret_t = void, typename func_t, typename... arg_t> 69 inline ret_t TimeCall( 70 const char * name, func_t func, arg_t&&... arg) { 71 BlockGuard guard(name); 72 return func(std::forward<arg_t>(arg)...); 73 } 61 74 # endif 62 75 } -
src/Common/utility.h
r71d6bd8 r7030dab 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
Note: See TracChangeset
for help on using the changeset viewer.