summaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGDebugInfo.cpp
diff options
context:
space:
mode:
authorDavid Blaikie <dblaikie@gmail.com>2013-05-14 00:34:20 +0000
committerDavid Blaikie <dblaikie@gmail.com>2013-05-14 00:34:20 +0000
commit7be62a87abf60d4c13ab60ee8fb896aebac188a8 (patch)
tree7792bf41dea1559192ae41f1977516d8a2d5431b /lib/CodeGen/CGDebugInfo.cpp
parentef202c35b37c137e32fe30f4453915b6d3b525d7 (diff)
downloadclang-7be62a87abf60d4c13ab60ee8fb896aebac188a8.tar.gz
clang-7be62a87abf60d4c13ab60ee8fb896aebac188a8.tar.bz2
clang-7be62a87abf60d4c13ab60ee8fb896aebac188a8.tar.xz
PR15956: Debug Info: Include the appropriate file location in types created due to using declarations
We might benefit from API refactoring here (why pass in a value that's derived from another parameter?) but this is the immediate issue. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181747 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGDebugInfo.cpp')
-rw-r--r--lib/CodeGen/CGDebugInfo.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/CodeGen/CGDebugInfo.cpp b/lib/CodeGen/CGDebugInfo.cpp
index 583b23980e..f6ad8f2cc5 100644
--- a/lib/CodeGen/CGDebugInfo.cpp
+++ b/lib/CodeGen/CGDebugInfo.cpp
@@ -2178,8 +2178,10 @@ llvm::DIDescriptor CGDebugInfo::getDeclarationOrDefinition(const Decl *D) {
// we would otherwise do to get a type for a pointee. (forward declarations in
// limited debug info, full definitions (if the type definition is available)
// in unlimited debug info)
- if (const TypeDecl *RD = dyn_cast<TypeDecl>(D))
- return CreatePointeeType(QualType(RD->getTypeForDecl(), 0), llvm::DIFile());
+ if (const TypeDecl *TD = dyn_cast<TypeDecl>(D)) {
+ llvm::DIFile DefUnit = getOrCreateFile(TD->getLocation());
+ return CreatePointeeType(CGM.getContext().getTypeDeclType(TD), DefUnit);
+ }
// Otherwise fall back to a fairly rudimentary cache of existing declarations.
// This doesn't handle providing declarations (for functions or variables) for
// entities without definitions in this TU, nor when the definition proceeds