You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Improve diagnostics for overload resolution failure.
Include notes listing the candidates and explaining why they didn't
work. Rather than duplicating the (substantial) logic for this, use the
Clang machinery to generate these diagnostics.
In order to support this, add a mechanism to map `SemIR::LocId`s to
`clang::SourceLocation`s. This works by creating source buffers in Clang
that refer into the Carbon source file so that `SourceLocation`s can
point into them.
// CHECK:STDERR: fail_bad_object_param_qualifiers_by_value.carbon:[[@LINE+7]]:3: error: no matching function for call to `ref_this` [CppOverloadingNoViableFunctionFound]
71
-
// CHECK:STDERR: v.ref_this();
72
-
// CHECK:STDERR: ^~~~~~~~~~~~
73
-
// CHECK:STDERR: fail_bad_object_param_qualifiers_by_value.carbon:[[@LINE+4]]:3: note: in call to Cpp function here [InCallToCppFunction]
74
-
// CHECK:STDERR: v.ref_this();
75
-
// CHECK:STDERR: ^~~~~~~~~~~~
67
+
// CHECK:STDERR: fail_bad_object_param_qualifiers_by_value.carbon:[[@LINE+8]]:14: error: no matching function for call to 'ref_this' [CppInteropParseError]
68
+
// CHECK:STDERR: 29 | v.ref_this();
69
+
// CHECK:STDERR: | ^
70
+
// CHECK:STDERR: fail_bad_object_param_qualifiers_by_value.carbon:[[@LINE-20]]:10: in file included here [InCppInclude]
71
+
// CHECK:STDERR: ./object_param_qualifiers.h:7:8: note: candidate function not viable: expects an lvalue for object argument [CppInteropParseNote]
// CHECK:STDERR: fail_bad_object_param_qualifiers_ref_ref.carbon:[[@LINE+7]]:3: error: no matching function for call to `ref_ref_this` [CppOverloadingNoViableFunctionFound]
124
-
// CHECK:STDERR: p->ref_ref_this();
125
-
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~
126
-
// CHECK:STDERR: fail_bad_object_param_qualifiers_ref_ref.carbon:[[@LINE+4]]:3: note: in call to Cpp function here [InCallToCppFunction]
127
-
// CHECK:STDERR: p->ref_ref_this();
128
-
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~
112
+
// CHECK:STDERR: fail_bad_object_param_qualifiers_ref_ref.carbon:[[@LINE+8]]:19: error: no matching function for call to 'ref_ref_this' [CppInteropParseError]
113
+
// CHECK:STDERR: 15 | p->ref_ref_this();
114
+
// CHECK:STDERR: | ^
115
+
// CHECK:STDERR: fail_bad_object_param_qualifiers_ref_ref.carbon:[[@LINE-6]]:10: in file included here [InCppInclude]
116
+
// CHECK:STDERR: ./object_param_qualifiers.h:10:8: note: candidate function not viable: expects an rvalue for object argument [CppInteropParseNote]
117
+
// CHECK:STDERR: 10 | void ref_ref_this() &&;
118
+
// CHECK:STDERR: | ^
129
119
// CHECK:STDERR:
130
120
p->ref_ref_this();
131
121
132
-
// CHECK:STDERR: fail_bad_object_param_qualifiers_ref_ref.carbon:[[@LINE+7]]:3: error: no matching function for call to `const_ref_ref_this` [CppOverloadingNoViableFunctionFound]
133
-
// CHECK:STDERR: p->const_ref_ref_this();
134
-
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~
135
-
// CHECK:STDERR: fail_bad_object_param_qualifiers_ref_ref.carbon:[[@LINE+4]]:3: note: in call to Cpp function here [InCallToCppFunction]
136
-
// CHECK:STDERR: p->const_ref_ref_this();
137
-
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~
122
+
// CHECK:STDERR: fail_bad_object_param_qualifiers_ref_ref.carbon:[[@LINE+8]]:25: error: no matching function for call to 'const_ref_ref_this' [CppInteropParseError]
123
+
// CHECK:STDERR: 25 | p->const_ref_ref_this();
124
+
// CHECK:STDERR: | ^
125
+
// CHECK:STDERR: fail_bad_object_param_qualifiers_ref_ref.carbon:[[@LINE-16]]:10: in file included here [InCppInclude]
126
+
// CHECK:STDERR: ./object_param_qualifiers.h:11:8: note: candidate function not viable: expects an rvalue for object argument [CppInteropParseNote]
0 commit comments