[PATCH] D16692: [OpenCL] Eliminate warning when declaring OpenCL builtin functions
Yaxun Liu via cfe-commits
cfe-commits at lists.llvm.org
Fri Jan 29 09:14:33 PST 2016
yaxunl updated the summary for this revision.
yaxunl updated this revision to Diff 46390.
yaxunl added a comment.
revised as Xiuli suggested.
http://reviews.llvm.org/D16692
Files:
lib/Sema/SemaLookup.cpp
test/SemaOpenCL/builtin.cl
Index: test/SemaOpenCL/builtin.cl
===================================================================
--- /dev/null
+++ test/SemaOpenCL/builtin.cl
@@ -0,0 +1,3 @@
+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only
+
+float __attribute__((overloadable)) acos(float); // expected-no-diagnostics
Index: lib/Sema/SemaLookup.cpp
===================================================================
--- lib/Sema/SemaLookup.cpp
+++ lib/Sema/SemaLookup.cpp
@@ -690,6 +690,12 @@
S.Context.BuiltinInfo.isPredefinedLibFunction(BuiltinID))
return false;
+ // By OpenCL spec v1.2 s6.9.f, the library functions defined in the
+ // C99 standard headers are not available.
+ if (S.getLangOpts().OpenCL &&
+ S.Context.BuiltinInfo.isPredefinedLibFunction(BuiltinID))
+ return false;
+
if (NamedDecl *D = S.LazilyCreateBuiltin((IdentifierInfo *)II,
BuiltinID, S.TUScope,
R.isForRedeclaration(),
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D16692.46390.patch
Type: text/x-patch
Size: 1054 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160129/c357c359/attachment-0001.bin>
More information about the cfe-commits
mailing list