diff options
author | Ted Kremenek <kremenek@apple.com> | 2009-02-12 03:26:59 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2009-02-12 03:26:59 +0000 |
commit | a5c2c27ebd5c714105b526b0317a192bf75f1659 (patch) | |
tree | 4949f08c4a7ccd100911ebaeaf765872bd75353a /clang/lib/Lex/Preprocessor.cpp | |
parent | b92c4d72a7fee4cb18f5917f2456fd0713d52d60 (diff) | |
download | bcm5719-llvm-a5c2c27ebd5c714105b526b0317a192bf75f1659.tar.gz bcm5719-llvm-a5c2c27ebd5c714105b526b0317a192bf75f1659.zip |
PTH: Cache stat information for files in the PTH file. Hook up FileManager
to use this stat information in the PTH file using a 'StatSysCallCache' object.
Performance impact (Cocoa.h, PTH):
- number of stat calls reduces from 1230 to 425
- fsyntax-only: time improves by 4.2%
We can reduce the number of stat calls to almost zero by caching negative stat
calls and directory stat calls in the PTH file as well.
llvm-svn: 64353
Diffstat (limited to 'clang/lib/Lex/Preprocessor.cpp')
-rw-r--r-- | clang/lib/Lex/Preprocessor.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/clang/lib/Lex/Preprocessor.cpp b/clang/lib/Lex/Preprocessor.cpp index db5ca2bd7fe..69aa7cb51a6 100644 --- a/clang/lib/Lex/Preprocessor.cpp +++ b/clang/lib/Lex/Preprocessor.cpp @@ -32,6 +32,7 @@ #include "clang/Lex/ScratchBuffer.h" #include "clang/Lex/LexDiagnostic.h" #include "clang/Basic/SourceManager.h" +#include "clang/Basic/FileManager.h" #include "clang/Basic/TargetInfo.h" #include "llvm/ADT/APFloat.h" #include "llvm/ADT/SmallVector.h" @@ -117,6 +118,11 @@ Preprocessor::~Preprocessor() { delete Callbacks; } +void Preprocessor::setPTHManager(PTHManager* pm) { + PTH.reset(pm); + FileMgr.setStatCache(PTH->createStatCache()); +} + void Preprocessor::DumpToken(const Token &Tok, bool DumpFlags) const { llvm::cerr << tok::getTokenName(Tok.getKind()) << " '" << getSpelling(Tok) << "'"; |