]> granicus.if.org Git - clang/commitdiff
Adapt to LLVM API change (DINamespace no longer takes line/file info).
authorAdrian Prantl <aprantl@apple.com>
Fri, 28 Apr 2017 22:25:53 +0000 (22:25 +0000)
committerAdrian Prantl <aprantl@apple.com>
Fri, 28 Apr 2017 22:25:53 +0000 (22:25 +0000)
rdar://problem/17484998
https://reviews.llvm.org/D32648

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@301707 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGDebugInfo.cpp
test/CodeGenCXX/debug-info-namespace.cpp
test/Modules/ExtDebugInfo.cpp

index dd32a44393c60e1c02dafd269724fc7b7ce67e92..3e5434660567e9dc6c9dc8f8f0a5ab3b8c0836a2 100644 (file)
@@ -4034,11 +4034,9 @@ CGDebugInfo::getOrCreateNameSpace(const NamespaceDecl *NSDecl) {
   if (I != NameSpaceCache.end())
     return cast<llvm::DINamespace>(I->second);
 
-  unsigned LineNo = getLineNumber(NSDecl->getLocation());
-  llvm::DIFile *FileD = getOrCreateFile(NSDecl->getLocation());
   llvm::DIScope *Context = getDeclContextDescriptor(NSDecl);
-  llvm::DINamespace *NS = DBuilder.createNameSpace(
-      Context, NSDecl->getName(), FileD, LineNo, NSDecl->isInline());
+  llvm::DINamespace *NS =
+      DBuilder.createNameSpace(Context, NSDecl->getName(), NSDecl->isInline());
   NameSpaceCache[NSDecl].reset(NS);
   return NS;
 }
index c75c40766a37d5b655afdeb549a78e8c7a3fdb33..95a83b128fa400ea5cd41814de26f1f527cab4e2 100644 (file)
@@ -53,21 +53,27 @@ inline namespace I {
 int var_i;
 }
 }
-void B::func_fwd() {}
+namespace {
+int anonymous;
+}
+void B::func_fwd() {
+  anonymous = 0;
+}
+
 
 // This should work even if 'i' and 'func' were declarations & not definitions,
 // but it doesn't yet.
 
 // CHECK: [[I:![0-9]+]] = distinct !DIGlobalVariable(name: "i",{{.*}} scope: [[NS:![0-9]+]],
-// CHECK: [[NS]] = !DINamespace(name: "B", scope: [[CTXT:![0-9]+]], file: [[FOOCPP:![0-9]+]], line: 1)
-// CHECK: [[FOOCPP]] = !DIFile(filename: "foo.cpp"
-// CHECK: [[CTXT]] = !DINamespace(name: "A", scope: null, file: [[FILE:![0-9]+]], line: 5)
-// CHECK: [[FILE]] = !DIFile(filename: "{{.*}}debug-info-namespace.cpp",
+// CHECK: [[NS]] = !DINamespace(name: "B", scope: [[CTXT:![0-9]+]])
+// CHECK: [[CTXT]] = !DINamespace(name: "A", scope: null)
+// CHECK: [[FOOCPP:.*]] = !DIFile(filename: "foo.cpp"
 // CHECK: [[VAR_FWD:![0-9]+]] = distinct !DIGlobalVariable(name: "var_fwd",{{.*}} scope: [[NS]],
 // CHECK-SAME:                                             line: 44
 // CHECK-SAME:                                             isDefinition: true
 // CHECK: distinct !DIGlobalVariable(name: "var_i",{{.*}} scope: [[INLINE:![0-9]+]],
-// CHECK: [[INLINE]] = !DINamespace(name: "I", scope: [[CTXT]], file: [[FOOCPP]], line: 46, exportSymbols: true)
+// CHECK: [[INLINE]] = !DINamespace(name: "I", scope: [[CTXT]], exportSymbols: true)
+// CHECK: !DINamespace(scope: null)
 // CHECK: [[CU:![0-9]+]] = distinct !DICompileUnit(
 // CHECK-SAME:                            imports: [[MODULES:![0-9]*]]
 // CHECK: [[MODULES]] = !{[[M1:![0-9]+]], [[M2:![0-9]+]], [[M3:![0-9]+]], [[M4:![0-9]+]], [[M5:![0-9]+]], [[M6:![0-9]+]], [[M7:![0-9]+]], [[M8:![0-9]+]], [[M9:![0-9]+]], [[M10:![0-9]+]], [[M11:![0-9]+]], [[M12:![0-9]+]], [[M13:![0-9]+]], [[M14:![0-9]+]], [[M15:![0-9]+]], [[M16:![0-9]+]], [[M17:![0-9]+]]}
@@ -106,7 +112,7 @@ void B::func_fwd() {}
 // CHECK-SAME:                          scope: [[NS]], file: [[FOOCPP]], line: 9
 // CHECK: [[M15]] = !DIImportedEntity(tag: DW_TAG_imported_declaration, scope: [[FUNC]], entity: [[VAR_FWD:![0-9]+]]
 // CHECK: [[M16]] = !DIImportedEntity(tag: DW_TAG_imported_declaration, scope: [[FUNC]], entity: [[FUNC_FWD:![0-9]+]]
-// CHECK: [[FUNC_FWD]] = distinct !DISubprogram(name: "func_fwd",{{.*}} line: 50,{{.*}} isDefinition: true
+// CHECK: [[FUNC_FWD]] = distinct !DISubprogram(name: "func_fwd",{{.*}} line: 53,{{.*}} isDefinition: true
 // CHECK: [[M17]] = !DIImportedEntity(tag: DW_TAG_imported_declaration, scope: [[CTXT]], entity: [[I]]
 
 // CHECK-GMLT: [[CU:![0-9]+]] = distinct !DICompileUnit(
index 3bd58a3da551090b576e9889f9c40529b851ee56..fd3bb940751fa4f922eaf562c3eb231fe066a769 100644 (file)
@@ -76,7 +76,7 @@ void foo() {
 // CHECK-SAME:             flags: DIFlagFwdDecl,
 // CHECK-SAME:             identifier:  "_ZTSN8DebugCXX4EnumE")
 
-// CHECK: ![[NS]] = !DINamespace(name: "DebugCXX", scope: ![[MOD:[0-9]+]],
+// CHECK: ![[NS]] = !DINamespace(name: "DebugCXX", scope: ![[MOD:[0-9]+]])
 // CHECK: ![[MOD]] = !DIModule(scope: null, name: {{.*}}DebugCXX
 
 // This type is anchored in the module by an explicit template instantiation.