r181556 - Debug Info: include address-of ('&') operator and qualified names in template argument lists
David Blaikie
dblaikie at gmail.com
Thu May 9 15:43:46 PDT 2013
Author: dblaikie
Date: Thu May 9 17:43:45 2013
New Revision: 181556
URL: http://llvm.org/viewvc/llvm-project?rev=181556&view=rev
Log:
Debug Info: include address-of ('&') operator and qualified names in template argument lists
This fixes several (7 out of 16) cases of PR14492 in the GDB 7.5 test
suite. It seems GDB was bailing out whenever it had even the slightest
problem with the template argument list (& I assume it didn't like
seeing template value parameters that were just simple names - perhaps
assuming that lone names must be types, not values)
Modified:
cfe/trunk/lib/AST/TemplateBase.cpp
cfe/trunk/test/CodeGenCXX/debug-info-template.cpp
Modified: cfe/trunk/lib/AST/TemplateBase.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/TemplateBase.cpp?rev=181556&r1=181555&r2=181556&view=diff
==============================================================================
--- cfe/trunk/lib/AST/TemplateBase.cpp (original)
+++ cfe/trunk/lib/AST/TemplateBase.cpp Thu May 9 17:43:45 2013
@@ -353,9 +353,10 @@ void TemplateArgument::print(const Print
case Declaration: {
NamedDecl *ND = cast<NamedDecl>(getAsDecl());
+ Out << '&';
if (ND->getDeclName()) {
// FIXME: distinguish between pointer and reference args?
- Out << *ND;
+ ND->printQualifiedName(Out);
} else {
Out << "<anonymous>";
}
Modified: cfe/trunk/test/CodeGenCXX/debug-info-template.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/debug-info-template.cpp?rev=181556&r1=181555&r2=181556&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/debug-info-template.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/debug-info-template.cpp Thu May 9 17:43:45 2013
@@ -1,19 +1,26 @@
-// RUN: %clang_cc1 -emit-llvm -g %s -o - | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm -g %s -o - -std=c++11 | FileCheck %s
+// CHECK: [[INT:![0-9]*]] = {{.*}} ; [ DW_TAG_base_type ] [int]
// CHECK: metadata [[TCI:![0-9]*]], i32 0, i32 1, %class.TC* @tci, null} ; [ DW_TAG_variable ] [tci]
-// CHECK: [[TC:![0-9]*]] = {{.*}}, metadata [[TCARGS:![0-9]*]]} ; [ DW_TAG_class_type ] [TC<int, 2>]
+// CHECK: [[TC:![0-9]*]] = {{.*}}, metadata [[TCARGS:![0-9]*]]} ; [ DW_TAG_class_type ] [TC<int, 2, &glb, &foo::e, &foo::f, nullptr>]
// CHECK: [[TCARGS]] = metadata !{metadata [[TCARG1:![0-9]*]], metadata [[TCARG2:![0-9]*]]}
//
// We seem to be missing file/line/col info on template value parameters -
// metadata supports it but it's not populated.
//
-// CHECK: [[TCARG1]] = {{.*}}metadata !"T", metadata [[INT:![0-9]*]], {{.*}} ; [ DW_TAG_template_type_parameter ]
-// CHECK: [[INT]] = {{.*}} ; [ DW_TAG_base_type ] [int]
+// CHECK: [[TCARG1]] = {{.*}}metadata !"T", metadata [[INT]], {{.*}} ; [ DW_TAG_template_type_parameter ]
// CHECK: [[TCARG2]] = {{.*}}metadata !"", metadata [[UINT:![0-9]*]], i64 2, {{.*}} ; [ DW_TAG_template_value_parameter ]
// CHECK: [[UINT]] = {{.*}} ; [ DW_TAG_base_type ] [unsigned int]
-template<typename T, unsigned>
+struct foo {
+ int e;
+ void f();
+};
+
+template<typename T, unsigned, int *x, int foo::*a, void (foo::*b)(), int *n>
class TC {
};
-TC<int, 2> tci;
+int glb;
+
+TC<int, 2, &glb, &foo::e, &foo::f, nullptr> tci;
More information about the cfe-commits
mailing list