avoid emitting a bogus line marker for the top level #include

location.  We now -E a file containing "foo" into:

# 1 "t.c"
# 1 "t.c" 1
# 1 "<predefines>" 1
# 1 "t.c" 2
foo

instead of:

# 1 "t.c"
# 1 "t.c" 1
# 0 "t.c"
# 1 "<predefines>" 1
# 1 "t.c" 2
foo

llvm-svn: 63405
This commit is contained in:
Chris Lattner 2009-01-30 18:44:17 +00:00
parent 890c6b5520
commit d8cc884a36
1 changed files with 3 additions and 1 deletions

View File

@ -150,7 +150,9 @@ void PrintPPOutputPPCallbacks::FileChanged(SourceLocation Loc,
// #include directive was at.
SourceManager &SourceMgr = PP.getSourceManager();
if (Reason == PPCallbacks::EnterFile) {
MoveToLine(SourceMgr.getPresumedLoc(Loc).getIncludeLoc());
SourceLocation IncludeLoc = SourceMgr.getPresumedLoc(Loc).getIncludeLoc();
if (IncludeLoc.isValid())
MoveToLine(IncludeLoc);
} else if (Reason == PPCallbacks::SystemHeaderPragma) {
MoveToLine(Loc);