[cfe-commits] r160766 - in /cfe/trunk: lib/Sema/SemaDecl.cpp test/SemaOpenCL/warn-missing-prototypes.cl
Tanya Lattner
tonic at nondot.org
Wed Jul 25 17:08:28 PDT 2012
Author: tbrethou
Date: Wed Jul 25 19:08:28 2012
New Revision: 160766
URL: http://llvm.org/viewvc/llvm-project?rev=160766&view=rev
Log:
Disable the warning for missing prototypes for OpenCL kernels. Includes testcase.
Added:
cfe/trunk/test/SemaOpenCL/warn-missing-prototypes.cl
Modified:
cfe/trunk/lib/Sema/SemaDecl.cpp
Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=160766&r1=160765&r2=160766&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Wed Jul 25 19:08:28 2012
@@ -7509,6 +7509,10 @@
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()) {
Added: cfe/trunk/test/SemaOpenCL/warn-missing-prototypes.cl
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaOpenCL/warn-missing-prototypes.cl?rev=160766&view=auto
==============================================================================
--- cfe/trunk/test/SemaOpenCL/warn-missing-prototypes.cl (added)
+++ cfe/trunk/test/SemaOpenCL/warn-missing-prototypes.cl Wed Jul 25 19:08:28 2012
@@ -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() { }
More information about the cfe-commits
mailing list