aboutsummaryrefslogtreecommitdiff
path: root/lib/Driver/Tools.cpp
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2009-10-15 20:02:44 +0000
committerDaniel Dunbar <daniel@zuster.org>2009-10-15 20:02:44 +0000
commit0ebd9321ba380471010341f24c874f46f56e7581 (patch)
treefd286f29054865ab6c86322a70e5bf5b131b5fa5 /lib/Driver/Tools.cpp
parent583f33b8a9227bace1a77a15404b4c64dc619d69 (diff)
Driver: Default to using PTH for C++ precompiled header support, PCH for C++
isn't implemented yet. - <rdar://problem/7297571> Clang should use pretokenized headers for C++ PCH files git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84197 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Driver/Tools.cpp')
-rw-r--r--lib/Driver/Tools.cpp20
1 files changed, 15 insertions, 5 deletions
diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp
index 37fe980be2..2a9ff8f676 100644
--- a/lib/Driver/Tools.cpp
+++ b/lib/Driver/Tools.cpp
@@ -142,10 +142,15 @@ void Clang::AddPreprocessingOptions(const Driver &D,
continue;
if (A->getOption().matches(options::OPT_include)) {
+ // Use PCH if the user requested it, except for C++ (for now).
+ bool UsePCH = D.CCCUsePCH;
+ if (types::isCXX(Inputs[0].getType()))
+ UsePCH = false;
+
bool FoundPTH = false;
bool FoundPCH = false;
llvm::sys::Path P(A->getValue(Args));
- if (D.CCCUsePCH) {
+ if (UsePCH) {
P.appendSuffix("pch");
if (P.exists())
FoundPCH = true;
@@ -164,8 +169,8 @@ void Clang::AddPreprocessingOptions(const Driver &D,
if (!FoundPCH && !FoundPTH) {
P.appendSuffix("gch");
if (P.exists()) {
- FoundPCH = D.CCCUsePCH;
- FoundPTH = !D.CCCUsePCH;
+ FoundPCH = UsePCH;
+ FoundPTH = !UsePCH;
}
else
P.eraseSuffix();
@@ -173,7 +178,7 @@ void Clang::AddPreprocessingOptions(const Driver &D,
if (FoundPCH || FoundPTH) {
A->claim();
- if (D.CCCUsePCH)
+ if (UsePCH)
CmdArgs.push_back("-include-pch");
else
CmdArgs.push_back("-include-pth");
@@ -528,7 +533,12 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
else
CmdArgs.push_back("-E");
} else if (isa<PrecompileJobAction>(JA)) {
- if (D.CCCUsePCH)
+ // Use PCH if the user requested it, except for C++ (for now).
+ bool UsePCH = D.CCCUsePCH;
+ if (types::isCXX(Inputs[0].getType()))
+ UsePCH = false;
+
+ if (UsePCH)
CmdArgs.push_back("-emit-pch");
else
CmdArgs.push_back("-emit-pth");