summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
Diffstat (limited to 'clang')
-rw-r--r--clang/lib/AST/Decl.cpp6
-rw-r--r--clang/test/SemaOpenCL/builtin.cl13
2 files changed, 18 insertions, 1 deletions
diff --git a/clang/lib/AST/Decl.cpp b/clang/lib/AST/Decl.cpp
index ce1b9fac554..7378c44178b 100644
--- a/clang/lib/AST/Decl.cpp
+++ b/clang/lib/AST/Decl.cpp
@@ -2732,6 +2732,12 @@ unsigned FunctionDecl::getBuiltinID() const {
if (getStorageClass() == SC_Static)
return 0;
+ // OpenCL v1.2 s6.9.f - The library functions defined in
+ // the C99 standard headers are not available.
+ if (Context.getLangOpts().OpenCL &&
+ Context.BuiltinInfo.isPredefinedLibFunction(BuiltinID))
+ return 0;
+
return BuiltinID;
}
diff --git a/clang/test/SemaOpenCL/builtin.cl b/clang/test/SemaOpenCL/builtin.cl
index e5f56e2577d..d48a0c44959 100644
--- a/clang/test/SemaOpenCL/builtin.cl
+++ b/clang/test/SemaOpenCL/builtin.cl
@@ -1,3 +1,14 @@
// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only
-float __attribute__((overloadable)) acos(float); // expected-no-diagnostics
+// expected-no-diagnostics
+
+float __attribute__((overloadable)) acos(float);
+
+typedef float float4 __attribute__((ext_vector_type(4)));
+int printf(__constant const char* st, ...);
+
+void test(void)
+{
+ float4 a;
+ printf("%8.4v4hlf\n", a);
+}
OpenPOWER on IntegriCloud