]> granicus.if.org Git - clang/commitdiff
Sink the handling of -fobjc-arc-cxxlib to live with the other -fobjc-arc
authorChandler Carruth <chandlerc@gmail.com>
Fri, 4 Nov 2011 07:34:47 +0000 (07:34 +0000)
committerChandler Carruth <chandlerc@gmail.com>
Fri, 4 Nov 2011 07:34:47 +0000 (07:34 +0000)
implementation in the driver. This cleans up the signature and semantics
of the include flag adding component of the toolchain. Another step to
ready it for holding all the InitHeaderSearch logic.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143686 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Driver/ToolChain.h
lib/Driver/ToolChain.cpp
lib/Driver/Tools.cpp

index 5d82fd927c03125b6e66b03fb86fb3b61ea4ad3a..7610c7575041a5160820e7ed7d04c3f6c3bb86eb 100644 (file)
@@ -209,8 +209,7 @@ public:
   /// AddClangCXXStdlibIncludeArgs - Add the clang -cc1 level arguments to set
   /// the include paths to use for the given C++ standard library type.
   virtual void AddClangCXXStdlibIncludeArgs(const ArgList &Args,
-                                            ArgStringList &CmdArgs,
-                                            bool ObjCXXAutoRefCount) const;
+                                            ArgStringList &CmdArgs) const;
 
   /// AddCXXStdlibLibArgs - Add the system specific linker arguments to use
   /// for the given C++ standard library type.
index 88c39564ee11ceb6cc63235bcfd27abb27a35988..11deed1588c62f8d6615b3506864f60d7e5e4da3 100644 (file)
@@ -231,23 +231,8 @@ ToolChain::CXXStdlibType ToolChain::GetCXXStdlibType(const ArgList &Args) const{
 }
 
 void ToolChain::AddClangCXXStdlibIncludeArgs(const ArgList &Args,
-                                             ArgStringList &CmdArgs,
-                                             bool ObjCXXAutoRefCount) const {
-  CXXStdlibType Type = GetCXXStdlibType(Args);
-
+                                             ArgStringList &CmdArgs) const {
   // Header search paths are handled by each of the subclasses.
-
-  switch (Type) {
-  case ToolChain::CST_Libcxx:
-    if (ObjCXXAutoRefCount)
-      CmdArgs.push_back("-fobjc-arc-cxxlib=libc++");
-    break;
-
-  case ToolChain::CST_Libstdcxx:
-    if (ObjCXXAutoRefCount)
-      CmdArgs.push_back("-fobjc-arc-cxxlib=libstdc++");
-    break;
-  }
 }
 
 void ToolChain::AddCXXStdlibLibArgs(const ArgList &Args,
index 24f88d9eb5501baaf6658df81e5dd9c47054942f..47521c41a210c50a607ca9b51dfb58a7edf59a5c 100644 (file)
@@ -427,10 +427,7 @@ void Clang::AddPreprocessingOptions(const Driver &D,
   // 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);
+    getToolChain().AddClangCXXStdlibIncludeArgs(Args, CmdArgs);
     Args.AddAllArgs(CmdArgs, options::OPT_stdlib_EQ);
   }
 }
@@ -1985,6 +1982,16 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
   if (ARC) {
     CmdArgs.push_back("-fobjc-arc");
 
+    // FIXME: It seems like this entire block, and several around it should be
+    // wrapped in isObjC, but for now we just use it here as this is where it
+    // was being used previously.
+    if (types::isCXX(InputType) && types::isObjC(InputType)) {
+      if (getToolChain().GetCXXStdlibType(Args) == ToolChain::CST_Libcxx)
+        CmdArgs.push_back("-fobjc-arc-cxxlib=libc++");
+      else
+        CmdArgs.push_back("-fobjc-arc-cxxlib=libstdc++");
+    }
+
     // Allow the user to enable full exceptions code emission.
     // We define off for Objective-CC, on for Objective-C++.
     if (Args.hasFlag(options::OPT_fobjc_arc_exceptions,