summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2011-11-07 10:07:22 +0000
committerChandler Carruth <chandlerc@gmail.com>2011-11-07 10:07:22 +0000
commitb4ea64813e6b177b7b4e779228a6c60e88c03022 (patch)
treef64f4633a0fb65352ef45b827790ca8fc01eba6b
parent464779576943466ae532d9c17443a534837f6c28 (diff)
------------------------------------------------------------------------
r143684 | chandlerc | 2011-11-04 00:12:53 -0700 (Fri, 04 Nov 2011) | 7 lines Add a system include management interface to the toolchain, and call it and the C++ include management routine from the proper place when forming preprocessor options in the driver. This is the first step to teaching the driver to manage all of the header search paths. Currently, these methods remain just stubs in the abstract toolchain. Subsequent patches will flesh them out with implementations for various toolchains based on the current code in InitHeaderSearch.cpp. ------------------------------------------------------------------------ git-svn-id: https://llvm.org/svn/llvm-project/cfe/branches/release_30@143926 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/clang/Driver/ToolChain.h7
-rw-r--r--lib/Driver/ToolChain.cpp7
-rw-r--r--lib/Driver/Tools.cpp23
3 files changed, 26 insertions, 11 deletions
diff --git a/include/clang/Driver/ToolChain.h b/include/clang/Driver/ToolChain.h
index a5d51ca9d7..ff8f7e4a67 100644
--- a/include/clang/Driver/ToolChain.h
+++ b/include/clang/Driver/ToolChain.h
@@ -195,6 +195,13 @@ public:
/// FIXME: this really belongs on some sort of DeploymentTarget abstraction
virtual bool hasBlocksRuntime() const { return true; }
+ /// \brief Add the clang cc1 arguments for system include paths.
+ ///
+ /// This routine is responsible for adding the necessary cc1 arguments to
+ /// include headers from standard system header directories.
+ virtual void AddClangSystemIncludeArgs(const ArgList &DriverArgs,
+ ArgStringList &CC1Args) const;
+
// GetCXXStdlibType - Determine the C++ standard library type to use with the
// given compilation arguments.
virtual CXXStdlibType GetCXXStdlibType(const ArgList &Args) const;
diff --git a/lib/Driver/ToolChain.cpp b/lib/Driver/ToolChain.cpp
index d09ab16814..88c39564ee 100644
--- a/lib/Driver/ToolChain.cpp
+++ b/lib/Driver/ToolChain.cpp
@@ -211,6 +211,11 @@ std::string ToolChain::ComputeEffectiveClangTriple(const ArgList &Args,
return ComputeLLVMTriple(Args, InputType);
}
+void ToolChain::AddClangSystemIncludeArgs(const ArgList &DriverArgs,
+ ArgStringList &CC1Args) const {
+ // Each toolchain should provide the appropriate include flags.
+}
+
ToolChain::CXXStdlibType ToolChain::GetCXXStdlibType(const ArgList &Args) const{
if (Arg *A = Args.getLastArg(options::OPT_stdlib_EQ)) {
StringRef Value = A->getValue(Args);
@@ -230,7 +235,7 @@ void ToolChain::AddClangCXXStdlibIncludeArgs(const ArgList &Args,
bool ObjCXXAutoRefCount) const {
CXXStdlibType Type = GetCXXStdlibType(Args);
- // Header search paths are handled by the mass of goop in InitHeaderSearch.
+ // Header search paths are handled by each of the subclasses.
switch (Type) {
case ToolChain::CST_Libcxx:
diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp
index 4b4ff25e28..5cdc820fc3 100644
--- a/lib/Driver/Tools.cpp
+++ b/lib/Driver/Tools.cpp
@@ -364,16 +364,6 @@ void Clang::AddPreprocessingOptions(const Driver &D,
Args.AddAllArgs(CmdArgs, options::OPT_I_Group, options::OPT_F,
options::OPT_index_header_map);
- // Add C++ include arguments, if needed.
- types::ID InputType = Inputs[0].getType();
- if (types::isCXX(InputType)) {
- bool ObjCXXAutoRefCount
- = types::isObjC(InputType) && isObjCAutoRefCount(Args);
- getToolChain().AddClangCXXStdlibIncludeArgs(Args, CmdArgs,
- ObjCXXAutoRefCount);
- Args.AddAllArgs(CmdArgs, options::OPT_stdlib_EQ);
- }
-
// Add -Wp, and -Xassembler if using the preprocessor.
// FIXME: There is a very unfortunate problem here, some troubled
@@ -428,6 +418,19 @@ void Clang::AddPreprocessingOptions(const Driver &D,
// OBJCPLUS_INCLUDE_PATH - system includes enabled when compiling ObjC++.
AddIncludeDirectoryList(Args, CmdArgs, "-objcxx-isystem",
::getenv("OBJCPLUS_INCLUDE_PATH"));
+
+ // Add system include arguments.
+ getToolChain().AddClangSystemIncludeArgs(Args, CmdArgs);
+
+ // Add C++ include arguments, if needed.
+ types::ID InputType = Inputs[0].getType();
+ if (types::isCXX(InputType)) {
+ bool ObjCXXAutoRefCount
+ = types::isObjC(InputType) && isObjCAutoRefCount(Args);
+ getToolChain().AddClangCXXStdlibIncludeArgs(Args, CmdArgs,
+ ObjCXXAutoRefCount);
+ Args.AddAllArgs(CmdArgs, options::OPT_stdlib_EQ);
+ }
}
/// getARMTargetCPU - Get the (LLVM) name of the ARM cpu we are targeting.