fix a bug Steve noticed, where a #import of the main file itself would fail.

llvm-svn: 44178
This commit is contained in:
Chris Lattner 2007-11-15 19:07:47 +00:00
parent 6a7ddfdb8f
commit 609d413363
2 changed files with 13 additions and 1 deletions

View File

@ -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);

View File

@ -0,0 +1,7 @@
// RUN: clang -E -I. %s | grep BODY_OF_FILE | wc -l | grep 1
// This #import should have no effect, as we're importing the current file.
#import <import_self.c>
BODY_OF_FILE