summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
Diffstat (limited to 'clang')
-rw-r--r--clang/lib/CodeGen/CGDebugInfo.cpp30
-rw-r--r--clang/test/CodeGenCXX/debug-info-codeview-display-name.cpp32
2 files changed, 28 insertions, 34 deletions
diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp
index 85dae5847b5..1ef5e215c69 100644
--- a/clang/lib/CodeGen/CGDebugInfo.cpp
+++ b/clang/lib/CodeGen/CGDebugInfo.cpp
@@ -184,30 +184,24 @@ StringRef CGDebugInfo::getFunctionName(const FunctionDecl *FD) {
FunctionTemplateSpecializationInfo *Info =
FD->getTemplateSpecializationInfo();
- if (!Info && FII && !CGM.getCodeGenOpts().EmitCodeView)
+ if (!Info && FII)
return FII->getName();
// Otherwise construct human readable name for debug info.
SmallString<128> NS;
llvm::raw_svector_ostream OS(NS);
PrintingPolicy Policy(CGM.getLangOpts());
-
- if (CGM.getCodeGenOpts().EmitCodeView) {
- // Print a fully qualified name like MSVC would.
- Policy.MSVCFormatting = true;
- FD->printQualifiedName(OS, Policy);
- } else {
- // Print the unqualified name with some template arguments. This is what
- // DWARF-based debuggers expect.
- FD->printName(OS);
- // Add any template specialization args.
- if (Info) {
- const TemplateArgumentList *TArgs = Info->TemplateArguments;
- const TemplateArgument *Args = TArgs->data();
- unsigned NumArgs = TArgs->size();
- TemplateSpecializationType::PrintTemplateArgumentList(OS, Args, NumArgs,
- Policy);
- }
+ Policy.MSVCFormatting = CGM.getCodeGenOpts().EmitCodeView;
+
+ // Print the unqualified name with some template arguments.
+ FD->printName(OS);
+ // Add any template specialization args.
+ if (Info) {
+ const TemplateArgumentList *TArgs = Info->TemplateArguments;
+ const TemplateArgument *Args = TArgs->data();
+ unsigned NumArgs = TArgs->size();
+ TemplateSpecializationType::PrintTemplateArgumentList(OS, Args, NumArgs,
+ Policy);
}
// Copy this name on the side and use its reference.
diff --git a/clang/test/CodeGenCXX/debug-info-codeview-display-name.cpp b/clang/test/CodeGenCXX/debug-info-codeview-display-name.cpp
index 1d0300c76c0..1c3682462ff 100644
--- a/clang/test/CodeGenCXX/debug-info-codeview-display-name.cpp
+++ b/clang/test/CodeGenCXX/debug-info-codeview-display-name.cpp
@@ -6,9 +6,9 @@ void freefunc() { }
namespace N {
int b() { return 0; }
-// CHECK-DAG: "N::b"
+// CHECK-DAG: "b"
namespace { void func() { } }
-// CHECK-DAG: "N::`anonymous namespace'::func
+// CHECK-DAG: "func"
}
void _c(void) {
@@ -19,19 +19,19 @@ void _c(void) {
struct foo {
int operator+(int);
foo(){}
-// CHECK-DAG: "foo::foo"
+// CHECK-DAG: "foo"
~foo(){}
-// CHECK-DAG: "foo::~foo"
+// CHECK-DAG: "~foo"
foo(int i){}
-// CHECK-DAG: "foo::foo"
+// CHECK-DAG: "foo"
foo(char *q){}
-// CHECK-DAG: "foo::foo"
+// CHECK-DAG: "foo"
static foo* static_method() { return 0; }
-// CHECK-DAG: "foo::static_method"
+// CHECK-DAG: "static_method"
};
@@ -40,7 +40,7 @@ void use_foo() {
foo::static_method();
}
-// CHECK-DAG: "foo::operator+"
+// CHECK-DAG: "operator+"
int foo::operator+(int a) { return a; }
// PR17371
@@ -60,14 +60,14 @@ void OverloadedNewDelete::operator delete(void *) { }
void OverloadedNewDelete::operator delete[](void *) { }
int OverloadedNewDelete::operator+(int x) { return x; };
-// CHECK-DAG: "OverloadedNewDelete::operator new"
-// CHECK-DAG: "OverloadedNewDelete::operator new[]"
-// CHECK-DAG: "OverloadedNewDelete::operator delete"
-// CHECK-DAG: "OverloadedNewDelete::operator delete[]"
-// CHECK-DAG: "OverloadedNewDelete::operator+"
+// CHECK-DAG: "operator new"
+// CHECK-DAG: "operator new[]"
+// CHECK-DAG: "operator delete"
+// CHECK-DAG: "operator delete[]"
+// CHECK-DAG: "operator+"
-template <void (*)(void)>
+template <typename T, void (*)(void)>
void fn_tmpl() {}
-template void fn_tmpl<freefunc>();
-// CHECK-DAG: "fn_tmpl"
+template void fn_tmpl<int, freefunc>();
+// CHECK-DAG: "fn_tmpl<int,&freefunc>"
OpenPOWER on IntegriCloud