diff options
author | Anastasia Stulova <anastasia.stulova@arm.com> | 2016-02-02 11:29:43 +0000 |
---|---|---|
committer | Anastasia Stulova <anastasia.stulova@arm.com> | 2016-02-02 11:29:43 +0000 |
commit | b607e0f23859e12face36e8cb8b17e66142e5d11 (patch) | |
tree | a25cb2482b614dd79ccef88a34c780cd621ca8a4 /clang/lib/Sema/SemaLookup.cpp | |
parent | fa5113893229876b156d80469b1930adc3221225 (diff) | |
download | bcm5719-llvm-b607e0f23859e12face36e8cb8b17e66142e5d11.tar.gz bcm5719-llvm-b607e0f23859e12face36e8cb8b17e66142e5d11.zip |
[OpenCL] Eliminate warning when declaring OpenCL builtin functions.
OpenCL builtin functions are usually declared in header files.
Currently clang emits warning for OpenCL builtin functions
which have the same name as standard C library functions.
This commit eliminates such warnings by not adding the C standard
includes following the restriction from OpenCL v1.2 s6.9.f.
Patch by Liu Yaxun (Sam)!
Review: http://reviews.llvm.org/D16692
llvm-svn: 259491
Diffstat (limited to 'clang/lib/Sema/SemaLookup.cpp')
-rw-r--r-- | clang/lib/Sema/SemaLookup.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/clang/lib/Sema/SemaLookup.cpp b/clang/lib/Sema/SemaLookup.cpp index f28cd27e85c..93d503e20b5 100644 --- a/clang/lib/Sema/SemaLookup.cpp +++ b/clang/lib/Sema/SemaLookup.cpp @@ -684,9 +684,9 @@ static bool LookupBuiltin(Sema &S, LookupResult &R) { // If this is a builtin on this (or all) targets, create the decl. if (unsigned BuiltinID = II->getBuiltinID()) { - // In C++, we don't have any predefined library functions like - // 'malloc'. Instead, we'll just error. - if (S.getLangOpts().CPlusPlus && + // In C++ and OpenCL (spec v1.2 s6.9.f), we don't have any predefined + // library functions like 'malloc'. Instead, we'll just error. + if ((S.getLangOpts().CPlusPlus || S.getLangOpts().OpenCL) && S.Context.BuiltinInfo.isPredefinedLibFunction(BuiltinID)) return false; |