For the -dealloc checker, check the LangOptions to determine whether or not the code is compiled with GC.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53098 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/Driver/AnalysisConsumer.cpp b/Driver/AnalysisConsumer.cpp
index 1dc2fac..44d96a0 100644
--- a/Driver/AnalysisConsumer.cpp
+++ b/Driver/AnalysisConsumer.cpp
@@ -385,7 +385,9 @@
static void ActionCheckObjCDealloc(AnalysisManager& mgr) {
BugReporter BR(mgr);
- CheckObjCDealloc(cast<ObjCImplementationDecl>(mgr.getCodeDecl()), BR);
+
+ CheckObjCDealloc(cast<ObjCImplementationDecl>(mgr.getCodeDecl()),
+ mgr.getLangOptions(), BR);
}
//===----------------------------------------------------------------------===//
@@ -439,7 +441,8 @@
}
// Checks we always perform:
- C->addObjCImplementationAction(&ActionCheckObjCDealloc);
+ if (lopts.getGCMode() != LangOptions::GCOnly)
+ C->addObjCImplementationAction(&ActionCheckObjCDealloc);
return C.take();
}