ObjCMethodSummaries[S] = Summ;
}
+ void addInstMethSummary(const char* Cls, const char* nullaryName,
+ RetainSummary *Summ) {
+ IdentifierInfo* ClsII = &Ctx.Idents.get(Cls);
+ Selector S = GetNullarySelector(nullaryName, Ctx);
+ ObjCMethodSummaries[ObjCSummaryKey(ClsII, S)] = Summ;
+ }
+
void addInstMethSummary(const char* Cls, RetainSummary* Summ, va_list argp) {
IdentifierInfo* ClsII = &Ctx.Idents.get(Cls);
addNSObjectMethSummary(GetNullarySelector("autorelease", Ctx), Summ);
// Specially handle NSAutoreleasePool.
- addInstMethSummary("NSAutoreleasePool",
+ addInstMethSummary("NSAutoreleasePool", "init",
getPersistentSummary(RetEffect::MakeReceiverAlias(),
- NewAutoreleasePool),
- "init", NULL);
+ NewAutoreleasePool));
// For NSWindow, allocated objects are (initially) self-owned.
// FIXME: For now we opt for false negatives with NSWindow, as these objects
static int AutoRBIndex = 0;
namespace { class VISIBILITY_HIDDEN AutoreleasePoolContents {}; }
-namespace { class VISIBILITY_HIDDEN AutoreleaseBindings {}; }
+namespace { class VISIBILITY_HIDDEN AutoreleaseStack {}; }
namespace clang {
-template<> struct GRStateTrait<AutoreleaseBindings>
+template<> struct GRStateTrait<AutoreleaseStack>
: public GRStatePartialTrait<ARStack> {
static inline void* GDMIndex() { return &AutoRBIndex; }
};
(*I).second.print(Out);
Out << nl;
}
+
+ // Print the autorelease stack.
+ ARStack stack = state->get<AutoreleaseStack>();
+ if (!stack.isEmpty()) {
+ Out << sep << nl << "AR pool stack:";
+
+ for (ARStack::iterator I=stack.begin(), E=stack.end(); I!=E; ++I)
+ Out << ' ' << (*I);
+
+ Out << nl;
+ }
}
static inline ArgEffect GetArgE(RetainSummary* Summ, unsigned idx) {
}
// Fall-through.
- case NewAutoreleasePool: // FIXME: Implement pushing the pool to the stack.
+ case NewAutoreleasePool:
+ assert(!isGCEnabled());
+ return state.add<AutoreleaseStack>(sym);
+
case DoNothingByRef:
case DoNothing:
if (!isGCEnabled() && V.getKind() == RefVal::Released) {