Skip to content

Commit

Permalink
Refactor MacroInfo so range for loops can be used to iterate its tokens.
Browse files Browse the repository at this point in the history
Differential Revision: http://reviews.llvm.org/D9079

llvm-svn: 236976
  • Loading branch information
Daniel Marjamaki committed May 11, 2015
1 parent ecb0e1b commit 89ec723
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions clang-tools-extra/modularize/PreprocessorTracker.cpp
Expand Up @@ -405,14 +405,13 @@ static std::string getMacroExpandedString(clang::Preprocessor &PP,
const clang::MacroArgs *Args) {
std::string Expanded;
// Walk over the macro Tokens.
typedef clang::MacroInfo::tokens_iterator Iter;
for (Iter I = MI->tokens_begin(), E = MI->tokens_end(); I != E; ++I) {
clang::IdentifierInfo *II = I->getIdentifierInfo();
for (const auto &T : MI->tokens()) {
clang::IdentifierInfo *II = T.getIdentifierInfo();
int ArgNo = (II && Args ? MI->getArgumentNum(II) : -1);
if (ArgNo == -1) {
// This isn't an argument, just add it.
if (II == nullptr)
Expanded += PP.getSpelling((*I)); // Not an identifier.
Expanded += PP.getSpelling(T); // Not an identifier.
else {
// Token is for an identifier.
std::string Name = II->getName().str();
Expand Down

0 comments on commit 89ec723

Please sign in to comment.