summaryrefslogtreecommitdiffstats
path: root/clang/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
commit4794801e27e3066c622f2224c2affe22289c8dc1 (patch)
tree6a96a62fa5d3057938d305fadca6a6639b17de83 /clang/lib/Analysis/CFRefCount.cpp
parenta4b592a7d5892001b53f51fe936c77d340e6df38 (diff)
downloadbcm5719-llvm-4794801e27e3066c622f2224c2affe22289c8dc1.tar.gz
bcm5719-llvm-4794801e27e3066c622f2224c2affe22289c8dc1.zip
Use the FunctionDecl's result type to know exactly if it returns a reference.
llvm-svn: 91751
Diffstat (limited to 'clang/lib/Analysis/CFRefCount.cpp')
-rw-r--r--clang/lib/Analysis/CFRefCount.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/clang/lib/Analysis/CFRefCount.cpp b/clang/lib/Analysis/CFRefCount.cpp
index cc73841b78e..fb253a3c8ff 100644
--- a/clang/lib/Analysis/CFRefCount.cpp
+++ b/clang/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();
OpenPOWER on IntegriCloud