r306827 - [OpenCL] Add function name to extension diagnostic
Joey Gouly via cfe-commits
cfe-commits at lists.llvm.org
Fri Jun 30 07:23:01 PDT 2017
Author: joey
Date: Fri Jun 30 07:23:01 2017
New Revision: 306827
URL: http://llvm.org/viewvc/llvm-project?rev=306827&view=rev
Log:
[OpenCL] Add function name to extension diagnostic
Slightly improve the diagnostic by including the function name.
Modified:
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
cfe/trunk/include/clang/Sema/Sema.h
cfe/trunk/lib/Sema/Sema.cpp
cfe/trunk/test/SemaOpenCL/extension-begin.cl
Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=306827&r1=306826&r2=306827&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Fri Jun 30 07:23:01 2017
@@ -8410,7 +8410,7 @@ def warn_opencl_attr_deprecated_ignored
def err_opencl_variadic_function : Error<
"invalid prototype, variadic arguments are not allowed in OpenCL">;
def err_opencl_requires_extension : Error<
- "use of %select{type |declaration}0%1 requires %2 extension to be enabled">;
+ "use of %select{type|declaration}0 %1 requires %2 extension to be enabled">;
// OpenCL v2.0 s6.13.6 -- Builtin Pipe Functions
def err_opencl_builtin_pipe_first_arg : Error<
Modified: cfe/trunk/include/clang/Sema/Sema.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Sema.h?rev=306827&r1=306826&r2=306827&view=diff
==============================================================================
--- cfe/trunk/include/clang/Sema/Sema.h (original)
+++ cfe/trunk/include/clang/Sema/Sema.h Fri Jun 30 07:23:01 2017
@@ -8432,7 +8432,7 @@ public:
/// is disabled due to required OpenCL extensions being disabled. If so,
/// emit diagnostics.
/// \return true if type is disabled.
- bool checkOpenCLDisabledDecl(const Decl &D, const Expr &E);
+ bool checkOpenCLDisabledDecl(const NamedDecl &D, const Expr &E);
//===--------------------------------------------------------------------===//
// OpenMP directives and clauses.
Modified: cfe/trunk/lib/Sema/Sema.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/Sema.cpp?rev=306827&r1=306826&r2=306827&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/Sema.cpp (original)
+++ cfe/trunk/lib/Sema/Sema.cpp Fri Jun 30 07:23:01 2017
@@ -1688,7 +1688,8 @@ bool Sema::checkOpenCLDisabledTypeDeclSp
QT, OpenCLTypeExtMap);
}
-bool Sema::checkOpenCLDisabledDecl(const Decl &D, const Expr &E) {
- return checkOpenCLDisabledTypeOrDecl(&D, E.getLocStart(), "",
+bool Sema::checkOpenCLDisabledDecl(const NamedDecl &D, const Expr &E) {
+ IdentifierInfo *FnName = D.getIdentifier();
+ return checkOpenCLDisabledTypeOrDecl(&D, E.getLocStart(), FnName,
OpenCLDeclExtMap, 1, D.getSourceRange());
}
Modified: cfe/trunk/test/SemaOpenCL/extension-begin.cl
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaOpenCL/extension-begin.cl?rev=306827&r1=306826&r2=306827&view=diff
==============================================================================
--- cfe/trunk/test/SemaOpenCL/extension-begin.cl (original)
+++ cfe/trunk/test/SemaOpenCL/extension-begin.cl Fri Jun 30 07:23:01 2017
@@ -46,7 +46,7 @@ void test_f2(void) {
const struct A test_A_local; // expected-error {{use of type 'struct A' requires my_ext extension to be enabled}}
TypedefOfA test_typedef_A; // expected-error {{use of type 'TypedefOfA' (aka 'struct A') requires my_ext extension to be enabled}}
PointerOfA test_A_pointer; // expected-error {{use of type 'PointerOfA' (aka 'const struct A *') requires my_ext extension to be enabled}}
- f(); // expected-error {{use of declaration requires my_ext extension to be enabled}}
+ f(); // expected-error {{use of declaration 'f' requires my_ext extension to be enabled}}
g(0); // expected-error {{no matching function for call to 'g'}}
// expected-note at -26 {{candidate disabled due to OpenCL extension}}
// expected-note at -22 {{candidate function not viable: requires 0 arguments, but 1 was provided}}
More information about the cfe-commits
mailing list