Changeset 70f89d00 for src/InitTweak/InitTweak.cc
- Timestamp:
- May 30, 2016, 12:51:22 PM (8 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, ctor, deferred_resn, demangler, enum, forall-pointer-decay, gc_noraii, jacob/cs343-translation, jenkins-sandbox, master, memory, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
- Children:
- f1b1e4c
- Parents:
- 677c1be
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/InitTweak/InitTweak.cc
r677c1be r70f89d00 83 83 } 84 84 } 85 86 namespace { 87 template<typename CallExpr> 88 std::string funcName( CallExpr * expr ) { 89 Expression * func = expr->get_function(); 90 if ( NameExpr * nameExpr = dynamic_cast< NameExpr * >( func ) ) { 91 return nameExpr->get_name(); 92 } else if ( VariableExpr * varExpr = dynamic_cast< VariableExpr * >( func ) ) { 93 return varExpr->get_var()->get_name(); 94 } else { 95 assert( false && "Unexpected expression type being called as a function in call expression" ); 96 } 97 } 98 } 99 100 std::string getFunctionName( Expression * expr ) { 101 if ( ApplicationExpr * appExpr = dynamic_cast< ApplicationExpr * >( expr ) ) { 102 return funcName( appExpr ); 103 } else if ( UntypedExpr * untypedExpr = dynamic_cast< UntypedExpr * > ( expr ) ) { 104 return funcName( untypedExpr ); 105 } else { 106 assert( false && "Unexpected expression type passed to getFunctionName" ); 107 } 108 } 85 109 }
Note: See TracChangeset
for help on using the changeset viewer.