]> granicus.if.org Git - clang/commitdiff
Fix PR 4988 by removing an invalid assertion (a function can be referenced in
authorTed Kremenek <kremenek@apple.com>
Wed, 23 Sep 2009 01:30:01 +0000 (01:30 +0000)
committerTed Kremenek <kremenek@apple.com>
Wed, 23 Sep 2009 01:30:01 +0000 (01:30 +0000)
GRExprEngine::VisitDeclRefExpr without 'asLValue' being true).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82598 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Analysis/GRExprEngine.cpp
test/Analysis/misc-ps.m

index a6c3c66a0a3d00414eec3d8b00a0b6a66926dbd5..735949cd4a07d298af153b0b2b6129700d374297 100644 (file)
@@ -1006,7 +1006,7 @@ void GRExprEngine::VisitDeclRefExpr(DeclRefExpr *Ex, ExplodedNode *Pred,
     return;
 
   } else if (const FunctionDecl* FD = dyn_cast<FunctionDecl>(D)) {
-    assert(asLValue);
+    // This code is valid regardless of the value of 'isLValue'.
     SVal V = ValMgr.getFunctionPointer(FD);
     MakeNode(Dst, Ex, Pred, state->BindExpr(Ex, V),
              ProgramPoint::PostLValueKind);
index f877d4449c6ab7443eb46a17e0ff2bb40db18836..9c27029d668b62976c34d27fbf076e2af4cd85bd 100644 (file)
@@ -650,3 +650,10 @@ CGFloat rdar7242006(CGFloat x) {
   return y.width; // no-warning
 }
 
+// PR 4988 - This test exhibits a case where a function can be referenced
+//  when not explicitly used in an "lvalue" context (as far as the analyzer is
+//  concerned). This previously triggered a crash due to an invalid assertion.
+void pr_4988(void) {
+  pr_4988; // expected-warning{{expression result unused}}
+}
+