summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/Decl.cpp
diff options
context:
space:
mode:
authorAnastasia Stulova <anastasia.stulova@arm.com>2016-02-12 12:07:04 +0000
committerAnastasia Stulova <anastasia.stulova@arm.com>2016-02-12 12:07:04 +0000
commit1202de3ec838dd40a7f06cd71225b70c4db2a743 (patch)
treecd926d7f2b86af1ce51c6eaa478640cd3859185d /clang/lib/AST/Decl.cpp
parentebe01560a3719d643a351ebdd098d40ce3b91076 (diff)
downloadbcm5719-llvm-1202de3ec838dd40a7f06cd71225b70c4db2a743.tar.gz
bcm5719-llvm-1202de3ec838dd40a7f06cd71225b70c4db2a743.zip
[OpenCL] Disable C99 standard lib functions
The library functions defined in the C99 standard headers are not available (OpenCL v1.2 s6.9.f). This change stops treating OpenCL builtin functions as standard C lib functions to eliminate warning messages about printf format string. Patch by Liu Yaxun (Sam)! Differential Revision: http://reviews.llvm.org/D16812 llvm-svn: 260671
Diffstat (limited to 'clang/lib/AST/Decl.cpp')
-rw-r--r--clang/lib/AST/Decl.cpp6
1 files changed, 6 insertions, 0 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;
}
OpenPOWER on IntegriCloud