diff options
author | Anastasia Stulova <anastasia.stulova@arm.com> | 2017-04-04 16:50:46 +0000 |
---|---|---|
committer | Anastasia Stulova <anastasia.stulova@arm.com> | 2017-04-04 16:50:46 +0000 |
commit | 297908da5ba2195d92ce05701c0fe6e0d5edb19a (patch) | |
tree | 83f0d59dadf00d2a9d2dc57aca9a741284e98020 /clang/lib/Sema/SemaDecl.cpp | |
parent | 48596b6f7a422650987c7f2c2566917c7dfff61c (diff) | |
download | bcm5719-llvm-297908da5ba2195d92ce05701c0fe6e0d5edb19a.tar.gz bcm5719-llvm-297908da5ba2195d92ce05701c0fe6e0d5edb19a.zip |
[Bug 25404] Fix crash on typedef in OpenCL 2.0
Fixed the assertion due to absence of source location for
implicitly defined types (using addImplicitTypedef()).
During Sema checks the source location is being expected
and therefore an assertion is triggered.
The change is not specific to OpenCL. But it is particularly
common for OpenCL types to be declared implicitly in Clang
to support the mode without the standard header.
Differential Revision: https://reviews.llvm.org/D31397
llvm-svn: 299447
Diffstat (limited to 'clang/lib/Sema/SemaDecl.cpp')
-rw-r--r-- | clang/lib/Sema/SemaDecl.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp index 80b23557a7a..7659fba14a3 100644 --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/lib/Sema/SemaDecl.cpp @@ -2154,7 +2154,9 @@ void Sema::MergeTypedefNameDecl(Scope *S, TypedefNameDecl *New, // -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; |