Patch to clean up and improve visual display of
builtin function ambiguity.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84289 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaOverload.cpp b/lib/Sema/SemaOverload.cpp
index a227dfb..ecadcd9 100644
--- a/lib/Sema/SemaOverload.cpp
+++ b/lib/Sema/SemaOverload.cpp
@@ -4148,13 +4148,20 @@
} else if (OnlyViable) {
assert(Cand->Conversions.size() <= 2 &&
"builtin-binary-operator-not-binary");
- if (Cand->Conversions.size() == 1)
- Diag(OpLoc, diag::err_ovl_builtin_unary_candidate)
- << Opc << Cand->BuiltinTypes.ParamTypes[0];
- else
- Diag(OpLoc, diag::err_ovl_builtin_binary_candidate)
- << Opc << Cand->BuiltinTypes.ParamTypes[0]
- << Cand->BuiltinTypes.ParamTypes[1];
+ std::string TypeStr("operator");
+ TypeStr += Opc;
+ TypeStr += "(";
+ TypeStr += Cand->BuiltinTypes.ParamTypes[0].getAsString();
+ if (Cand->Conversions.size() == 1) {
+ TypeStr += ")";
+ Diag(OpLoc, diag::err_ovl_builtin_unary_candidate) << TypeStr;
+ }
+ else {
+ TypeStr += ", ";
+ TypeStr += Cand->BuiltinTypes.ParamTypes[1].getAsString();
+ TypeStr += ")";
+ Diag(OpLoc, diag::err_ovl_builtin_binary_candidate) << TypeStr;
+ }
}
else if (!Cand->Viable && !Reported) {
// Non-viability might be due to ambiguous user-defined conversions,