]> granicus.if.org Git - clang/commitdiff
switch from using a vector to a smallvector for macro replacement tokens
authorChris Lattner <sabre@nondot.org>
Sat, 14 Jul 2007 22:15:50 +0000 (22:15 +0000)
committerChris Lattner <sabre@nondot.org>
Sat, 14 Jul 2007 22:15:50 +0000 (22:15 +0000)
This speeds up parsing carbon.h by 3.3% by avoiding some malloc traffic for
small macros.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@39861 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Lex/MacroInfo.h

index b7495bf548f2e3c1fe30a9c954dcaf01c2093e97..2a5a88b1eb399e4bc340a1b1a3196eb30305ac87 100644 (file)
@@ -15,6 +15,7 @@
 #define LLVM_CLANG_MACROINFO_H
 
 #include "clang/Lex/LexerToken.h"
+#include "llvm/ADT/SmallVector.h"
 #include <vector>
 #include <cassert>
 
@@ -37,7 +38,7 @@ class MacroInfo {
   
   /// ReplacementTokens - This is the list of tokens that the macro is defined
   /// to.
-  std::vector<LexerToken> ReplacementTokens;
+  llvm::SmallVector<LexerToken, 8> ReplacementTokens;
 
   /// IsFunctionLike - True if this macro is a function-like macro, false if it
   /// is an object-like macro.
@@ -157,7 +158,7 @@ public:
     return ReplacementTokens[Tok];
   }
   
-  typedef std::vector<LexerToken>::const_iterator tokens_iterator;
+  typedef llvm::SmallVector<LexerToken, 8>::const_iterator tokens_iterator;
   tokens_iterator tokens_begin() const { return ReplacementTokens.begin(); }
   tokens_iterator tokens_end() const { return ReplacementTokens.end(); }