If preprocessed token introduced empty filename then use main translation unit's filename for debug info entries.

llvm-svn: 125672
This commit is contained in:
Devang Patel 2011-02-16 18:40:36 +00:00
parent 4b22e7e67a
commit 1728c232d5
2 changed files with 10 additions and 1 deletions

View File

@ -161,7 +161,7 @@ llvm::DIFile CGDebugInfo::getOrCreateFile(SourceLocation Loc) {
SourceManager &SM = CGM.getContext().getSourceManager();
PresumedLoc PLoc = SM.getPresumedLoc(Loc);
if (PLoc.isInvalid())
if (PLoc.isInvalid() || llvm::StringRef(PLoc.getFilename()).empty())
// If the location is not valid then use main input file.
return DBuilder.CreateFile(TheCU.getFilename(), TheCU.getDirectory());

View File

@ -19,3 +19,12 @@ dispatch_item_t LEGACY_dispatch_call(dispatch_queue_t dq,
}
);
}
// radar://9008853
typedef struct P {
int x;
} PS;
# 1 ""
void foo() {
PS p2;
}