[cfe-commits] r39861 - /cfe/trunk/include/clang/Lex/MacroInfo.h
Chris Lattner
sabre at nondot.org
Sat Jul 14 15:15:50 PDT 2007
Author: lattner
Date: Sat Jul 14 17:15:50 2007
New Revision: 39861
URL: http://llvm.org/viewvc/llvm-project?rev=39861&view=rev
Log:
switch from using a vector to a smallvector for macro replacement tokens
This speeds up parsing carbon.h by 3.3% by avoiding some malloc traffic for
small macros.
Modified:
cfe/trunk/include/clang/Lex/MacroInfo.h
Modified: cfe/trunk/include/clang/Lex/MacroInfo.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Lex/MacroInfo.h?rev=39861&r1=39860&r2=39861&view=diff
==============================================================================
--- cfe/trunk/include/clang/Lex/MacroInfo.h (original)
+++ cfe/trunk/include/clang/Lex/MacroInfo.h Sat Jul 14 17:15:50 2007
@@ -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 @@
/// 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 @@
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(); }
More information about the cfe-commits
mailing list