]> granicus.if.org Git - clang/commitdiff
[analyzer] Restore behavior change introduced by r247657.
authorDevin Coughlin <dcoughlin@apple.com>
Tue, 15 Sep 2015 03:28:27 +0000 (03:28 +0000)
committerDevin Coughlin <dcoughlin@apple.com>
Tue, 15 Sep 2015 03:28:27 +0000 (03:28 +0000)
r247657 fixed warnings about unused variables when compiling without asserts
but changed behavior. This commit restores the old behavior but still suppresses
the warnings.

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

lib/StaticAnalyzer/Core/ExprEngineObjC.cpp

index eb035acee960510c3fb7cc52fcf1a1d420eb6c08..92c5fe6b6f1a3bd6cb13a244d0fc7f1e4320cd13 100644 (file)
@@ -182,10 +182,11 @@ void ExprEngine::VisitObjCMessage(const ObjCMessageExpr *ME,
       // Receiver is definitely nil, so run ObjCMessageNil callbacks and return.
       if (nilState && !notNilState) {
         StmtNodeBuilder Bldr(Pred, Dst, *currBldrCtx);
+        bool HasTag = Pred->getLocation().getTag();
         Pred = Bldr.generateNode(ME, Pred, nilState, nullptr,
                                  ProgramPoint::PreStmtKind);
-        assert((Pred || Pred->getLocation().getTag()) &&
-               "Should have cached out already!");
+        assert((Pred || HasTag) && "Should have cached out already!");
+        (void)HasTag;
         if (!Pred)
           return;
         getCheckerManager().runCheckersForObjCMessageNil(Dst, Pred,
@@ -198,9 +199,10 @@ void ExprEngine::VisitObjCMessage(const ObjCMessageExpr *ME,
       // Generate a transition to the non-nil state, dropping any potential
       // nil flow.
       if (notNilState != State) {
+        bool HasTag = Pred->getLocation().getTag();
         Pred = Bldr.generateNode(ME, Pred, notNilState);
-        assert((Pred || Pred->getLocation().getTag()) &&
-               "Should have cached out already!");
+        assert((Pred || HasTag) && "Should have cached out already!");
+        (void)HasTag;
         if (!Pred)
           return;
       }