Changes in src/CodeGen/OperatorTable.cc [bff227f:e5f2a67]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/CodeGen/OperatorTable.cc
rbff227f re5f2a67 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue Dec 13 14:33:05 201613 // Update Count : 1 012 // Last Modified On : Sat Jul 15 17:12:22 2017 13 // Update Count : 15 14 14 // 15 15 16 #include <algorithm> // for any_of 17 #include <map> // for map, _Rb_tree_const_iterator, map<>::const_iterator 18 #include <utility> // for pair 16 #include <map> // for map, _Rb_tree_const_iterator, map<>::const_iterator 17 #include <utility> // for pair 19 18 20 19 #include "OperatorTable.h" … … 36 35 { "++?", "++", "_operator_preincr", OT_PREFIXASSIGN }, 37 36 { "--?", "--", "_operator_predecr", OT_PREFIXASSIGN }, 37 { "?\\?", "\\", "_operator_exponential", OT_INFIX }, 38 38 { "?*?", "*", "_operator_multiply", OT_INFIX }, 39 39 { "?/?", "/", "_operator_divide", OT_INFIX }, … … 53 53 { "?|?", "|", "_operator_bitor", OT_INFIX }, 54 54 { "?=?", "=", "_operator_assign", OT_INFIXASSIGN }, 55 { "?\\=?", "\\=", "_operator_expassign", OT_INFIXASSIGN }, 55 56 { "?*=?", "*=", "_operator_multassign", OT_INFIXASSIGN }, 56 57 { "?/=?", "/=", "_operator_divassign", OT_INFIXASSIGN }, … … 92 93 } // if 93 94 } 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 }129 95 } // namespace CodeGen 130 96
Note:
See TracChangeset
for help on using the changeset viewer.