Fix PR 3337 [retain/release checker]: Handle FunctionDecl's declared using typedefs.

llvm-svn: 62331
This commit is contained in:
Ted Kremenek 2009-01-16 18:40:33 +00:00
parent 4b79e47f94
commit 86afde337d
2 changed files with 10 additions and 1 deletions

View File

@ -737,7 +737,9 @@ RetainSummary* RetainSummaryManager::getSummary(FunctionDecl* FD) {
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.

View File

@ -237,3 +237,10 @@ void f11() {
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}}
}