[codeview] Stop emitting fully qualified subprogram display names

This effectively reverts r255744, and leaves the printing option tweaks.

We can add the name qualifiers easily in the backend.

llvm-svn: 273008
This commit is contained in:
Reid Kleckner 2016-06-17 16:11:20 +00:00
parent fd91041ce1
commit 829398e5f0
2 changed files with 27 additions and 33 deletions

View File

@ -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());
Policy.MSVCFormatting = CGM.getCodeGenOpts().EmitCodeView;
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);
}
// 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.

View File

@ -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>"