diff options
author | Daniel Dunbar <daniel@zuster.org> | 2009-11-11 21:44:21 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2009-11-11 21:44:21 +0000 |
commit | 5814e657c9ad9ef6049a2a4af0d2aad248a8a15c (patch) | |
tree | 94da8b15e186ca4e6859d8a0d66e738ca8bbb73f /lib/Lex/Preprocessor.cpp | |
parent | ca11f61233b2acc266f371816e48290af4e10528 (diff) |
Allow Preprocessor to take ownership of the HeaderSearch object. I think it should probably always own the header search object, but I'm not sure...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86882 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Lex/Preprocessor.cpp')
-rw-r--r-- | lib/Lex/Preprocessor.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/Lex/Preprocessor.cpp b/lib/Lex/Preprocessor.cpp index 487b9d63c1..0110e6b9a4 100644 --- a/lib/Lex/Preprocessor.cpp +++ b/lib/Lex/Preprocessor.cpp @@ -46,12 +46,14 @@ using namespace clang; Preprocessor::Preprocessor(Diagnostic &diags, const LangOptions &opts, TargetInfo &target, SourceManager &SM, HeaderSearch &Headers, - IdentifierInfoLookup* IILookup) + IdentifierInfoLookup* IILookup, + bool OwnsHeaders) : Diags(&diags), Features(opts), Target(target),FileMgr(Headers.getFileMgr()), SourceMgr(SM), HeaderInfo(Headers), Identifiers(opts, IILookup), BuiltinInfo(Target), CurPPLexer(0), CurDirLookup(0), Callbacks(0) { ScratchBuf = new ScratchBuffer(SourceMgr); CounterValue = 0; // __COUNTER__ starts at 0. + OwnsHeaderSearch = OwnsHeaders; // Clear stats. NumDirectives = NumDefined = NumUndefined = NumPragma = 0; @@ -115,6 +117,10 @@ Preprocessor::~Preprocessor() { // Delete the scratch buffer info. delete ScratchBuf; + // Delete the header search info, if we own it. + if (OwnsHeaderSearch) + delete &HeaderInfo; + delete Callbacks; } |