Bury leaked pointers in a global array to silence a leak detector in --disable-free mode
Summary:
This is an alternative to http://llvm-reviews.chandlerc.com/D2475
suggested by Chandler.
Reviewers: chandlerc, rnk, dblaikie
CC: cfe-commits, earthdok
Differential Revision: http://llvm-reviews.chandlerc.com/D2478
llvm-svn: 198073
diff --git a/clang/lib/Frontend/FrontendAction.cpp b/clang/lib/Frontend/FrontendAction.cpp
index 49d01f9..31889f1 100644
--- a/clang/lib/Frontend/FrontendAction.cpp
+++ b/clang/lib/Frontend/FrontendAction.cpp
@@ -17,6 +17,7 @@
#include "clang/Frontend/FrontendDiagnostic.h"
#include "clang/Frontend/FrontendPluginRegistry.h"
#include "clang/Frontend/LayoutOverrideSource.h"
+#include "clang/Frontend/Utils.h"
#include "clang/Frontend/MultiplexConsumer.h"
#include "clang/Lex/HeaderSearch.h"
#include "clang/Lex/Preprocessor.h"
@@ -403,9 +404,9 @@
//
// FIXME: There is more per-file stuff we could just drop here?
if (CI.getFrontendOpts().DisableFree) {
- CI.takeASTConsumer();
+ BuryPointer(CI.takeASTConsumer());
if (!isCurrentFileAST()) {
- CI.takeSema();
+ BuryPointer(CI.takeSema());
CI.resetAndLeakASTContext();
}
} else {