aboutsummaryrefslogtreecommitdiff
path: root/Lex/Preprocessor.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2007-11-15 19:07:47 +0000
committerChris Lattner <sabre@nondot.org>2007-11-15 19:07:47 +0000
commitb283298f03d2b512204d14ca687f9de263eeff0f (patch)
tree5b80740c4412252a27c6714c6499faca98f0c262 /Lex/Preprocessor.cpp
parent767dd4b8306c81ab16d9c428ed1d5d39678315bb (diff)
fix a bug Steve noticed, where a #import of the main file itself would fail.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44178 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'Lex/Preprocessor.cpp')
-rw-r--r--Lex/Preprocessor.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/Lex/Preprocessor.cpp b/Lex/Preprocessor.cpp
index 718b47693a..0970590afe 100644
--- a/Lex/Preprocessor.cpp
+++ b/Lex/Preprocessor.cpp
@@ -416,7 +416,12 @@ void Preprocessor::EnterMainSourceFile(unsigned MainFileID) {
// Enter the main file source buffer.
EnterSourceFile(MainFileID, 0);
-
+ // Tell the header info that the main file was entered. If the file is later
+ // #imported, it won't be re-entered.
+ if (const FileEntry *FE =
+ SourceMgr.getFileEntryForLoc(SourceLocation::getFileLoc(MainFileID, 0)))
+ HeaderInfo.IncrementIncludeCount(FE);
+
std::vector<char> PrologFile;
PrologFile.reserve(4080);