[cfe-dev] Expr walk up? Looking for Enum name not value?

steveneliuk s.eliuk at samsung.com
Tue Apr 30 11:44:24 PDT 2013


Here is some example code if say you have a VisitCallExpr,

Reminder, this doesnt answer my original question but if your looking for
MacroName this will do it.

bool VisitCallExpr(CallExpr *CE){
//traverse the subexpressions/args
for(clang::CallExpr::arg_iterator argHead = CE->arg_begin(), 
     argTail = CE->arg_end(); 
     argHead != argTail;
     ++argHead){
SourceRange range = argHead->getSourceRange();
if(range.getBegin().isMacroID() || range.getEnd().isMacroID()){
    std::string
macroName(_preprocessor->getImmediateMacroName(range.getBegin()).str());
}

}
}




--
View this message in context: http://clang-developers.42468.n3.nabble.com/Expr-walk-up-Looking-for-Enum-name-not-value-tp4031582p4031845.html
Sent from the Clang Developers mailing list archive at Nabble.com.



More information about the cfe-dev mailing list