[PATCH] Refactoring, update MacroInfo interface so a for range can be used to iterate through the tokens

Richard Smith richard at metafoo.co.uk
Wed Apr 29 10:38:00 PDT 2015


================
Comment at: lib/Frontend/PrintPreprocessedOutput.cpp:67
@@ -66,4 +66,3 @@
   SmallString<128> SpellingBuffer;
-  for (MacroInfo::tokens_iterator I = MI.tokens_begin(), E = MI.tokens_end();
-       I != E; ++I) {
-    if (I->hasLeadingSpace())
+  for (auto T : MI.tokens()) {
+    if (T.hasLeadingSpace())
----------------
Sorry for not being more explicit, I meant that you should replace just the `clang::Token` with `auto`. This now *always* makes a copy. `const auto &` is the right thing to use here.

http://reviews.llvm.org/D9079

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the cfe-commits mailing list