[llvm-branch-commits] [cfe-branch] r143926 - in /cfe/branches/release_30: ./ include/clang/Driver/ToolChain.h lib/Driver/ToolChain.cpp lib/Driver/Tools.cpp

Chandler Carruth chandlerc at gmail.com
Mon Nov 7 02:07:22 PST 2011


Author: chandlerc
Date: Mon Nov  7 04:07:22 2011
New Revision: 143926

URL: http://llvm.org/viewvc/llvm-project?rev=143926&view=rev
Log:
------------------------------------------------------------------------
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.
------------------------------------------------------------------------

Modified:
    cfe/branches/release_30/   (props changed)
    cfe/branches/release_30/include/clang/Driver/ToolChain.h
    cfe/branches/release_30/lib/Driver/ToolChain.cpp
    cfe/branches/release_30/lib/Driver/Tools.cpp

Propchange: cfe/branches/release_30/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Nov  7 04:07:22 2011
@@ -1,3 +1,3 @@
 /cfe/branches/type-system-rewrite:134693-134817
-/cfe/trunk:142113,142133-142134,142187,142349,142474,142476,142918,143344-143345
+/cfe/trunk:142113,142133-142134,142187,142349,142474,142476,142918,143344-143345,143684
 /cfe/trunk/test/SemaTemplate:126920

Modified: cfe/branches/release_30/include/clang/Driver/ToolChain.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_30/include/clang/Driver/ToolChain.h?rev=143926&r1=143925&r2=143926&view=diff
==============================================================================
--- cfe/branches/release_30/include/clang/Driver/ToolChain.h (original)
+++ cfe/branches/release_30/include/clang/Driver/ToolChain.h Mon Nov  7 04:07:22 2011
@@ -195,6 +195,13 @@
   /// 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;

Modified: cfe/branches/release_30/lib/Driver/ToolChain.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_30/lib/Driver/ToolChain.cpp?rev=143926&r1=143925&r2=143926&view=diff
==============================================================================
--- cfe/branches/release_30/lib/Driver/ToolChain.cpp (original)
+++ cfe/branches/release_30/lib/Driver/ToolChain.cpp Mon Nov  7 04:07:22 2011
@@ -211,6 +211,11 @@
   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 @@
                                              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:

Modified: cfe/branches/release_30/lib/Driver/Tools.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_30/lib/Driver/Tools.cpp?rev=143926&r1=143925&r2=143926&view=diff
==============================================================================
--- cfe/branches/release_30/lib/Driver/Tools.cpp (original)
+++ cfe/branches/release_30/lib/Driver/Tools.cpp Mon Nov  7 04:07:22 2011
@@ -364,16 +364,6 @@
   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 @@
   // 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.





More information about the llvm-branch-commits mailing list