diff options
author | rdivacky <rdivacky@FreeBSD.org> | 2010-03-21 10:50:08 +0000 |
---|---|---|
committer | rdivacky <rdivacky@FreeBSD.org> | 2010-03-21 10:50:08 +0000 |
commit | 1e255aab650a7fa2047fd953cae65b12215280af (patch) | |
tree | 508d4388db78f87d35bf26a0400b4b03bc4c1f13 /lib/Frontend/CacheTokens.cpp | |
parent | 1033b7c1e32962948b01a25145829f17bc70a8de (diff) | |
download | FreeBSD-src-1e255aab650a7fa2047fd953cae65b12215280af.zip FreeBSD-src-1e255aab650a7fa2047fd953cae65b12215280af.tar.gz |
Update clang to r99115.
Diffstat (limited to 'lib/Frontend/CacheTokens.cpp')
-rw-r--r-- | lib/Frontend/CacheTokens.cpp | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/lib/Frontend/CacheTokens.cpp b/lib/Frontend/CacheTokens.cpp index 02d6cec..d069e8f 100644 --- a/lib/Frontend/CacheTokens.cpp +++ b/lib/Frontend/CacheTokens.cpp @@ -164,11 +164,12 @@ public: } // end anonymous namespace typedef OnDiskChainedHashTableGenerator<FileEntryPTHEntryInfo> PTHMap; -typedef llvm::DenseMap<const IdentifierInfo*,uint32_t> IDMap; -typedef llvm::StringMap<OffsetOpt, llvm::BumpPtrAllocator> CachedStrsTy; namespace { class PTHWriter { + typedef llvm::DenseMap<const IdentifierInfo*,uint32_t> IDMap; + typedef llvm::StringMap<OffsetOpt, llvm::BumpPtrAllocator> CachedStrsTy; + IDMap IM; llvm::raw_fd_ostream& Out; Preprocessor& PP; @@ -272,7 +273,7 @@ PTHEntry PTHWriter::LexTokens(Lexer& L) { // Pad 0's so that we emit tokens to a 4-byte alignment. // This speed up reading them back in. Pad(Out, 4); - Offset off = (Offset) Out.tell(); + Offset TokenOff = (Offset) Out.tell(); // Keep track of matching '#if' ... '#endif'. typedef std::vector<std::pair<Offset, unsigned> > PPCondTable; @@ -418,7 +419,7 @@ PTHEntry PTHWriter::LexTokens(Lexer& L) { Emit32(PPCond.size()); for (unsigned i = 0, e = PPCond.size(); i!=e; ++i) { - Emit32(PPCond[i].first - off); + Emit32(PPCond[i].first - TokenOff); uint32_t x = PPCond[i].second; assert(x != 0 && "PPCond entry not backpatched."); // Emit zero for #endifs. This allows us to do checking when @@ -426,7 +427,7 @@ PTHEntry PTHWriter::LexTokens(Lexer& L) { Emit32(x == i ? 0 : x); } - return PTHEntry(off, PPCondOff); + return PTHEntry(TokenOff, PPCondOff); } Offset PTHWriter::EmitCachedSpellings() { @@ -452,7 +453,7 @@ void PTHWriter::GeneratePTH(const std::string &MainFile) { // Write the name of the MainFile. if (!MainFile.empty()) { - EmitString(MainFile); + EmitString(MainFile); } else { // String with 0 bytes. Emit16(0); @@ -549,7 +550,8 @@ void clang::CacheTokens(Preprocessor &PP, llvm::raw_fd_ostream* OS) { // Lex through the entire file. This will populate SourceManager with // all of the header information. Token Tok; - PP.EnterMainSourceFile(); + if (PP.EnterMainSourceFile()) + return; do { PP.Lex(Tok); } while (Tok.isNot(tok::eof)); // Generate the PTH file. |