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 | 0c6c930f05e9f7d8f35664146145ce7c5880eb40 (patch) | |
tree | 9ba72c5245c86b11904daccb885a8fbd968e4fa0 /clang/lib/Lex/Preprocessor.cpp | |
parent | 55b781f85efc1214847b60797ec0968957ed1957 (diff) | |
download | bcm5719-llvm-0c6c930f05e9f7d8f35664146145ce7c5880eb40.tar.gz bcm5719-llvm-0c6c930f05e9f7d8f35664146145ce7c5880eb40.zip |
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...
llvm-svn: 86882
Diffstat (limited to 'clang/lib/Lex/Preprocessor.cpp')
-rw-r--r-- | clang/lib/Lex/Preprocessor.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/clang/lib/Lex/Preprocessor.cpp b/clang/lib/Lex/Preprocessor.cpp index 487b9d63c16..0110e6b9a46 100644 --- a/clang/lib/Lex/Preprocessor.cpp +++ b/clang/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; } |