diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2018-05-30 01:52:16 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2018-05-30 01:52:16 +0000 |
commit | b534510cd55dc979bf6eebd66140cda23ba1f163 (patch) | |
tree | 4b706bc1d81ed13881f82f6b30933e0ea1ae18e5 /clang/lib/CodeGen/CodeGenModule.cpp | |
parent | 4977c375a549c25cea35cf6389f641c58eb3b402 (diff) | |
download | bcm5719-llvm-b534510cd55dc979bf6eebd66140cda23ba1f163.tar.gz bcm5719-llvm-b534510cd55dc979bf6eebd66140cda23ba1f163.zip |
Make the mangled name collision diagnostic a bit more useful by listing the mangling.
This helps especially when the collision is for a template specialization,
where the template arguments are not available from anywhere else in the
diagnostic, and are likely relevant to the problem.
llvm-svn: 333489
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
-rw-r--r-- | clang/lib/CodeGen/CodeGenModule.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index 50b653c70ff..3098e0f984c 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -2445,8 +2445,8 @@ llvm::Constant *CodeGenModule::GetOrCreateLLVMFunction( (GD.getCanonicalDecl().getDecl() != OtherGD.getCanonicalDecl().getDecl()) && DiagnosedConflictingDefinitions.insert(GD).second) { - getDiags().Report(D->getLocation(), - diag::err_duplicate_mangled_name); + getDiags().Report(D->getLocation(), diag::err_duplicate_mangled_name) + << MangledName; getDiags().Report(OtherGD.getDecl()->getLocation(), diag::note_previous_definition); } @@ -2744,8 +2744,8 @@ CodeGenModule::GetOrCreateLLVMGlobal(StringRef MangledName, (OtherD = dyn_cast<VarDecl>(OtherGD.getDecl())) && OtherD->hasInit() && DiagnosedConflictingDefinitions.insert(D).second) { - getDiags().Report(D->getLocation(), - diag::err_duplicate_mangled_name); + getDiags().Report(D->getLocation(), diag::err_duplicate_mangled_name) + << MangledName; getDiags().Report(OtherGD.getDecl()->getLocation(), diag::note_previous_definition); } @@ -3783,7 +3783,8 @@ void CodeGenModule::emitIFuncDefinition(GlobalDecl GD) { GlobalDecl OtherGD; if (lookupRepresentativeDecl(MangledName, OtherGD) && DiagnosedConflictingDefinitions.insert(GD).second) { - Diags.Report(D->getLocation(), diag::err_duplicate_mangled_name); + Diags.Report(D->getLocation(), diag::err_duplicate_mangled_name) + << MangledName; Diags.Report(OtherGD.getDecl()->getLocation(), diag::note_previous_definition); } |