diff options
author | Anastasia Stulova <anastasia.stulova@arm.com> | 2018-06-22 15:45:08 +0000 |
---|---|---|
committer | Anastasia Stulova <anastasia.stulova@arm.com> | 2018-06-22 15:45:08 +0000 |
commit | bf549bf40231495888ce44e6b15e4eaf3a817971 (patch) | |
tree | cd75fe540ce4abc343f3d361b9ce5b6723cb114c | |
parent | 0cde82ade524b3bea196d88a325981332f331244 (diff) | |
download | bcm5719-llvm-bf549bf40231495888ce44e6b15e4eaf3a817971.tar.gz bcm5719-llvm-bf549bf40231495888ce44e6b15e4eaf3a817971.zip |
[Sema] Updated note for address spaces to print the type.
This allows to reuse the same diagnostic for OpenCL or CUDA.
llvm-svn: 335358
-rw-r--r-- | clang/include/clang/Basic/DiagnosticSemaKinds.td | 4 | ||||
-rw-r--r-- | clang/lib/Sema/SemaOverload.cpp | 4 | ||||
-rw-r--r-- | clang/test/SemaCXX/address-space-references.cpp | 8 |
3 files changed, 7 insertions, 9 deletions
diff --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td b/clang/include/clang/Basic/DiagnosticSemaKinds.td index 454aa537740..b7ede8518ee 100644 --- a/clang/include/clang/Basic/DiagnosticSemaKinds.td +++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td @@ -3683,8 +3683,8 @@ def note_ovl_candidate_bad_lvalue : Note< "%select{%ordinal4 argument|object argument}3">; def note_ovl_candidate_bad_addrspace : Note< "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: " - "%select{%ordinal7|'this'}6 argument (%3) is in " - "address space %4, but parameter must be in address space %5">; + "address space mismatch in %select{%ordinal6|'this'}5 argument (%3), " + "parameter type must be %4">; def note_ovl_candidate_bad_gc : Note< "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: " "%select{%ordinal7|'this'}6 argument (%3) has %select{no|__weak|__strong}4 " diff --git a/clang/lib/Sema/SemaOverload.cpp b/clang/lib/Sema/SemaOverload.cpp index b1df8f6232c..34ac5c16470 100644 --- a/clang/lib/Sema/SemaOverload.cpp +++ b/clang/lib/Sema/SemaOverload.cpp @@ -9591,9 +9591,7 @@ static void DiagnoseBadConversion(Sema &S, OverloadCandidate *Cand, S.Diag(Fn->getLocation(), diag::note_ovl_candidate_bad_addrspace) << (unsigned)FnKindPair.first << (unsigned)FnKindPair.second << FnDesc << (FromExpr ? FromExpr->getSourceRange() : SourceRange()) << FromTy - << FromQs.getAddressSpaceAttributePrintValue() - << ToQs.getAddressSpaceAttributePrintValue() - << (unsigned)isObjectArgument << I + 1; + << ToTy << (unsigned)isObjectArgument << I + 1; MaybeEmitInheritedConstructorNote(S, Cand->FoundDecl); return; } diff --git a/clang/test/SemaCXX/address-space-references.cpp b/clang/test/SemaCXX/address-space-references.cpp index f5a63d24a96..5c297e76c41 100644 --- a/clang/test/SemaCXX/address-space-references.cpp +++ b/clang/test/SemaCXX/address-space-references.cpp @@ -3,10 +3,10 @@ typedef int __attribute__((address_space(1))) int_1; typedef int __attribute__((address_space(2))) int_2; -void f0(int_1 &); // expected-note{{candidate function not viable: 1st argument ('int') is in address space 0, but parameter must be in address space 1}} \ -// expected-note{{candidate function not viable: 1st argument ('int_2' (aka '__attribute__((address_space(2))) int')) is in address space 2, but parameter must be in address space 1}} -void f0(const int_1 &); // expected-note{{candidate function not viable: 1st argument ('int') is in address space 0, but parameter must be in address space 1}} \ -// expected-note{{candidate function not viable: 1st argument ('int_2' (aka '__attribute__((address_space(2))) int')) is in address space 2, but parameter must be in address space 1}} +void f0(int_1 &); // expected-note{{candidate function not viable: address space mismatch in 1st argument ('int'), parameter type must be 'int_1 &' (aka '__attribute__((address_space(1))) int &')}} \ +// expected-note{{candidate function not viable: address space mismatch in 1st argument ('int_2' (aka '__attribute__((address_space(2))) int')), parameter type must be 'int_1 &' (aka '__attribute__((address_space(1))) int &')}} +void f0(const int_1 &); // expected-note{{candidate function not viable: address space mismatch in 1st argument ('int'), parameter type must be 'const int_1 &' (aka 'const __attribute__((address_space(1))) int &')}} \ +// expected-note{{candidate function not viable: address space mismatch in 1st argument ('int_2' (aka '__attribute__((address_space(2))) int')), parameter type must be 'const int_1 &' (aka 'const __attribute__((address_space(1))) int &')}} void test_f0() { int i; |