summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
authorTanya Lattner <tonic@nondot.org>2012-07-26 00:08:28 +0000
committerTanya Lattner <tonic@nondot.org>2012-07-26 00:08:28 +0000
commit4bfc35509405ff7db4de3003f863d4eeea13ea19 (patch)
tree0d3575cafb8247eada842eda983fe402db5fd01f /clang
parent80b4ac76c5a7b99c143cd89f13ca192d24c51c2f (diff)
downloadbcm5719-llvm-4bfc35509405ff7db4de3003f863d4eeea13ea19.tar.gz
bcm5719-llvm-4bfc35509405ff7db4de3003f863d4eeea13ea19.zip
Disable the warning for missing prototypes for OpenCL kernels. Includes testcase.
llvm-svn: 160766
Diffstat (limited to 'clang')
-rw-r--r--clang/lib/Sema/SemaDecl.cpp4
-rw-r--r--clang/test/SemaOpenCL/warn-missing-prototypes.cl6
2 files changed, 10 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index 12444e55594..7233fc7c13e 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -7509,6 +7509,10 @@ static bool ShouldWarnAboutMissingPrototype(const FunctionDecl *FD) {
if (FD->isFunctionTemplateSpecialization())
return false;
+ // Don't warn for OpenCL kernels.
+ if (FD->hasAttr<OpenCLKernelAttr>())
+ return false;
+
bool MissingPrototype = true;
for (const FunctionDecl *Prev = FD->getPreviousDecl();
Prev; Prev = Prev->getPreviousDecl()) {
diff --git a/clang/test/SemaOpenCL/warn-missing-prototypes.cl b/clang/test/SemaOpenCL/warn-missing-prototypes.cl
new file mode 100644
index 00000000000..487cb28399a
--- /dev/null
+++ b/clang/test/SemaOpenCL/warn-missing-prototypes.cl
@@ -0,0 +1,6 @@
+// RUN: %clang_cc1 -fsyntax-only -verify -Wmissing-prototypes %s
+
+void f() { } // expected-warning {{no previous prototype for function 'f'}}
+
+// Don't warn about kernel functions.
+kernel void g() { }
OpenPOWER on IntegriCloud