Changeset bff227f for src/CodeGen/OperatorTable.cc
- Timestamp:
- Jul 21, 2017, 3:57:11 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:
- 9191a8e
- Parents:
- 53a8e68
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/CodeGen/OperatorTable.cc
r53a8e68 rbff227f 14 14 // 15 15 16 #include <map> // for map, _Rb_tree_const_iterator, map<>::const_iterator 17 #include <utility> // for pair 16 #include <algorithm> // for any_of 17 #include <map> // for map, _Rb_tree_const_iterator, map<>::const_iterator 18 #include <utility> // for pair 18 19 19 20 #include "OperatorTable.h" … … 91 92 } // if 92 93 } 94 95 /// determines if a given function name is one of the operator types between [begin, end) 96 template<typename Iterator> 97 bool isOperatorType( const std::string & funcName, Iterator begin, Iterator end ) { 98 OperatorInfo info; 99 if ( operatorLookup( funcName, info ) ) { 100 return std::find( begin, end, info.type ) != end; 101 } 102 return false; 103 } 104 105 bool isConstructor( const std::string & funcName ) { 106 static OperatorType types[] = { OT_CTOR }; 107 return isOperatorType( funcName, std::begin(types), std::end(types) ); 108 } 109 110 bool isDestructor( const std::string & funcName ) { 111 static OperatorType types[] = { OT_DTOR }; 112 return isOperatorType( funcName, std::begin(types), std::end(types) ); 113 } 114 115 bool isAssignment( const std::string & funcName ) { 116 static OperatorType types[] = { OT_PREFIXASSIGN, OT_POSTFIXASSIGN, OT_INFIXASSIGN }; 117 return isOperatorType( funcName, std::begin(types), std::end(types) ); 118 } 119 120 bool isCtorDtor( const std::string & funcName ) { 121 static OperatorType types[] = { OT_CTOR, OT_DTOR }; 122 return isOperatorType( funcName, std::begin(types), std::end(types) ); 123 } 124 125 bool isCtorDtorAssign( const std::string & funcName ) { 126 static OperatorType types[] = { OT_CTOR, OT_DTOR, OT_PREFIXASSIGN, OT_POSTFIXASSIGN, OT_INFIXASSIGN }; 127 return isOperatorType( funcName, std::begin(types), std::end(types) ); 128 } 93 129 } // namespace CodeGen 94 130
Note: See TracChangeset
for help on using the changeset viewer.