[cfe-commits] r62331 - in /cfe/trunk: lib/Analysis/CFRefCount.cpp test/Analysis/retain-release.m
Ted Kremenek
kremenek at apple.com
Fri Jan 16 10:40:33 PST 2009
Author: kremenek
Date: Fri Jan 16 12:40:33 2009
New Revision: 62331
URL: http://llvm.org/viewvc/llvm-project?rev=62331&view=rev
Log:
Fix PR 3337 [retain/release checker]: Handle FunctionDecl's declared using typedefs.
Modified:
cfe/trunk/lib/Analysis/CFRefCount.cpp
cfe/trunk/test/Analysis/retain-release.m
Modified: cfe/trunk/lib/Analysis/CFRefCount.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/CFRefCount.cpp?rev=62331&r1=62330&r2=62331&view=diff
==============================================================================
--- cfe/trunk/lib/Analysis/CFRefCount.cpp (original)
+++ cfe/trunk/lib/Analysis/CFRefCount.cpp Fri Jan 16 12:40:33 2009
@@ -737,7 +737,9 @@
break;
}
- FunctionType* FT = cast<FunctionType>(FD->getType());
+ // [PR 3337] Use 'getDesugaredType' to strip away any typedefs on the
+ // function's type.
+ FunctionType* FT = cast<FunctionType>(FD->getType()->getDesugaredType());
const char* FName = FD->getIdentifier()->getName();
// Inspect the result type.
Modified: cfe/trunk/test/Analysis/retain-release.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/retain-release.m?rev=62331&r1=62330&r2=62331&view=diff
==============================================================================
--- cfe/trunk/test/Analysis/retain-release.m (original)
+++ cfe/trunk/test/Analysis/retain-release.m Fri Jan 16 12:40:33 2009
@@ -237,3 +237,10 @@
CFRelease(s1); // expected-warning{{Incorrect decrement of the reference count}}
}
+// PR 3337: Handle functions declared using typedefs.
+typedef CFTypeRef CREATEFUN();
+CREATEFUN MyCreateFun;
+
+void f12() {
+ CFTypeRef o = MyCreateFun(); // expected-warning {{leak}}
+}
More information about the cfe-commits
mailing list