From 3ad86fd2effccf1b9337e8cb9a317e4353cec275 Mon Sep 17 00:00:00 2001 From: Argyrios Kyrtzidis Date: Tue, 5 Feb 2013 16:36:52 +0000 Subject: [frontend] Don't put a PCH/PTH filename into the set of includes in the preprocessor options; since only one of them is allowed in command-line, process them separately. Otherwise, if more than one is specified in the command-line, one is processed normally and the others are going to be treated and included as header files. Related to radar://13140508 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174385 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Frontend/InitPreprocessor.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'lib/Frontend/InitPreprocessor.cpp') diff --git a/lib/Frontend/InitPreprocessor.cpp b/lib/Frontend/InitPreprocessor.cpp index 3646e27a49..b74c3c0b1c 100644 --- a/lib/Frontend/InitPreprocessor.cpp +++ b/lib/Frontend/InitPreprocessor.cpp @@ -784,15 +784,16 @@ void clang::InitializePreprocessor(Preprocessor &PP, AddImplicitIncludeMacros(Builder, InitOpts.MacroIncludes[i], PP.getFileManager()); + // Process -include-pch/-include-pth directives. + if (!InitOpts.ImplicitPCHInclude.empty()) + AddImplicitIncludePCH(Builder, PP, InitOpts.ImplicitPCHInclude); + if (!InitOpts.ImplicitPTHInclude.empty()) + AddImplicitIncludePTH(Builder, PP, InitOpts.ImplicitPTHInclude); + // Process -include directives. for (unsigned i = 0, e = InitOpts.Includes.size(); i != e; ++i) { const std::string &Path = InitOpts.Includes[i]; - if (Path == InitOpts.ImplicitPTHInclude) - AddImplicitIncludePTH(Builder, PP, Path); - else if (Path == InitOpts.ImplicitPCHInclude) - AddImplicitIncludePCH(Builder, PP, Path); - else - AddImplicitInclude(Builder, Path, PP.getFileManager()); + AddImplicitInclude(Builder, Path, PP.getFileManager()); } // Exit the command line and go back to (2 is LC_LEAVE). -- cgit v1.2.3-18-g5258