expose an iterator interface to getReplacementTokens instead of the datastructure itself.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@39860 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/Lex/MacroExpander.cpp b/Lex/MacroExpander.cpp
index a45efbd..45d4611 100644
--- a/Lex/MacroExpander.cpp
+++ b/Lex/MacroExpander.cpp
@@ -240,8 +240,8 @@
     InstantiateLoc(Tok.getLocation()),
     AtStartOfLine(Tok.isAtStartOfLine()),
     HasLeadingSpace(Tok.hasLeadingSpace()) {
-  MacroTokens = &Macro->getReplacementTokens()[0];
-  NumMacroTokens = Macro->getReplacementTokens().size();
+  MacroTokens = &*Macro->tokens_begin();
+  NumMacroTokens = Macro->tokens_end()-Macro->tokens_begin();
 
   // If this is a function-like macro, expand the arguments and change
   // MacroTokens to point to the expanded tokens.
@@ -275,7 +275,7 @@
 MacroExpander::~MacroExpander() {
   // If this was a function-like macro that actually uses its arguments, delete
   // the expanded tokens.
-  if (Macro && MacroTokens != &Macro->getReplacementTokens()[0])
+  if (Macro && MacroTokens != &*Macro->tokens_begin())
     delete [] MacroTokens;
   
   // MacroExpander owns its formal arguments.
diff --git a/Lex/Preprocessor.cpp b/Lex/Preprocessor.cpp
index 7952301..073fda2 100644
--- a/Lex/Preprocessor.cpp
+++ b/Lex/Preprocessor.cpp
@@ -1729,7 +1729,7 @@
   // Error reading macro name?  If so, diagnostic already issued.
   if (MacroNameTok.getKind() == tok::eom)
     return;
-  
+
   // If we are supposed to keep comments in #defines, reenable comment saving
   // mode.
   CurLexer->KeepCommentMode = KeepMacroComments;
@@ -1833,6 +1833,7 @@
     }
   }
   
+  
   // Disable __VA_ARGS__ again.
   Ident__VA_ARGS__->setIsPoisoned(true);
 
diff --git a/include/clang/Lex/MacroInfo.h b/include/clang/Lex/MacroInfo.h
index ea1a06d..b7495bf 100644
--- a/include/clang/Lex/MacroInfo.h
+++ b/include/clang/Lex/MacroInfo.h
@@ -157,10 +157,10 @@
     return ReplacementTokens[Tok];
   }
   
-  const std::vector<LexerToken> &getReplacementTokens() const {
-    return ReplacementTokens;
-  }
-
+  typedef std::vector<LexerToken>::const_iterator tokens_iterator;
+  tokens_iterator tokens_begin() const { return ReplacementTokens.begin(); }
+  tokens_iterator tokens_end() const { return ReplacementTokens.end(); }
+  
   /// AddTokenToBody - Add the specified token to the replacement text for the
   /// macro.
   void AddTokenToBody(const LexerToken &Tok) {