aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2009-10-17 06:21:47 +0000
committerTed Kremenek <kremenek@apple.com>2009-10-17 06:21:47 +0000
commitdff76894ff5fa710f8f453eaf1108440815988a7 (patch)
treeeea158eb54e61d5ac40d394a911c0bb8ff09450b
parent9fa31dd71e0414e2ca905380e2f8d42710b22c82 (diff)
Resolve FIXME: delete the 'Program' object in the destructor of CIndexer.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84313 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--tools/CIndex/CIndex.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/tools/CIndex/CIndex.cpp b/tools/CIndex/CIndex.cpp
index d355025da9..8d09b527b8 100644
--- a/tools/CIndex/CIndex.cpp
+++ b/tools/CIndex/CIndex.cpp
@@ -266,7 +266,9 @@ public:
class CIndexer : public Indexer {
public:
- explicit CIndexer(Program &prog) : Indexer(prog), OnlyLocalDecls(false) { }
+ explicit CIndexer(Program *prog) : Indexer(*prog), OnlyLocalDecls(false) {}
+
+ virtual ~CIndexer() { delete &getProgram(); }
/// \brief Whether we only want to see "local" declarations (that did not
/// come from a previous precompiled header). If false, we want to see all
@@ -286,8 +288,6 @@ static const char *clangPath;
CXIndex clang_createIndex()
{
- // FIXME: Program is leaked.
-
// Find the location where this library lives (libCIndex.dylib).
// We do the lookup here to avoid poking dladdr too many times.
// This silly cast below avoids a C++ warning.
@@ -303,7 +303,7 @@ CXIndex clang_createIndex()
clangPath = ClangPath.c_str();
- return new CIndexer(*new Program());
+ return new CIndexer(new Program());
}
void clang_disposeIndex(CXIndex CIdx)