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

Anastasia Stulova via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 1 10:28:32 PST 2016


Anastasia added a subscriber: Anastasia.

================
Comment at: lib/Sema/SemaDecl.cpp:2038
@@ +2037,3 @@
+  // returns 0. The're many implicit typedefs in OpenCL, e.g. atomic_flag.
+  if (Old->isImplicit() || New->isImplicit()) {
+    return;
----------------
Braces are not needed.

================
Comment at: test/SemaOpenCL/implicit-typedef.cl:1
@@ +1,2 @@
+// RUN: %clang_cc1 "-cc1" "-emit-llvm" "-D" "cl_khr_fp64" "-D" "cl_khr_int64_base_atomics" "-fno-dwarf-directory-asm" "-fmessage-length" "205" "-fdiagnostics-show-option" "-cl-std=CL2.0" "-x" "cl" "%s" "-fcolor-diagnostics" -o -
+typedef atomic_int atomic_flag;
----------------
"-cc1" is not needed. I have a feeling most of the things are not needed here.

Generally doesn't seem to follow the style. Could you please check other tests as an example. Let's say test/SemaOpenCL/extern.cl.

================
Comment at: test/SemaOpenCL/implicit-typedef.cl:2
@@ +1,2 @@
+// RUN: %clang_cc1 "-cc1" "-emit-llvm" "-D" "cl_khr_fp64" "-D" "cl_khr_int64_base_atomics" "-fno-dwarf-directory-asm" "-fmessage-length" "205" "-fdiagnostics-show-option" "-cl-std=CL2.0" "-x" "cl" "%s" "-fcolor-diagnostics" -o -
+typedef atomic_int atomic_flag;
----------------
ichesnokov wrote:
> ichesnokov wrote:
> > Not necessary. Removed.
> -main-file-name is not necessary. Removed.
So now we just silently allow to redefine a builtin OpenCL type. Wondering if giving a warning would be a better option? 


Repository:
  rL LLVM

http://reviews.llvm.org/D16351





More information about the cfe-commits mailing list