summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema
diff options
context:
space:
mode:
authorNico Weber <nicolasweber@gmx.de>2015-01-04 04:53:10 +0000
committerNico Weber <nicolasweber@gmx.de>2015-01-04 04:53:10 +0000
commit3632e034ba9dbe8f1fb41fb84c7b6588c2ea5e4f (patch)
tree5fccdc3568717cb9ce7c9cec4b29bd83fd2cb1f9 /clang/lib/Sema
parent12b12e800b04404c3763ebcef2168c429921f04e (diff)
downloadbcm5719-llvm-3632e034ba9dbe8f1fb41fb84c7b6588c2ea5e4f.tar.gz
bcm5719-llvm-3632e034ba9dbe8f1fb41fb84c7b6588c2ea5e4f.zip
Crash less enthusiasticially on _Atomic or __restrict__ on invalid types.
Many places in Sema cannot handle isNull() types. This is fine, because in most places the type building code recovers by falling back to IntTy. In GetFullTypeForDeclarator(), this is done at the end of the getNumTypeObjects() loop body. This function calls BuildQualifiedType() before this fallback is done though, so it explicitly needs to check for isNull() types. llvm-svn: 225124
Diffstat (limited to 'clang/lib/Sema')
-rw-r--r--clang/lib/Sema/SemaType.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaType.cpp b/clang/lib/Sema/SemaType.cpp
index 45824060654..95c3698bf1e 100644
--- a/clang/lib/Sema/SemaType.cpp
+++ b/clang/lib/Sema/SemaType.cpp
@@ -1188,6 +1188,9 @@ static std::string getPrintableNameForEntity(DeclarationName Entity) {
QualType Sema::BuildQualifiedType(QualType T, SourceLocation Loc,
Qualifiers Qs, const DeclSpec *DS) {
+ if (T.isNull())
+ return QualType();
+
// Enforce C99 6.7.3p2: "Types other than pointer types derived from
// object or incomplete types shall not be restrict-qualified."
if (Qs.hasRestrict()) {
@@ -1226,6 +1229,9 @@ QualType Sema::BuildQualifiedType(QualType T, SourceLocation Loc,
QualType Sema::BuildQualifiedType(QualType T, SourceLocation Loc,
unsigned CVRA, const DeclSpec *DS) {
+ if (T.isNull())
+ return QualType();
+
// Convert from DeclSpec::TQ to Qualifiers::TQ by just dropping TQ_atomic.
unsigned CVR = CVRA & ~DeclSpec::TQ_atomic;
OpenPOWER on IntegriCloud