]> granicus.if.org Git - clang/commitdiff
Avoid malloc thrashing on the std::vector for ConditionalStack. Because
authorChris Lattner <sabre@nondot.org>
Sun, 18 Jan 2009 02:52:26 +0000 (02:52 +0000)
committerChris Lattner <sabre@nondot.org>
Sun, 18 Jan 2009 02:52:26 +0000 (02:52 +0000)
there is one of these per header, this almost always gets alloc/free'd for
each #ifdef.

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

include/clang/Lex/PreprocessorLexer.h

index 3cf0f92b30f416d79a398029ce09c1634a94091a..f98b5599658fd00c3e9bb3774ae09329e195b21a 100644 (file)
@@ -16,7 +16,7 @@
 
 #include "clang/Lex/MultipleIncludeOpt.h"
 #include "clang/Lex/Token.h"
-#include <vector>
+#include "llvm/ADT/SmallVector.h"
 #include <string>
        
 namespace clang {
@@ -61,7 +61,7 @@ protected:
   
   /// ConditionalStack - Information about the set of #if/#ifdef/#ifndef blocks
   /// we are currently in.
-  std::vector<PPConditionalInfo> ConditionalStack;
+  llvm::SmallVector<PPConditionalInfo, 4> ConditionalStack;
   
   PreprocessorLexer(const PreprocessorLexer&);          // DO NOT IMPLEMENT
   void operator=(const PreprocessorLexer&); // DO NOT IMPLEMENT