From: Ted Kremenek Date: Wed, 16 Dec 2009 05:58:28 +0000 (+0000) Subject: Teach NoReturnFunctionChecker that FunctionDecl::getIdentifier() is not guaranteed... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b01a322ed6bc20e08b6a25b070070aac2eb5dd9e;p=clang Teach NoReturnFunctionChecker that FunctionDecl::getIdentifier() is not guaranteed to return a non-null IdentifierInfo*. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91510 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Analysis/NoReturnFunctionChecker.cpp b/lib/Analysis/NoReturnFunctionChecker.cpp index 6806273d4b..5cfd9acd5f 100644 --- a/lib/Analysis/NoReturnFunctionChecker.cpp +++ b/lib/Analysis/NoReturnFunctionChecker.cpp @@ -45,13 +45,12 @@ bool NoReturnFunctionChecker::EvalCallExpr(CheckerContext &C, if (FD->getAttr() || FD->getAttr()) BuildSinks = true; - else { + else if (const IdentifierInfo *II = FD->getIdentifier()) { // HACK: Some functions are not marked noreturn, and don't return. // Here are a few hardwired ones. If this takes too long, we can // potentially cache these results. - using llvm::StringRef; BuildSinks - = llvm::StringSwitch(StringRef(FD->getIdentifier()->getName())) + = llvm::StringSwitch(llvm::StringRef(II->getName())) .Case("exit", true) .Case("panic", true) .Case("error", true)