]> granicus.if.org Git - clang/commitdiff
[driver] Do not pass target triple to the MultilibSet include dirs callback
authorSimon Atanasyan <simon@atanasyan.com>
Thu, 19 May 2016 15:07:00 +0000 (15:07 +0000)
committerSimon Atanasyan <simon@atanasyan.com>
Thu, 19 May 2016 15:07:00 +0000 (15:07 +0000)
No one callback uses target triple so we can escape passing the unused
argument.

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

include/clang/Driver/Multilib.h
lib/Driver/ToolChains.cpp

index 20bb80dca273f2603fdef9c1ee0c6b43b277d865..bc2c061df722055a04cc2d171253d79cf10aa7c3 100644 (file)
@@ -99,9 +99,9 @@ public:
   typedef multilib_list::iterator iterator;
   typedef multilib_list::const_iterator const_iterator;
 
-  typedef std::function<std::vector<std::string>(
-      StringRef InstallDir, StringRef Triple, const Multilib &M)>
-  IncludeDirsFunc;
+  typedef std::function<std::vector<std::string>(StringRef InstallDir,
+                                                 const Multilib &M)>
+      IncludeDirsFunc;
 
   typedef llvm::function_ref<bool(const Multilib &)> FilterCallback;
 
index 3ec013c347316907aadb4af7e2d5c46ef11bd9e4..1a1c0f86cff732dd06e0e0a99b9a81649ed0b153 100644 (file)
@@ -1924,7 +1924,7 @@ static bool findMIPSMultilibs(const Driver &D, const llvm::Triple &TargetTriple,
             .FilterOut(".*sof/nan2008")
             .FilterOut(NonExistent)
             .setIncludeDirsCallback([](StringRef InstallDir,
-                                       StringRef TripleStr, const Multilib &M) {
+                                       const Multilib &M) {
               std::vector<std::string> Dirs;
               Dirs.push_back((InstallDir + "/include").str());
               std::string SysRootInc =
@@ -1954,8 +1954,8 @@ static bool findMIPSMultilibs(const Driver &D, const llvm::Triple &TargetTriple,
     MuslMipsMultilibs = MultilibSet().Either(MArchMipsR2, MArchMipselR2);
 
     // Specify the callback that computes the include directories.
-    MuslMipsMultilibs.setIncludeDirsCallback([](
-        StringRef InstallDir, StringRef TripleStr, const Multilib &M) {
+    MuslMipsMultilibs.setIncludeDirsCallback([](StringRef InstallDir,
+                                                const Multilib &M) {
       std::vector<std::string> Dirs;
       Dirs.push_back(
           (InstallDir + "/../sysroot" + M.osSuffix() + "/usr/include").str());
@@ -2007,7 +2007,7 @@ static bool findMIPSMultilibs(const Driver &D, const llvm::Triple &TargetTriple,
             .FilterOut("/micromips.*/64")
             .FilterOut(NonExistent)
             .setIncludeDirsCallback([](StringRef InstallDir,
-                                       StringRef TripleStr, const Multilib &M) {
+                                       const Multilib &M) {
               std::vector<std::string> Dirs;
               Dirs.push_back((InstallDir + "/include").str());
               std::string SysRootInc =
@@ -2060,7 +2060,7 @@ static bool findMIPSMultilibs(const Driver &D, const llvm::Triple &TargetTriple,
             .Maybe(LittleEndian)
             .FilterOut(NonExistent)
             .setIncludeDirsCallback([](StringRef InstallDir,
-                                       StringRef TripleStr, const Multilib &M) {
+                                       const Multilib &M) {
               std::vector<std::string> Dirs;
               Dirs.push_back((InstallDir + "/include").str());
               Dirs.push_back(
@@ -2540,8 +2540,7 @@ void MipsLLVMToolChain::AddClangSystemIncludeArgs(
 
   const auto &Callback = Multilibs.includeDirsCallback();
   if (Callback) {
-    const auto IncludePaths =
-        Callback(D.getInstalledDir(), getTripleString(), SelectedMultilib);
+    const auto IncludePaths = Callback(D.getInstalledDir(), SelectedMultilib);
     for (const auto &Path : IncludePaths)
       addExternCSystemIncludeIfExists(DriverArgs, CC1Args, Path);
   }
@@ -2588,8 +2587,8 @@ void MipsLLVMToolChain::AddClangCXXStdlibIncludeArgs(
 
   const auto &Callback = Multilibs.includeDirsCallback();
   if (Callback) {
-    const auto IncludePaths = Callback(getDriver().getInstalledDir(),
-                                       getTripleString(), SelectedMultilib);
+    const auto IncludePaths =
+        Callback(getDriver().getInstalledDir(), SelectedMultilib);
     for (const auto &Path : IncludePaths) {
       if (llvm::sys::fs::exists(Path + "/c++/v1")) {
         addSystemInclude(DriverArgs, CC1Args, Path + "/c++/v1");
@@ -3971,7 +3970,6 @@ void Linux::AddClangSystemIncludeArgs(const ArgList &DriverArgs,
     const auto &Callback = Multilibs.includeDirsCallback();
     if (Callback) {
       const auto IncludePaths = Callback(GCCInstallation.getInstallPath(),
-                                         GCCInstallation.getTriple().str(),
                                          GCCInstallation.getMultilib());
       for (const auto &Path : IncludePaths)
         addExternCSystemIncludeIfExists(DriverArgs, CC1Args, Path);