From 4aa51ae6c9a56fbc6273a50d232c7a0fed63e29a Mon Sep 17 00:00:00 2001 From: Frederic Riss Date: Thu, 6 Nov 2014 17:46:55 +0000 Subject: Change DIBuilder::createImportedDeclaration from taking a DIScope to a DIDescriptor. Imported declarations can be DIGlobalVariables which aren't a DIScope. Today clang (unknowingly I believe) shoehorns these into a DIScope and it all works just because we never access the fields. llvm-svn: 221466 --- llvm/lib/IR/DIBuilder.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'llvm/lib') diff --git a/llvm/lib/IR/DIBuilder.cpp b/llvm/lib/IR/DIBuilder.cpp index 3276fe6452a..fbd19596377 100644 --- a/llvm/lib/IR/DIBuilder.cpp +++ b/llvm/lib/IR/DIBuilder.cpp @@ -190,10 +190,13 @@ DIImportedEntity DIBuilder::createImportedModule(DIScope Context, } DIImportedEntity DIBuilder::createImportedDeclaration(DIScope Context, - DIScope Decl, + DIDescriptor Decl, unsigned Line, StringRef Name) { + // Make sure to use the unique identifier based metadata reference for + // types that have one. + Value *V = Decl.isType() ? DIType(Decl).getRef() : Decl; return ::createImportedModule(VMContext, dwarf::DW_TAG_imported_declaration, - Context, Decl.getRef(), Line, Name, + Context, V, Line, Name, AllImportedModules); } -- cgit v1.2.3