summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Pilgrim <llvm-dev@redking.me.uk>2019-10-02 16:03:36 +0000
committerSimon Pilgrim <llvm-dev@redking.me.uk>2019-10-02 16:03:36 +0000
commit96ab296ea40e6ffb563496c147bfa3d9a55b2cea (patch)
tree03bb40c8a2515b58fe98db03422002d5c4a8daeb
parentc4a7b912c26e30b5793f16ddf920a2db762c695a (diff)
downloadbcm5719-llvm-96ab296ea40e6ffb563496c147bfa3d9a55b2cea.tar.gz
bcm5719-llvm-96ab296ea40e6ffb563496c147bfa3d9a55b2cea.zip
Type - silence static analyzer getAs<> null dereference warnings. NFCI.
The static analyzer is warning about potential null dereferences, but in these cases we should be able to use castAs<> directly and if not assert will fire for us. llvm-svn: 373480
-rw-r--r--clang/lib/AST/Type.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/clang/lib/AST/Type.cpp b/clang/lib/AST/Type.cpp
index 0f7f6244d2a..8ab2f1e271e 100644
--- a/clang/lib/AST/Type.cpp
+++ b/clang/lib/AST/Type.cpp
@@ -75,11 +75,11 @@ const IdentifierInfo* QualType::getBaseTypeIdentifier() const {
if (ty->isPointerType() || ty->isReferenceType())
return ty->getPointeeType().getBaseTypeIdentifier();
else if (ty->isRecordType())
- ND = ty->getAs<RecordType>()->getDecl();
+ ND = ty->castAs<RecordType>()->getDecl();
else if (ty->isEnumeralType())
- ND = ty->getAs<EnumType>()->getDecl();
+ ND = ty->castAs<EnumType>()->getDecl();
else if (ty->getTypeClass() == Type::Typedef)
- ND = ty->getAs<TypedefType>()->getDecl();
+ ND = ty->castAs<TypedefType>()->getDecl();
else if (ty->isArrayType())
return ty->castAsArrayTypeUnsafe()->
getElementType().getBaseTypeIdentifier();
OpenPOWER on IntegriCloud