summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/Frontend/InitHeaderSearch.cpp5
-rw-r--r--clang/lib/Lex/Preprocessor.cpp8
2 files changed, 10 insertions, 3 deletions
diff --git a/clang/lib/Frontend/InitHeaderSearch.cpp b/clang/lib/Frontend/InitHeaderSearch.cpp
index 0e120e87acf..b4f48ac8fde 100644
--- a/clang/lib/Frontend/InitHeaderSearch.cpp
+++ b/clang/lib/Frontend/InitHeaderSearch.cpp
@@ -641,8 +641,9 @@ void InitHeaderSearch::Realize() {
}
}
-void clang::ApplyHeaderSearchOptions(const HeaderSearchOptions &HSOpts,
- HeaderSearch &HS, const LangOptions &Lang,
+void clang::ApplyHeaderSearchOptions(HeaderSearch &HS,
+ const HeaderSearchOptions &HSOpts,
+ const LangOptions &Lang,
const llvm::Triple &Triple) {
InitHeaderSearch Init(HS, HSOpts.Verbose, HSOpts.Sysroot);
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;
}
OpenPOWER on IntegriCloud