No functional change intended.
Patch by Sebastian Edman!
llvm-svn: 238547
arg_iterator arg_begin() const { return ArgumentList; }
arg_iterator arg_end() const { return ArgumentList + NumArguments; }
unsigned getNumArgs() const { return NumArguments; }
+ ArrayRef<const IdentifierInfo *> args() const {
+ return ArrayRef<const IdentifierInfo *>(ArgumentList, NumArguments);
+ }
/// \brief Return the argument number of the specified identifier,
/// or -1 if the identifier is not a formal argument identifier.
- int getArgumentNum(IdentifierInfo *Arg) const {
+ int getArgumentNum(const IdentifierInfo *Arg) const {
for (arg_iterator I = arg_begin(), E = arg_end(); I != E; ++I)
if (*I == Arg)
return I - arg_begin();
// If this is a function-like macro invocation, it's safe to trivially expand
// as long as the identifier is not a macro argument.
- for (MacroInfo::arg_iterator I = MI->arg_begin(), E = MI->arg_end();
- I != E; ++I)
- if (*I == II)
- return false; // Identifier is a macro argument.
+ return std::find(MI->arg_begin(), MI->arg_end(), II) == MI->arg_end();
- return true;
}
Record.push_back(MI->isGNUVarargs());
Record.push_back(MI->hasCommaPasting());
Record.push_back(MI->getNumArgs());
- for (MacroInfo::arg_iterator I = MI->arg_begin(), E = MI->arg_end();
- I != E; ++I)
- AddIdentifierRef(*I, Record);
+ for (const IdentifierInfo *Arg : MI->args())
+ AddIdentifierRef(Arg, Record);
}
// If we have a detailed preprocessing record, record the macro definition