diff options
author | Ted Kremenek <kremenek@apple.com> | 2009-10-17 06:21:47 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2009-10-17 06:21:47 +0000 |
commit | 05729c2835daf28a30f1649f58196031bf6ae9d8 (patch) | |
tree | 39f79a24b00cd5628335ea02077a1785199a2c37 | |
parent | 68d9d7b319368dcd422a161bc67279dee1b0eba8 (diff) | |
download | bcm5719-llvm-05729c2835daf28a30f1649f58196031bf6ae9d8.tar.gz bcm5719-llvm-05729c2835daf28a30f1649f58196031bf6ae9d8.zip |
Resolve FIXME: delete the 'Program' object in the destructor of CIndexer.
llvm-svn: 84313
-rw-r--r-- | clang/tools/CIndex/CIndex.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/clang/tools/CIndex/CIndex.cpp b/clang/tools/CIndex/CIndex.cpp index d355025da91..8d09b527b82 100644 --- a/clang/tools/CIndex/CIndex.cpp +++ b/clang/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) |