зеркало из https://github.com/microsoft/clang.git
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@39861 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
c215bd659d
Коммит
f46f68b558
|
@ -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(); }
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче