aboutsummaryrefslogtreecommitdiff
path: root/lib/Analysis/CFRefCount.cpp
diff options
context:
space:
mode:
authorZhongxing Xu <xuzhongxing@gmail.com>2009-12-19 03:17:55 +0000
committerZhongxing Xu <xuzhongxing@gmail.com>2009-12-19 03:17:55 +0000
commit910e4080986045cc2036f8d1f55398acc7fbb257 (patch)
treea782dbbb6a602e56dbe89e03259a2b247dbae1af /lib/Analysis/CFRefCount.cpp
parent7abfbdbc97ad8e7f340789f751df1e32b10118b4 (diff)
Use the FunctionDecl's result type to know exactly if it returns a reference.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91751 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/CFRefCount.cpp')
-rw-r--r--lib/Analysis/CFRefCount.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/Analysis/CFRefCount.cpp b/lib/Analysis/CFRefCount.cpp
index cc73841b78..fb253a3c8f 100644
--- a/lib/Analysis/CFRefCount.cpp
+++ b/lib/Analysis/CFRefCount.cpp
@@ -2942,6 +2942,16 @@ void CFRefCount::EvalSummary(ExplodedNodeSet& Dst,
QualType T = Ex->getType();
+ // For CallExpr, use the result type to know if it returns a reference.
+ if (const CallExpr *CE = dyn_cast<CallExpr>(Ex)) {
+ const Expr *Callee = CE->getCallee();
+ SVal L = state->getSVal(Callee);
+
+ const FunctionDecl *FD = L.getAsFunctionDecl();
+ if (FD)
+ T = FD->getResultType();
+ }
+
if (Loc::IsLocType(T) || (T->isIntegerType() && T->isScalarType())) {
unsigned Count = Builder.getCurrentBlockCount();
ValueManager &ValMgr = Eng.getValueManager();