[PATCH] D16351: [FIX] Bug 25404 - Crash on typedef in OpenCL 2.0

Anastasia Stulova via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 3 10:37:17 PST 2016


Anastasia added inline comments.

================
Comment at: lib/Sema/SemaDecl.cpp:2039
@@ +2038,3 @@
+  if (Old->isImplicit() || New->isImplicit()) {
+    // Since we don't emit system header warnings for compatibility with GCC,
+    // don't do this for implicit type redifinition warnings the same way.
----------------
redifinition -> redefinition

================
Comment at: test/SemaOpenCL/implicit-typedef.cl:1
@@ +1,2 @@
+// RUN: %clang_cc1 %s -cl-std=CL2.0 -verify -pedantic -fsyntax-only -Wsystem-headers
+typedef atomic_int atomic_flag; // expected-warning {{redefinition of typedef 'atomic_flag' is a C11 feature}}
----------------
Could we also add a run line without  -Wsystem-headers.

You can pass -D and use #ifdef for checking the error conditionally in this test. 

================
Comment at: test/SemaOpenCL/implicit-typedef.cl:2
@@ +1,2 @@
+// RUN: %clang_cc1 %s -cl-std=CL2.0 -verify -pedantic -fsyntax-only -Wsystem-headers
+typedef atomic_int atomic_flag; // expected-warning {{redefinition of typedef 'atomic_flag' is a C11 feature}}
----------------
ichesnokov wrote:
> ichesnokov wrote:
> > Test case command line fixed.
> Added a warning (reused existing C/C++). Warning is checked in test case.
atomic_flag is a part of OpenCL not C11 here.

I think it would be nicer to change this error to use select and pass either C11 or OpenCL.


http://reviews.llvm.org/D16351





More information about the cfe-commits mailing list