Module debugging: Don't emit forward declarations in module scopes.

A forward declaration inside a module header does not belong to the module.

llvm-svn: 249157
This commit is contained in:
Adrian Prantl 2015-10-02 17:36:14 +00:00
parent 992d820e30
commit 335f5c7e3e
3 changed files with 7 additions and 0 deletions

View File

@ -2172,6 +2172,9 @@ ObjCInterfaceDecl *CGDebugInfo::getObjCInterfaceDecl(QualType Ty) {
}
llvm::DIModule *CGDebugInfo::getParentModuleOrNull(const Decl *D) {
// A forward declaration inside a module header does not belong to the module.
if (isa<RecordDecl>(D) && !cast<RecordDecl>(D)->getDefinition())
return nullptr;
if (DebugTypeExtRefs && D->isFromASTFile()) {
// Record a reference to an imported clang module or precompiled header.
auto *Reader = CGM.getContext().getExternalSource();

View File

@ -5,6 +5,7 @@
}
+ classMethod;
- instanceMethodWithInt:(int)i;
- (struct OpaqueData*) getSomethingOpaque;
@property int property;
@end

View File

@ -41,3 +41,6 @@
// MODULE-CHECK: !DICompositeType(tag: DW_TAG_structure_type,
// MODULE-CHECK-SAME: name: "ObjCClass",
// MODULE-CHECK-SAME: scope: ![[MODULE]],
// The forward declaration should not be in the module scope.
// MODULE-CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "OpaqueData", file