[PATCH] D31397: [Bug 25404] Fix crash on typedef in OpenCL 2.0
Anastasia Stulova via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Mar 28 04:43:41 PDT 2017
Anastasia updated this revision to Diff 93225.
Anastasia added a comment.
Updated with the full diff.
https://reviews.llvm.org/D31397
Files:
lib/Sema/SemaDecl.cpp
test/SemaOpenCL/types.cl
Index: test/SemaOpenCL/types.cl
===================================================================
--- /dev/null
+++ 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;
Index: lib/Sema/SemaDecl.cpp
===================================================================
--- lib/Sema/SemaDecl.cpp
+++ 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() || New->isImplicit() ||
+ Context.getSourceManager().isInSystemHeader(Old->getLocation()) ||
Context.getSourceManager().isInSystemHeader(New->getLocation())))
return;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D31397.93225.patch
Type: text/x-patch
Size: 1063 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170328/b18f7a01/attachment.bin>
More information about the cfe-commits
mailing list