[PATCH] D31397: [Bug 25404] Fix crash on typedef in OpenCL 2.0
Phabricator via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Apr 4 10:03:29 PDT 2017
This revision was automatically updated to reflect the committed changes.
Closed by commit rL299447: [Bug 25404] Fix crash on typedef in OpenCL 2.0 (authored by stulova).
Changed prior to commit:
https://reviews.llvm.org/D31397?vs=93226&id=94091#toc
Repository:
rL LLVM
https://reviews.llvm.org/D31397
Files:
cfe/trunk/lib/Sema/SemaDecl.cpp
cfe/trunk/test/SemaOpenCL/types.cl
Index: cfe/trunk/lib/Sema/SemaDecl.cpp
===================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp
+++ cfe/trunk/lib/Sema/SemaDecl.cpp
@@ -2154,7 +2154,9 @@
// -Wtypedef-redefinition. If either the original or the redefinition is
// in a system header, don't emit this for compatibility with GCC.
if (getDiagnostics().getSuppressSystemWarnings() &&
- (Context.getSourceManager().isInSystemHeader(Old->getLocation()) ||
+ // Some standard types are defined implicitly in Clang (e.g. OpenCL).
+ (Old->isImplicit() ||
+ Context.getSourceManager().isInSystemHeader(Old->getLocation()) ||
Context.getSourceManager().isInSystemHeader(New->getLocation())))
return;
Index: cfe/trunk/test/SemaOpenCL/types.cl
===================================================================
--- cfe/trunk/test/SemaOpenCL/types.cl
+++ cfe/trunk/test/SemaOpenCL/types.cl
@@ -0,0 +1,6 @@
+// RUN: %clang_cc1 %s -cl-std=CL2.0 -verify -fsyntax-only
+
+// expected-no-diagnostics
+
+// Check redefinition of standard types
+typedef atomic_int atomic_flag;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D31397.94091.patch
Type: text/x-patch
Size: 1117 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170404/70487506/attachment.bin>
More information about the cfe-commits
mailing list