[clang-tools-extra] r236976 - Refactor MacroInfo so range for loops can be used to iterate its tokens.
Daniel Marjamaki
daniel.marjamaki at evidente.se
Mon May 11 01:26:25 PDT 2015
Author: danielmarjamaki
Date: Mon May 11 03:26:25 2015
New Revision: 236976
URL: http://llvm.org/viewvc/llvm-project?rev=236976&view=rev
Log:
Refactor MacroInfo so range for loops can be used to iterate its tokens.
Differential Revision: http://reviews.llvm.org/D9079
Modified:
clang-tools-extra/trunk/modularize/PreprocessorTracker.cpp
Modified: clang-tools-extra/trunk/modularize/PreprocessorTracker.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/modularize/PreprocessorTracker.cpp?rev=236976&r1=236975&r2=236976&view=diff
==============================================================================
--- clang-tools-extra/trunk/modularize/PreprocessorTracker.cpp (original)
+++ clang-tools-extra/trunk/modularize/PreprocessorTracker.cpp Mon May 11 03:26:25 2015
@@ -405,14 +405,13 @@ static std::string getMacroExpandedStrin
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();
More information about the cfe-commits
mailing list