Fixes https://bugs.llvm.org/show_bug.cgi?id=36474
In general, getSVal API should be changed so that it does not crash on
some non-obvious conditions.
It should either be updated to require a type, or to return Optional<SVal>.
Differential Revision: https://reviews.llvm.org/D43801
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@326233
91177308-0d34-0410-b5e6-
96231b3b80d8
return;
ProgramStateRef State = C.getState();
- SVal V = State->getSVal(location.castAs<Loc>());
if (isGlobalConstString(location)) {
+ SVal V = State->getSVal(location.castAs<Loc>());
Optional<DefinedOrUnknownSVal> Constr = V.getAs<DefinedOrUnknownSVal>();
if (Constr) {
--- /dev/null
+// RUN: %clang_analyze_cc1 -analyzer-checker=core %s
+a;
+b(void **c) { // no-crash
+ *c = a;
+ int *d;
+ b(&d);
+ *d;
+}