diff options
author | Simon Pilgrim <llvm-dev@redking.me.uk> | 2019-10-07 13:58:05 +0000 |
---|---|---|
committer | Simon Pilgrim <llvm-dev@redking.me.uk> | 2019-10-07 13:58:05 +0000 |
commit | 3459a4c770bacf10bced00758bb2b70c4c504207 (patch) | |
tree | 4eb738b592682eb7207b3307461888e1c5514731 /clang/lib/AST/StmtPrinter.cpp | |
parent | b63db94fa54789d8241b16e05f2c9d9959afe297 (diff) | |
download | bcm5719-llvm-3459a4c770bacf10bced00758bb2b70c4c504207.tar.gz bcm5719-llvm-3459a4c770bacf10bced00758bb2b70c4c504207.zip |
AST - 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: 373904
Diffstat (limited to 'clang/lib/AST/StmtPrinter.cpp')
-rw-r--r-- | clang/lib/AST/StmtPrinter.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/clang/lib/AST/StmtPrinter.cpp b/clang/lib/AST/StmtPrinter.cpp index 46802d765e1..e86f9c7063e 100644 --- a/clang/lib/AST/StmtPrinter.cpp +++ b/clang/lib/AST/StmtPrinter.cpp @@ -1102,7 +1102,7 @@ void StmtPrinter::VisitIntegerLiteral(IntegerLiteral *Node) { OS << Node->getValue().toString(10, isSigned); // Emit suffixes. Integer literals are always a builtin integer type. - switch (Node->getType()->getAs<BuiltinType>()->getKind()) { + switch (Node->getType()->castAs<BuiltinType>()->getKind()) { default: llvm_unreachable("Unexpected type for integer literal!"); case BuiltinType::Char_S: case BuiltinType::Char_U: OS << "i8"; break; @@ -1123,7 +1123,7 @@ void StmtPrinter::VisitFixedPointLiteral(FixedPointLiteral *Node) { return; OS << Node->getValueAsString(/*Radix=*/10); - switch (Node->getType()->getAs<BuiltinType>()->getKind()) { + switch (Node->getType()->castAs<BuiltinType>()->getKind()) { default: llvm_unreachable("Unexpected type for fixed point literal!"); case BuiltinType::ShortFract: OS << "hr"; break; case BuiltinType::ShortAccum: OS << "hk"; break; @@ -1152,7 +1152,7 @@ static void PrintFloatingLiteral(raw_ostream &OS, FloatingLiteral *Node, return; // Emit suffixes. Float literals are always a builtin float type. - switch (Node->getType()->getAs<BuiltinType>()->getKind()) { + switch (Node->getType()->castAs<BuiltinType>()->getKind()) { default: llvm_unreachable("Unexpected type for float literal!"); case BuiltinType::Half: break; // FIXME: suffix? case BuiltinType::Double: break; // no suffix. @@ -1952,7 +1952,7 @@ void StmtPrinter::VisitLambdaExpr(LambdaExpr *Node) { if (Node->isMutable()) OS << " mutable"; - auto *Proto = Method->getType()->getAs<FunctionProtoType>(); + auto *Proto = Method->getType()->castAs<FunctionProtoType>(); Proto->printExceptionSpecification(OS, Policy); // FIXME: Attributes |