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
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63405
91177308-0d34-0410-b5e6-
96231b3b80d8
// #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);