From 40e86d9be7e7a7343350af9d6cd86e7991d85eb1 Mon Sep 17 00:00:00 2001 From: Ted Kremenek Date: Thu, 18 Dec 2008 23:34:57 +0000 Subject: [PATCH] Fix regression when invalidating reference-counts for objects passed-by-reference to a function/method. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61224 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Analysis/CFRefCount.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/lib/Analysis/CFRefCount.cpp b/lib/Analysis/CFRefCount.cpp index c85d934ebb..90a54d6353 100644 --- a/lib/Analysis/CFRefCount.cpp +++ b/lib/Analysis/CFRefCount.cpp @@ -1589,14 +1589,6 @@ void CFRefCount::EvalSummary(ExplodedNodeSet& Dst, // to identify conjured symbols by an expression pair: the enclosing // expression (the context) and the expression itself. This should // disambiguate conjured symbols. - - // Is the invalidated variable something that we were tracking? - SVal X = state.GetSVal(*MR); - - if (isa(X)) { - SymbolRef Sym = cast(X).getSymbol(); - state = state.remove(Sym); - } const TypedRegion* R = dyn_cast(MR->getRegion()); @@ -1608,6 +1600,15 @@ void CFRefCount::EvalSummary(ExplodedNodeSet& Dst, } if (R) { + + // Is the invalidated variable something that we were tracking? + SVal X = state.GetSVal(Loc::MakeVal(R)); + + if (isa(X)) { + SymbolRef Sym = cast(X).getSymbol(); + state = state.remove(Sym); + } + // Set the value of the variable to be a conjured symbol. unsigned Count = Builder.getCurrentBlockCount(); QualType T = R->getRValueType(Ctx); -- 2.50.1