]> granicus.if.org Git - clang/commitdiff
[clang][ifs] Clang Interface Stubs ToolChain plumbing.
authorPuyan Lotfi <puyan@puyan.org>
Tue, 8 Oct 2019 15:23:14 +0000 (15:23 +0000)
committerPuyan Lotfi <puyan@puyan.org>
Tue, 8 Oct 2019 15:23:14 +0000 (15:23 +0000)
Second Landing Attempt:

This patch enables end to end support for generating ELF interface stubs
directly from clang. Now the following:

clang -emit-interface-stubs -o libfoo.so a.cpp b.cpp c.cpp

will product an ELF binary with visible symbols populated. Visibility attributes
and -fvisibility can be used to control what gets populated.

* Adding ToolChain support for clang Driver IFS Merge Phase
* Implementing a default InterfaceStubs Merge clang Tool, used by ToolChain
* Adds support for the clang Driver to involve llvm-ifs on ifs files.
* Adds -emit-merged-ifs flag, to tell llvm-ifs to emit a merged ifs text file
  instead of the final object format (normally ELF)

Differential Revision: https://reviews.llvm.org/D63978

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

32 files changed:
include/clang/Driver/Action.h
include/clang/Driver/Options.td
include/clang/Driver/Phases.h
include/clang/Driver/ToolChain.h
include/clang/Driver/Types.def
lib/Driver/Action.cpp
lib/Driver/CMakeLists.txt
lib/Driver/Driver.cpp
lib/Driver/Phases.cpp
lib/Driver/ToolChain.cpp
lib/Driver/ToolChains/Clang.cpp
lib/Driver/ToolChains/InterfaceStubs.cpp [new file with mode: 0644]
lib/Driver/ToolChains/InterfaceStubs.h [new file with mode: 0644]
lib/Driver/Types.cpp
lib/Frontend/CompilerInvocation.cpp
test/InterfaceStubs/bad-format.cpp
test/InterfaceStubs/class-template-specialization.cpp
test/InterfaceStubs/conflict-type.ifs [new file with mode: 0644]
test/InterfaceStubs/driver-test.c [new file with mode: 0644]
test/InterfaceStubs/externstatic.c
test/InterfaceStubs/func.ifs [new file with mode: 0644]
test/InterfaceStubs/function-template-specialization.cpp
test/InterfaceStubs/inline.c
test/InterfaceStubs/merge-conflict-test.c [new file with mode: 0644]
test/InterfaceStubs/object-double.c [new file with mode: 0644]
test/InterfaceStubs/object-float.c [new file with mode: 0644]
test/InterfaceStubs/object.c [new file with mode: 0644]
test/InterfaceStubs/object.cpp [deleted file]
test/InterfaceStubs/object.ifs [new file with mode: 0644]
test/InterfaceStubs/template-namespace-function.cpp
test/InterfaceStubs/weak.cpp
test/lit.cfg.py

index c1ff0b1a602304a044557e6af965a411078baf7f..c6e90b2978354569a3a2d83e7fb8b1996c4dcccb 100644 (file)
@@ -65,6 +65,7 @@ public:
     BackendJobClass,
     AssembleJobClass,
     LinkJobClass,
+    IfsMergeJobClass,
     LipoJobClass,
     DsymutilJobClass,
     VerifyDebugInfoJobClass,
@@ -485,6 +486,17 @@ public:
   }
 };
 
+class IfsMergeJobAction : public JobAction {
+  void anchor() override;
+
+public:
+  IfsMergeJobAction(ActionList &Inputs, types::ID Type);
+
+  static bool classof(const Action *A) {
+    return A->getKind() == IfsMergeJobClass;
+  }
+};
+
 class LinkJobAction : public JobAction {
   void anchor() override;
 
index 8346d149dcc01f7ed5116695b4a6fec09c940b2d..ec906fa02b42e32d4b9b42125ad44b2abca7b773 100644 (file)
@@ -633,6 +633,9 @@ def emit_llvm : Flag<["-"], "emit-llvm">, Flags<[CC1Option]>, Group<Action_Group
   HelpText<"Use the LLVM representation for assembler and object files">;
 def emit_iterface_stubs : Flag<["-"], "emit-interface-stubs">, Flags<[CC1Option]>, Group<Action_Group>,
   HelpText<"Generate Inteface Stub Files.">;
+def emit_merged_ifs : Flag<["-"], "emit-merged-ifs">,
+  Flags<[CC1Option]>, Group<Action_Group>,
+  HelpText<"Generate Interface Stub Files, emit merged text not binary.">;
 def iterface_stub_version_EQ : JoinedOrSeparate<["-"], "interface-stub-version=">, Flags<[CC1Option]>;
 def exported__symbols__list : Separate<["-"], "exported_symbols_list">;
 def e : JoinedOrSeparate<["-"], "e">, Group<Link_Group>;
index 7199c657848cab36a58c3c607343dbed8acb60dd..63931c00c89017f988cb32cd1de38b01dda7ab12 100644 (file)
@@ -20,7 +20,8 @@ namespace phases {
     Compile,
     Backend,
     Assemble,
-    Link
+    Link,
+    IfsMerge,
   };
 
   enum {
index d6ed87574faac41b8e5c33ea4095d8607bf8524e..2ba16ab21a927a99ebb6be854b5e40729ab22b61 100644 (file)
@@ -136,11 +136,13 @@ private:
   mutable std::unique_ptr<Tool> Clang;
   mutable std::unique_ptr<Tool> Assemble;
   mutable std::unique_ptr<Tool> Link;
+  mutable std::unique_ptr<Tool> IfsMerge;
   mutable std::unique_ptr<Tool> OffloadBundler;
 
   Tool *getClang() const;
   Tool *getAssemble() const;
   Tool *getLink() const;
+  Tool *getIfsMerge() const;
   Tool *getClangAs() const;
   Tool *getOffloadBundler() const;
 
index a33598e7b7f024b8b14ab206bfe0873b1dcae9a8..79e8d109cd97e78459747dad893b0f41b7a5898e 100644 (file)
@@ -84,7 +84,8 @@ TYPE("lto-bc",                   LTO_BC,       INVALID,         "o",      phases
 
 // Misc.
 TYPE("ast",                      AST,          INVALID,         "ast",    phases::Compile, phases::Backend, phases::Assemble, phases::Link)
-TYPE("ifs",                      IFS,          INVALID,         "ifs",    phases::Compile, phases::Backend, phases::Assemble, phases::Link)
+TYPE("ifs",                      IFS,          INVALID,         "ifs",    phases::IfsMerge)
+TYPE("ifs-cpp",                  IFS_CPP,      INVALID,         "ifs",    phases::Compile, phases::IfsMerge)
 TYPE("pcm",                      ModuleFile,   INVALID,         "pcm",    phases::Compile, phases::Backend, phases::Assemble, phases::Link)
 TYPE("plist",                    Plist,        INVALID,         "plist",  phases::Compile, phases::Backend, phases::Assemble, phases::Link)
 TYPE("rewritten-objc",           RewrittenObjC,INVALID,         "cpp",    phases::Compile, phases::Backend, phases::Assemble, phases::Link)
index 47b03f6643b8498c66d05318f84d30b4f49f9c65..0187cf981eb560f6a8ee367827eef33cbacdc4a7 100644 (file)
@@ -31,6 +31,7 @@ const char *Action::getClassName(ActionClass AC) {
   case CompileJobClass: return "compiler";
   case BackendJobClass: return "backend";
   case AssembleJobClass: return "assembler";
+  case IfsMergeJobClass: return "interface-stub-merger";
   case LinkJobClass: return "linker";
   case LipoJobClass: return "lipo";
   case DsymutilJobClass: return "dsymutil";
@@ -357,6 +358,11 @@ void AssembleJobAction::anchor() {}
 AssembleJobAction::AssembleJobAction(Action *Input, types::ID OutputType)
     : JobAction(AssembleJobClass, Input, OutputType) {}
 
+void IfsMergeJobAction::anchor() {}
+
+IfsMergeJobAction::IfsMergeJobAction(ActionList &Inputs, types::ID Type)
+    : JobAction(IfsMergeJobClass, Inputs, Type) {}
+
 void LinkJobAction::anchor() {}
 
 LinkJobAction::LinkJobAction(ActionList &Inputs, types::ID Type)
index d90c0ff43607193997725ee3a9c13c9e562270a0..64b5d70f42b6f5dc9d75285bc69696c7b5310806 100644 (file)
@@ -66,6 +66,7 @@ add_clang_library(clangDriver
   ToolChains/WebAssembly.cpp
   ToolChains/XCore.cpp
   ToolChains/PPCLinux.cpp
+  ToolChains/InterfaceStubs.cpp
   Types.cpp
   XRayArgs.cpp
 
index 73b258331f798340c19c324869c989f5ece11907..5b72b4aeecd20a2ec6dbdead3bcd1fbc02b540d1 100644 (file)
@@ -274,11 +274,11 @@ phases::ID Driver::getFinalPhase(const DerivedArgList &DAL,
       (PhaseArg = DAL.getLastArg(options::OPT__SLASH_P))) {
     FinalPhase = phases::Preprocess;
 
-    // --precompile only runs up to precompilation.
+  // --precompile only runs up to precompilation.
   } else if ((PhaseArg = DAL.getLastArg(options::OPT__precompile))) {
     FinalPhase = phases::Precompile;
 
-    // -{fsyntax-only,-analyze,emit-ast} only run up to the compiler.
+  // -{fsyntax-only,-analyze,emit-ast} only run up to the compiler.
   } else if ((PhaseArg = DAL.getLastArg(options::OPT_fsyntax_only)) ||
              (PhaseArg = DAL.getLastArg(options::OPT_print_supported_cpus)) ||
              (PhaseArg = DAL.getLastArg(options::OPT_module_file_info)) ||
@@ -286,20 +286,23 @@ phases::ID Driver::getFinalPhase(const DerivedArgList &DAL,
              (PhaseArg = DAL.getLastArg(options::OPT_rewrite_objc)) ||
              (PhaseArg = DAL.getLastArg(options::OPT_rewrite_legacy_objc)) ||
              (PhaseArg = DAL.getLastArg(options::OPT__migrate)) ||
-             (PhaseArg = DAL.getLastArg(options::OPT_emit_iterface_stubs)) ||
              (PhaseArg = DAL.getLastArg(options::OPT__analyze)) ||
              (PhaseArg = DAL.getLastArg(options::OPT_emit_ast))) {
     FinalPhase = phases::Compile;
 
-    // -S only runs up to the backend.
+  // clang interface stubs
+  } else if ((PhaseArg = DAL.getLastArg(options::OPT_emit_iterface_stubs))) {
+    FinalPhase = phases::IfsMerge;
+
+  // -S only runs up to the backend.
   } else if ((PhaseArg = DAL.getLastArg(options::OPT_S))) {
     FinalPhase = phases::Backend;
 
-    // -c compilation only runs up to the assembler.
+  // -c compilation only runs up to the assembler.
   } else if ((PhaseArg = DAL.getLastArg(options::OPT_c))) {
     FinalPhase = phases::Assemble;
 
-    // Otherwise do everything.
+  // Otherwise do everything.
   } else
     FinalPhase = phases::Link;
 
@@ -3337,6 +3340,7 @@ void Driver::BuildActions(Compilation &C, DerivedArgList &Args,
   // Construct the actions to perform.
   HeaderModulePrecompileJobAction *HeaderModuleAction = nullptr;
   ActionList LinkerInputs;
+  ActionList MergerInputs;
 
   for (auto &I : Inputs) {
     types::ID InputType = I.first;
@@ -3374,6 +3378,17 @@ void Driver::BuildActions(Compilation &C, DerivedArgList &Args,
         break;
       }
 
+      // TODO: Consider removing this because the merged may not end up being
+      // the final Phase in the pipeline. Perhaps the merged could just merge
+      // and then pass an artifact of some sort to the Link Phase.
+      // Queue merger inputs.
+      if (Phase == phases::IfsMerge) {
+        assert(Phase == PL.back() && "merging must be final compilation step.");
+        MergerInputs.push_back(Current);
+        Current = nullptr;
+        break;
+      }
+
       // Each precompiled header file after a module file action is a module
       // header of that same module file, rather than being compiled to a
       // separate PCH.
@@ -3423,6 +3438,11 @@ void Driver::BuildActions(Compilation &C, DerivedArgList &Args,
     Actions.push_back(LA);
   }
 
+  // Add an interface stubs merge action if necessary.
+  if (!MergerInputs.empty())
+    Actions.push_back(
+        C.MakeAction<IfsMergeJobAction>(MergerInputs, types::TY_Image));
+
   // If --print-supported-cpus, -mcpu=? or -mtune=? is specified, build a custom
   // Compile phase that prints out supported cpu models and quits.
   if (Arg *A = Args.getLastArg(options::OPT_print_supported_cpus)) {
@@ -3459,6 +3479,8 @@ Action *Driver::ConstructPhaseAction(
   switch (Phase) {
   case phases::Link:
     llvm_unreachable("link action invalid here.");
+  case phases::IfsMerge:
+    llvm_unreachable("ifsmerge action invalid here.");
   case phases::Preprocess: {
     types::ID OutputTy;
     // -M and -MM specify the dependency file name by altering the output type,
@@ -3523,7 +3545,7 @@ Action *Driver::ConstructPhaseAction(
     if (Args.hasArg(options::OPT_verify_pch))
       return C.MakeAction<VerifyPCHJobAction>(Input, types::TY_Nothing);
     if (Args.hasArg(options::OPT_emit_iterface_stubs))
-      return C.MakeAction<CompileJobAction>(Input, types::TY_IFS);
+      return C.MakeAction<CompileJobAction>(Input, types::TY_IFS_CPP);
     return C.MakeAction<CompileJobAction>(Input, types::TY_LLVM_BC);
   }
   case phases::Backend: {
index 5b776c63f713a7a75c0c57d24228c0455a7004ac..01598c59bd9eb9694b3271d99f066d58539df589 100644 (file)
@@ -20,6 +20,7 @@ const char *phases::getPhaseName(ID Id) {
   case Backend: return "backend";
   case Assemble: return "assembler";
   case Link: return "linker";
+  case IfsMerge: return "ifsmerger";
   }
 
   llvm_unreachable("Invalid phase id.");
index 4379da99d07bd1db5fe3c674a622250f9f770026..db2497a10856f2499fc2a7979eed102c7ec59142 100644 (file)
@@ -10,6 +10,7 @@
 #include "InputInfo.h"
 #include "ToolChains/Arch/ARM.h"
 #include "ToolChains/Clang.h"
+#include "ToolChains/InterfaceStubs.h"
 #include "clang/Basic/ObjCRuntime.h"
 #include "clang/Basic/Sanitizers.h"
 #include "clang/Config/config.h"
@@ -279,6 +280,12 @@ Tool *ToolChain::getLink() const {
   return Link.get();
 }
 
+Tool *ToolChain::getIfsMerge() const {
+  if (!IfsMerge)
+    IfsMerge.reset(new tools::ifstool::Merger(*this));
+  return IfsMerge.get();
+}
+
 Tool *ToolChain::getOffloadBundler() const {
   if (!OffloadBundler)
     OffloadBundler.reset(new tools::OffloadBundler(*this));
@@ -290,6 +297,9 @@ Tool *ToolChain::getTool(Action::ActionClass AC) const {
   case Action::AssembleJobClass:
     return getAssemble();
 
+  case Action::IfsMergeJobClass:
+    return getIfsMerge();
+
   case Action::LinkJobClass:
     return getLink();
 
index 8628741f7dae42245fb7dcfa695c7700850c422f..26e8bc60bfa4c8f24065f08297916cfcba56ea2b 100644 (file)
@@ -3683,32 +3683,15 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
     } else if (JA.getType() == types::TY_LLVM_BC ||
                JA.getType() == types::TY_LTO_BC) {
       CmdArgs.push_back("-emit-llvm-bc");
-    } else if (JA.getType() == types::TY_IFS) {
+    } else if (JA.getType() == types::TY_IFS ||
+               JA.getType() == types::TY_IFS_CPP) {
       StringRef ArgStr =
           Args.hasArg(options::OPT_iterface_stub_version_EQ)
               ? Args.getLastArgValue(options::OPT_iterface_stub_version_EQ)
-              : "";
-      StringRef StubFormat =
-          llvm::StringSwitch<StringRef>(ArgStr)
-              .Case("experimental-ifs-v1", "experimental-ifs-v1")
-              .Default("");
-
-      if (StubFormat.empty()) {
-        std::string ErrorMessage =
-            "Invalid interface stub format: " + ArgStr.str() +
-            ((ArgStr == "experimental-yaml-elf-v1" ||
-              ArgStr == "experimental-tapi-elf-v1")
-                 ? " is deprecated."
-                 : ".");
-        D.Diag(diag::err_drv_invalid_value)
-            << "Must specify a valid interface stub format type, ie: "
-               "-interface-stub-version=experimental-ifs-v1"
-            << ErrorMessage;
-      }
-
+              : "experimental-ifs-v1";
       CmdArgs.push_back("-emit-interface-stubs");
       CmdArgs.push_back(
-          Args.MakeArgString(Twine("-interface-stub-version=") + StubFormat));
+          Args.MakeArgString(Twine("-interface-stub-version=") + ArgStr.str()));
     } else if (JA.getType() == types::TY_PP_Asm) {
       CmdArgs.push_back("-S");
     } else if (JA.getType() == types::TY_AST) {
diff --git a/lib/Driver/ToolChains/InterfaceStubs.cpp b/lib/Driver/ToolChains/InterfaceStubs.cpp
new file mode 100644 (file)
index 0000000..6677843
--- /dev/null
@@ -0,0 +1,37 @@
+//===---  InterfaceStubs.cpp - Base InterfaceStubs Implementations C++  ---===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "InterfaceStubs.h"
+#include "CommonArgs.h"
+#include "clang/Driver/Compilation.h"
+
+namespace clang {
+namespace driver {
+namespace tools {
+namespace ifstool {
+void Merger::ConstructJob(Compilation &C, const JobAction &JA,
+                          const InputInfo &Output, const InputInfoList &Inputs,
+                          const llvm::opt::ArgList &Args,
+                          const char *LinkingOutput) const {
+  std::string Merger = getToolChain().GetProgramPath(getShortName());
+  llvm::opt::ArgStringList CmdArgs;
+  CmdArgs.push_back("-action");
+  CmdArgs.push_back(Args.getLastArg(options::OPT_emit_merged_ifs)
+                        ? "write-ifs"
+                        : "write-bin");
+  CmdArgs.push_back("-o");
+  CmdArgs.push_back(Output.getFilename());
+  for (const auto &Input : Inputs)
+    CmdArgs.push_back(Input.getFilename());
+  C.addCommand(std::make_unique<Command>(JA, *this, Args.MakeArgString(Merger),
+                                         CmdArgs, Inputs));
+}
+} // namespace ifstool
+} // namespace tools
+} // namespace driver
+} // namespace clang
diff --git a/lib/Driver/ToolChains/InterfaceStubs.h b/lib/Driver/ToolChains/InterfaceStubs.h
new file mode 100644 (file)
index 0000000..4afa737
--- /dev/null
@@ -0,0 +1,36 @@
+//===---  InterfaceStubs.cpp - Base InterfaceStubs Implementations C++  ---===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_IFS_H
+#define LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_IFS_H
+
+#include "clang/Driver/Tool.h"
+#include "clang/Driver/ToolChain.h"
+
+namespace clang {
+namespace driver {
+namespace tools {
+namespace ifstool {
+class LLVM_LIBRARY_VISIBILITY Merger : public Tool {
+public:
+  Merger(const ToolChain &TC) : Tool("IFS::Merger", "llvm-ifs", TC) {}
+
+  bool hasIntegratedCPP() const override { return false; }
+  bool isLinkJob() const override { return false; }
+
+  void ConstructJob(Compilation &C, const JobAction &JA,
+                    const InputInfo &Output, const InputInfoList &Inputs,
+                    const llvm::opt::ArgList &TCArgs,
+                    const char *LinkingOutput) const override;
+};
+} // end namespace ifstool
+} // end namespace tools
+} // end namespace driver
+} // end namespace clang
+
+#endif // LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_IFS_H
index da01e1acfcaa2bff6b916c83211fc099894af346..6241fac0c85ac5c4afcc09839bd2f38ef74d5ec5 100644 (file)
@@ -269,6 +269,7 @@ types::ID types::lookupTypeForExtension(llvm::StringRef Ext) {
            .Case("lib", TY_Object)
            .Case("mii", TY_PP_ObjCXX)
            .Case("obj", TY_Object)
+           .Case("ifs", TY_IFS)
            .Case("pch", TY_PCH)
            .Case("pcm", TY_ModuleFile)
            .Case("c++m", TY_CXXModule)
@@ -319,6 +320,22 @@ void types::getCompilationPhases(const clang::driver::Driver &Driver,
     llvm::copy_if(PhaseList, std::back_inserter(P),
                   [](phases::ID Phase) { return Phase <= phases::Precompile; });
 
+  // Treat Interface Stubs like its own compilation mode.
+  else if (DAL.getLastArg(options::OPT_emit_iterface_stubs)) {
+    llvm::SmallVector<phases::ID, phases::MaxNumberOfPhases> IfsModePhaseList;
+    llvm::SmallVector<phases::ID, phases::MaxNumberOfPhases> &PL = PhaseList;
+    phases::ID LastPhase = phases::IfsMerge;
+    if (Id != types::TY_IFS) {
+      if (DAL.hasArg(options::OPT_c))
+        LastPhase = phases::Compile;
+      PL = IfsModePhaseList;
+      types::getCompilationPhases(types::TY_IFS_CPP, PL);
+    }
+    llvm::copy_if(PL, std::back_inserter(P), [&](phases::ID Phase) {
+      return Phase <= LastPhase;
+    });
+  }
+
   // -{fsyntax-only,-analyze,emit-ast} only run up to the compiler.
   else if (DAL.getLastArg(options::OPT_fsyntax_only) ||
            DAL.getLastArg(options::OPT_print_supported_cpus) ||
@@ -327,7 +344,6 @@ void types::getCompilationPhases(const clang::driver::Driver &Driver,
            DAL.getLastArg(options::OPT_rewrite_objc) ||
            DAL.getLastArg(options::OPT_rewrite_legacy_objc) ||
            DAL.getLastArg(options::OPT__migrate) ||
-           DAL.getLastArg(options::OPT_emit_iterface_stubs) ||
            DAL.getLastArg(options::OPT__analyze) ||
            DAL.getLastArg(options::OPT_emit_ast))
     llvm::copy_if(PhaseList, std::back_inserter(P),
index 61a2c07890fc5fd8b89b41cb36e4a644970d15b5..6fc8afcf3c66dbdfa2023254b6340bde577d2c99 100644 (file)
@@ -1734,24 +1734,25 @@ static InputKind ParseFrontendArgs(FrontendOptions &Opts, ArgList &Args,
       StringRef ArgStr =
           Args.hasArg(OPT_iterface_stub_version_EQ)
               ? Args.getLastArgValue(OPT_iterface_stub_version_EQ)
-              : "";
-      llvm::Optional<frontend::ActionKind> ProgramAction =
-          llvm::StringSwitch<llvm::Optional<frontend::ActionKind>>(ArgStr)
-              .Case("experimental-ifs-v1", frontend::GenerateInterfaceIfsExpV1)
-              .Default(llvm::None);
-      if (!ProgramAction) {
+              : "experimental-ifs-v1";
+      if (ArgStr == "experimental-yaml-elf-v1" ||
+          ArgStr == "experimental-tapi-elf-v1") {
         std::string ErrorMessage =
             "Invalid interface stub format: " + ArgStr.str() +
-            ((ArgStr == "experimental-yaml-elf-v1" ||
-              ArgStr == "experimental-tapi-elf-v1")
-                 ? " is deprecated."
-                 : ".");
+            " is deprecated.";
+        Diags.Report(diag::err_drv_invalid_value)
+            << "Must specify a valid interface stub format type, ie: "
+               "-interface-stub-version=experimental-ifs-v1"
+            << ErrorMessage;
+      } else if (ArgStr != "experimental-ifs-v1") {
+        std::string ErrorMessage =
+            "Invalid interface stub format: " + ArgStr.str() + ".";
         Diags.Report(diag::err_drv_invalid_value)
             << "Must specify a valid interface stub format type, ie: "
                "-interface-stub-version=experimental-ifs-v1"
             << ErrorMessage;
       } else {
-        Opts.ProgramAction = *ProgramAction;
+        Opts.ProgramAction = frontend::GenerateInterfaceIfsExpV1;
       }
       break;
     }
index f13ea2fc76b31f0cf51418c25efd98a136bcfbb6..4d51ac867eb2aab33a4f07e6ef3fff9935b71b09 100644 (file)
@@ -1,28 +1,25 @@
-// REQUIRES: x86-registered-target
-// RUN: not %clang -target x86_64-linux-gnu -o - -emit-interface-stubs \
-// RUN: -interface-stub-version=bar-format %s 2>&1 | FileCheck %s
+// RUN: not %clang -emit-interface-stubs -interface-stub-version=bad-format %s 2>&1 | \
+// RUN: FileCheck %s
 
-// RUN: not %clang -target x86_64-linux-gnu -o - -emit-interface-stubs \
-// RUN: -interface-stub-version=experimental-tapi-elf-v1 %s 2>&1 | \
+// RUN: not %clang -emit-interface-stubs -interface-stub-version=experimental-tapi-elf-v1 %s 2>&1 | \
 // RUN: FileCheck -check-prefix=CHECK-TAPI-DEPRECATED %s
 
-// RUN: not %clang -target x86_64-linux-gnu -o - -emit-interface-stubs \
-// RUN: -interface-stub-version=experimental-yaml-elf-v1 %s 2>&1 | \
+// RUN: not %clang -emit-interface-stubs -interface-stub-version=experimental-yaml-elf-v1 %s 2>&1 | \
 // RUN: FileCheck -check-prefix=CHECK-YAML-DEPRECATED %s
 
-// RUN: not %clang_cc1 -target x86_64-linux-gnu -o - -emit-interface-stubs \
-// RUN: -interface-stub-version=bar-format %s 2>&1 | FileCheck %s
+// RUN: not %clang -emit-interface-stubs -interface-stub-version=bad-format %s 2>&1 | \
+// RUN: FileCheck %s
 
-// RUN: not %clang_cc1 -target x86_64-linux-gnu -o - -emit-interface-stubs \
+// RUN: not %clang -emit-interface-stubs \
 // RUN: -interface-stub-version=experimental-tapi-elf-v1 %s 2>&1 | \
 // RUN: FileCheck -check-prefix=CHECK-TAPI-DEPRECATED %s
 
-// RUN: not %clang_cc1 -target x86_64-linux-gnu -o - -emit-interface-stubs \
+// RUN: not %clang -emit-interface-stubs \
 // RUN: -interface-stub-version=experimental-yaml-elf-v1 %s 2>&1 | \
 // RUN: FileCheck -check-prefix=CHECK-YAML-DEPRECATED %s
 
 // CHECK: error: invalid value
-// CHECK: 'Invalid interface stub format: bar-format.' in 'Must specify a
+// CHECK: 'Invalid interface stub format: bad-format.' in 'Must specify a
 // CHECK: valid interface stub format type, ie:
 // CHECK: -interface-stub-version=experimental-ifs-v1'
 
index 29e459390495ae70da702c37177a5613984d7f8c..0a68d3f1f117eef1415fa68f96e178684c8bd874 100644 (file)
@@ -1,9 +1,9 @@
 // REQUIRES: x86-registered-target
-// RUN: %clang -target x86_64-unknown-linux-gnu -o - -emit-interface-stubs \
+// RUN: %clang -target x86_64-unknown-linux-gnu -o - -emit-interface-stubs -emit-merged-ifs \
 // RUN: -interface-stub-version=experimental-ifs-v1 %s | \
 // RUN: FileCheck -check-prefix=CHECK-TAPI %s
 
-// RUN: %clang -target x86_64-unknown-linux-gnu -o - -emit-interface-stubs \
+// RUN: %clang -target x86_64-unknown-linux-gnu -o - -emit-interface-stubs -emit-merged-ifs \
 // RUN: -interface-stub-version=experimental-ifs-v1 %s | \
 // RUN: FileCheck -check-prefix=CHECK-TAPI2 %s
 // RUN: %clang -target x86_64-unknown-linux-gnu -o - -c %s | \
diff --git a/test/InterfaceStubs/conflict-type.ifs b/test/InterfaceStubs/conflict-type.ifs
new file mode 100644 (file)
index 0000000..aaa0477
--- /dev/null
@@ -0,0 +1,16 @@
+# RUN: not %clang -emit-merged-ifs -emit-interface-stubs -o - %s %S/func.ifs 2>&1 | \
+# RUN: FileCheck %s --check-prefixes=CHECK-IFS
+
+# Here we are testing to see if two symbols with identical names will fail to
+# merge in conflict due to mismatched types.
+# CHECK-IFS: error: Interface Stub: Type Mismatch for a.
+# CHECK-IFS-NEXT: Filename:
+# CHECK-IFS-NEXT: Type Values: Object Func
+
+--- !experimental-ifs-v1
+IfsVersion: 1.0
+Triple: x86_64-linux-gnu
+ObjectFileFormat: ELF
+Symbols:
+  a: { Type: Object, Size: 1 }
+...
diff --git a/test/InterfaceStubs/driver-test.c b/test/InterfaceStubs/driver-test.c
new file mode 100644 (file)
index 0000000..d4e5029
--- /dev/null
@@ -0,0 +1,11 @@
+// REQUIRES: x86-registered-target
+
+// RUN: %clang -target x86_64-unknown-linux-gnu -x c -o %t1.so -emit-interface-stubs %s %S/object.c %S/weak.cpp && \
+// RUN: llvm-nm %t1.so 2>&1 | FileCheck --check-prefix=CHECK-IFS %s
+
+// CHECK-IFS-DAG: data
+// CHECK-IFS-DAG: foo
+// CHECK-IFS-DAG: strongFunc
+// CHECK-IFS-DAG: weakFunc
+
+int foo(int bar) { return 42 + 1844; }
index bc1aef477bcd519c74d6f3d4b94d9b29e2435c1d..37d5b7db19a2df3e802ece597c90f11edcab28c4 100644 (file)
@@ -1,24 +1,20 @@
-// REQUIRES: x86-registered-target
-// RUN: %clang -DSTORAGE="extern" -target x86_64-unknown-linux-gnu -o - \
-// RUN: -emit-interface-stubs \
-// RUN: -interface-stub-version=experimental-ifs-v1 -std=c99 -xc %s | \
+// RUN: %clang -c -DSTORAGE="extern" -o - -emit-interface-stubs -std=c99 -xc %s | \
 // RUN: FileCheck -check-prefix=CHECK-EXTERN %s
-// RUN: %clang -DSTORAGE="extern" -target x86_64-linux-gnu -O0 -o - -c -std=c99 \
+
+// RUN: %clang -DSTORAGE="extern" -O0 -o - -c -std=c99 \
 // RUN: -xc %s | llvm-nm - 2>&1 | FileCheck -check-prefix=CHECK-EXTERN %s
 
-// RUN: %clang -DSTORAGE="extern" -target x86_64-unknown-linux-gnu -o - \
-// RUN: -emit-interface-stubs \
-// RUN: -interface-stub-version=experimental-ifs-v1 -std=c99 -xc %s | \
+// RUN: %clang -c -DSTORAGE="extern" -o - -emit-interface-stubs -std=c99 -xc %s | \
+// RUN: FileCheck -check-prefix=CHECK-EXTERN2 %s
+
+// RUN: %clang -DSTORAGE="extern" -O0 -o - -c -std=c99 -xc %s | llvm-nm - 2>&1 | \
 // RUN: FileCheck -check-prefix=CHECK-EXTERN2 %s
-// RUN: %clang -DSTORAGE="extern" -target x86_64-linux-gnu -O0 -o - -c -std=c99 \
-// RUN: -xc %s | llvm-nm - 2>&1 | FileCheck -check-prefix=CHECK-EXTERN2 %s
 
-// RUN: %clang -DSTORAGE="static" -target x86_64-unknown-linux-gnu -o - \
-// RUN: -emit-interface-stubs \
-// RUN: -interface-stub-version=experimental-ifs-v1 -std=c99 -xc %s | \
+// RUN: %clang -c -DSTORAGE="static" -o - -emit-interface-stubs -std=c99 -xc %s | \
+// RUN: FileCheck -check-prefix=CHECK-STATIC %s
+
+// RUN: %clang -DSTORAGE="static" -O0 -o - -c -std=c99 -xc %s | llvm-nm - 2>&1 | \
 // RUN: FileCheck -check-prefix=CHECK-STATIC %s
-// RUN: %clang -DSTORAGE="static" -target x86_64-linux-gnu -O0 -o - -c -std=c99 \
-// RUN: -xc %s | llvm-nm - 2>&1 | FileCheck -check-prefix=CHECK-STATIC %s
 
 // CHECK-EXTERN-NOT: foo
 // CHECK-STATIC-NOT: foo
diff --git a/test/InterfaceStubs/func.ifs b/test/InterfaceStubs/func.ifs
new file mode 100644 (file)
index 0000000..d115523
--- /dev/null
@@ -0,0 +1,40 @@
+# RUN: %clang -emit-interface-stubs -o - %s %S/object.ifs -emit-merged-ifs | \
+# RUN: FileCheck %s --check-prefixes=CHECK-IFS
+
+# RUN: %clang -emit-interface-stubs -o - %s %S/object.ifs | llvm-readelf --all | \
+# RUN: FileCheck %s --check-prefixes=CHECK-ELF
+
+# RUN: %clang -emit-interface-stubs -o - %s %s -emit-merged-ifs | \
+# RUN: FileCheck %s --check-prefixes=CHECK-MERGE-IFS
+
+# CHECK-IFS: --- !experimental-ifs-v1
+# CHECK-IFS-NEXT: IfsVersion:      1.0
+# CHECK-IFS-NEXT: Triple:          x86_64-linux-gnu
+# CHECK-IFS-NEXT: ObjectFileFormat: ELF
+# CHECK-IFS-NEXT: Symbols:
+# CHECK-IFS-DAG:   a:               { Type: Func }
+# CHECK-IFS-DAG:   b:               { Type: Object, Size: 4 }
+# CHECK-IFS: ...
+
+# CHECK-ELF: ELF Header:
+# CHECK-ELF:   Class:                             ELF64
+# CHECK-ELF:   Type:                              DYN (Shared object file)
+# CHECK-ELF:   FUNC    GLOBAL DEFAULT  1 a
+# CHECK-ELF:   OBJECT  GLOBAL DEFAULT  1 b
+
+# Here we are testing to see if two identical symbols will merge.
+# CHECK-MERGE-IFS: --- !experimental-ifs-v1
+# CHECK-MERGE-IFS-NEXT: IfsVersion:      1.0
+# CHECK-MERGE-IFS-NEXT: Triple:          x86_64-linux-gnu
+# CHECK-MERGE-IFS-NEXT: ObjectFileFormat: ELF
+# CHECK-MERGE-IFS-NEXT: Symbols:
+# CHECK-MERGE-IFS-NEXT:   a:               { Type: Func }
+# CHECK-MERGE-IFS-NEXT: ...
+
+--- !experimental-ifs-v1
+IfsVersion: 1.0
+Triple: x86_64-linux-gnu
+ObjectFileFormat: ELF
+Symbols:
+  a: { Type: Func }
+...
index f6e5c87e7f442510d30f05cdaf16b76fa3b02541..f6ec64bcd916fd5906ea3f9b49aee95ca14c6291 100644 (file)
@@ -1,13 +1,15 @@
 // REQUIRES: x86-registered-target
-// RUN: %clang -target x86_64-unknown-linux-gnu -o - -emit-interface-stubs \
+
+// TODO: Fix the case in llvm-ifs where it crashes on an empty Symbols list.
+// RUN: %clang -target x86_64-unknown-linux-gnu -o - -emit-interface-stubs -c \
 // RUN: -interface-stub-version=experimental-ifs-v1 %s | FileCheck %s
 
-// RUN: %clang -target x86_64-unknown-linux-gnu -o - -emit-interface-stubs \
+// RUN: %clang -target x86_64-unknown-linux-gnu -o - -emit-interface-stubs -emit-merged-ifs \
 // RUN: -interface-stub-version=experimental-ifs-v1 \
 // RUN: -DUSE_TEMPLATE_FUNCTION=1 %s | \
 // RUN: FileCheck -check-prefix=CHECK-USES-TEMPLATE-FUNCTION %s
 
-// RUN: %clang -target x86_64-unknown-linux-gnu -o - -emit-interface-stubs \
+// RUN: %clang -target x86_64-unknown-linux-gnu -o - -emit-interface-stubs -emit-merged-ifs \
 // RUN: -interface-stub-version=experimental-ifs-v1 \
 // RUN: -DSPECIALIZE_TEMPLATE_FUNCTION=1 %s | \
 // RUN: FileCheck -check-prefix=CHECK-SPECIALIZES-TEMPLATE-FUNCTION %s
index e32b4e100960dae0a1aea5d9b21a14916af9fcec..06a58c4c1bea4e9dc8ede84a0f96a9f10e27be66 100644 (file)
@@ -1,37 +1,32 @@
 // REQUIRES: x86-registered-target
-// RUN: %clang -DINLINE=inline -target x86_64-unknown-linux-gnu -o - \
-// RUN: -emit-interface-stubs \
-// RUN: -interface-stub-version=experimental-ifs-v1 -std=gnu89 -xc %s | \
+// RUN: %clang -c -DINLINE=inline -target x86_64-unknown-linux-gnu -o - \
+// RUN: -emit-interface-stubs -std=gnu89 -xc %s | \
 // RUN: FileCheck -check-prefix=CHECK-GNU %s
 // RUN: %clang -DINLINE=inline -target x86_64-linux-gnu -O0 -o - -c \
 // RUN: -std=gnu89 -xc %s | llvm-nm - | FileCheck -check-prefix=CHECK-GNU %s
 
-// RUN: %clang -DINLINE="__attribute__((always_inline))" \
-// RUN: -target x86_64-unknown-linux-gnu -o - -emit-interface-stubs \
-// RUN: -interface-stub-version=experimental-ifs-v1 -xc %s | \
+// RUN: %clang -c -DINLINE="__attribute__((always_inline))" \
+// RUN: -target x86_64-unknown-linux-gnu -o - -emit-interface-stubs -xc %s | \
 // RUN: FileCheck -check-prefix=CHECK-GNU %s
 // RUN: %clang -DINLINE="__attribute__((always_inline))" \
 // RUN: -target x86_64-linux-gnu -O0 -o - -c -xc %s | \
 // RUN: llvm-nm - | FileCheck -check-prefix=CHECK-GNU %s
 
-// RUN: %clang -DINLINE=inline -target x86_64-unknown-linux-gnu -o - \
-// RUN: -emit-interface-stubs \
-// RUN: -interface-stub-version=experimental-ifs-v1 -std=c99 -xc %s | \
+// RUN: %clang -c -DINLINE=inline -target x86_64-unknown-linux-gnu -o - \
+// RUN: -emit-interface-stubs -std=c99 -xc %s | \
 // RUN: FileCheck -check-prefix=CHECK-STD %s
 // RUN: %clang -DINLINE=inline -target x86_64-linux-gnu -O0 -o - -c -std=c99 \
 // RUN: -xc %s | llvm-nm - 2>&1 | FileCheck -check-prefix=CHECK-STD %s
 
-// RUN: %clang -DINLINE="__attribute__((noinline))" \
-// RUN: -target x86_64-unknown-linux-gnu -o - -emit-interface-stubs \
-// RUN: -interface-stub-version=experimental-ifs-v1 -std=c99 -xc %s | \
+// RUN: %clang -c -DINLINE="__attribute__((noinline))" \
+// RUN: -target x86_64-unknown-linux-gnu -o - -emit-interface-stubs -std=c99 -xc %s | \
 // RUN: FileCheck -check-prefix=CHECK-NOINLINE %s
 // RUN: %clang -DINLINE="__attribute__((noinline))" -target x86_64-linux-gnu \
 // RUN: -O0 -o - -c -std=c99 -xc %s | llvm-nm - 2>&1 | \
 // RUN: FileCheck -check-prefix=CHECK-NOINLINE %s
 
-// RUN: %clang -DINLINE="static" -target x86_64-unknown-linux-gnu -o - \
-// RUN: -emit-interface-stubs \
-// RUN: -interface-stub-version=experimental-ifs-v1 -std=c99 -xc %s | \
+// RUN: %clang -c -DINLINE="static" -target x86_64-unknown-linux-gnu -o - \
+// RUN: -emit-interface-stubs -std=c99 -xc %s | \
 // RUN: FileCheck -check-prefix=CHECK-STATIC %s
 // RUN: %clang -DINLINE="static" -target x86_64-linux-gnu -O0 -o - -c \
 // RUN: -std=c99 -xc %s | llvm-nm - 2>&1 | \
@@ -50,12 +45,12 @@ INLINE int foo() {
   return var;
 }
 
-// RUN: %clang -DINLINE=inline -target x86_64-linux-gnu -o - \
-// RUN: -emit-interface-stubs -interface-stub-version=experimental-ifs-v1 \
+// RUN: %clang -c -DINLINE=inline -target x86_64-linux-gnu -o - \
+// RUN: -emit-interface-stubs \
 // RUN: -std=gnu89 -xc %s | FileCheck -check-prefix=CHECK-TAPI %s
 
-// RUN: %clang -DINLINE=inline -target x86_64-linux-gnu -o - \
-// RUN: -emit-interface-stubs -interface-stub-version=experimental-ifs-v1 \
+// RUN: %clang -c -DINLINE=inline -target x86_64-linux-gnu -o - \
+// RUN: -emit-interface-stubs \
 // RUN: -std=gnu89 -xc %s | FileCheck -check-prefix=CHECK-SYMBOLS %s
 // RUN: %clang -DINLINE=inline -target x86_64-linux-gnu -o - \
 // RUN: -c -std=gnu89 -xc %s | llvm-nm - 2>&1 | \
diff --git a/test/InterfaceStubs/merge-conflict-test.c b/test/InterfaceStubs/merge-conflict-test.c
new file mode 100644 (file)
index 0000000..2d00614
--- /dev/null
@@ -0,0 +1,3 @@
+// RUN: not %clang -o libfoo.so -emit-interface-stubs %s %S/driver-test.c 2>&1 | FileCheck %s
+// CHECK: error: Interface Stub: Type Mismatch
+int foo;
\ No newline at end of file
diff --git a/test/InterfaceStubs/object-double.c b/test/InterfaceStubs/object-double.c
new file mode 100644 (file)
index 0000000..c6d2b61
--- /dev/null
@@ -0,0 +1,5 @@
+// RUN: not %clang -o - -emit-interface-stubs %s %S/object.c 2>&1 | FileCheck %s
+// Need to encode more type info or weak vs strong symbol resolution in llvm-ifs
+// XFAIL: *
+// CHECK: error: Interface Stub: Size Mismatch
+float data = 42.0;
\ No newline at end of file
diff --git a/test/InterfaceStubs/object-float.c b/test/InterfaceStubs/object-float.c
new file mode 100644 (file)
index 0000000..6dd056b
--- /dev/null
@@ -0,0 +1,3 @@
+// RUN: not %clang -o - -emit-interface-stubs %s %S/object.c 2>&1 | FileCheck %s
+// CHECK: error: Interface Stub: Size Mismatch
+double data = 42.0;
\ No newline at end of file
diff --git a/test/InterfaceStubs/object.c b/test/InterfaceStubs/object.c
new file mode 100644 (file)
index 0000000..b07bea9
--- /dev/null
@@ -0,0 +1,7 @@
+// RUN: %clang -c -o - -emit-interface-stubs %s | FileCheck -check-prefix=CHECK-TAPI %s
+// RUN: %clang -c -o - -emit-interface-stubs %s | FileCheck -check-prefix=CHECK-SYMBOLS %s
+// RUN: %clang -c -o - %s | llvm-nm - 2>&1 | FileCheck -check-prefix=CHECK-SYMBOLS %s
+
+// CHECK-TAPI: data: { Type: Object, Size: 4 }
+// CHECK-SYMBOLS: data
+int data = 42;
diff --git a/test/InterfaceStubs/object.cpp b/test/InterfaceStubs/object.cpp
deleted file mode 100644 (file)
index 7f11fe6..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-// REQUIRES: x86-registered-target
-// RUN: %clang -target x86_64-unknown-linux-gnu -o - -emit-interface-stubs \
-// RUN: -interface-stub-version=experimental-ifs-v1 %s | \
-// RUN: FileCheck -check-prefix=CHECK-TAPI %s
-
-// RUN: %clang -target x86_64-unknown-linux-gnu -o - -emit-interface-stubs \
-// RUN: -interface-stub-version=experimental-ifs-v1 %s | \
-// RUN: FileCheck -check-prefix=CHECK-SYMBOLS %s
-// RUN: %clang -target x86_64-unknown-linux-gnu -o - -c %s | llvm-nm - 2>&1 | \
-// RUN: FileCheck -check-prefix=CHECK-SYMBOLS %s
-
-// CHECK-TAPI: data: { Type: Object, Size: 4 }
-// CHECK-SYMBOLS: data
-int data = 42;
diff --git a/test/InterfaceStubs/object.ifs b/test/InterfaceStubs/object.ifs
new file mode 100644 (file)
index 0000000..7dc1134
--- /dev/null
@@ -0,0 +1,28 @@
+# RUN: %clang -emit-interface-stubs -o - -emit-merged-ifs %s | \
+# RUN: FileCheck %s --check-prefixes=CHECK-IFS
+
+# RUN: %clang -emit-interface-stubs -o - %s | llvm-readelf --all | \
+# RUN: FileCheck %s --check-prefixes=CHECK-ELF
+
+# CHECK-IFS: --- !experimental-ifs-v1
+# CHECK-IFS-NEXT: IfsVersion:      1.0
+# CHECK-IFS-NEXT: Triple: x86_64-linux-gnu
+# CHECK-IFS-NEXT: ObjectFileFormat: ELF
+# CHECK-IFS-NEXT: Symbols:
+# CHECK-IFS-NEXT:   b:               { Type: Object, Size: 4 }
+# CHECK-IFS-NEXT: ...
+
+# CHECK-ELF: ELF Header:
+# CHECK-ELF:   Class:                             ELF64
+# CHECK-ELF:   Data:                              2's complement, little endian
+# CHECK-ELF:   Type:                              DYN (Shared object file)
+# CHECK-ELF-NOT:   FUNC    GLOBAL DEFAULT  1 a
+# CHECK-ELF:   OBJECT  GLOBAL DEFAULT  1 b
+
+--- !experimental-ifs-v1
+IfsVersion: 1.0
+Triple: x86_64-linux-gnu
+ObjectFileFormat: ELF
+Symbols:
+  b: { Type: Object, Size: 4 }
+...
index 4956525b4060f37480d808ce1c27e5ba9d051608..ad8606757c9e47d62c095571a4f50514b0753ca3 100644 (file)
@@ -1,5 +1,5 @@
 // REQUIRES: x86-registered-target
-// RUN: %clang -target x86_64-unknown-linux-gnu -o - -emit-interface-stubs \
+// RUN: %clang -target x86_64-unknown-linux-gnu -o - -emit-interface-stubs -emit-merged-ifs \
 // RUN: -interface-stub-version=experimental-ifs-v1 %s | \
 // RUN: FileCheck %s
 
index 13b7e5aa29383b70fb13dd1217f033ec58f53457..e1c2c232a9d8f7ccdb0d021aaf15e50bf4102ac9 100644 (file)
@@ -1,5 +1,5 @@
 // REQUIRES: x86-registered-target
-// RUN: %clang -target x86_64-linux-gnu -o - -emit-interface-stubs \
+// RUN: %clang -target x86_64-linux-gnu -o - -emit-interface-stubs -emit-merged-ifs \
 // RUN: -interface-stub-version=experimental-ifs-v1 %s | \
 // RUN: FileCheck %s
 
index 9ffe30ec50d52cf1bed2f594caf2f539a4105487..1ffb6d094d72c24908e4e01a8f7effa56aa6b337 100644 (file)
@@ -26,7 +26,7 @@ config.test_format = lit.formats.ShTest(not llvm_config.use_lit_shell)
 
 # suffixes: A list of file extensions to treat as test files.
 config.suffixes = ['.c', '.cpp', '.cppm', '.m', '.mm', '.cu',
-                   '.ll', '.cl', '.s', '.S', '.modulemap', '.test', '.rs']
+                   '.ll', '.cl', '.s', '.S', '.modulemap', '.test', '.rs', '.ifs']
 
 # excludes: A list of directories to exclude from the testsuite. The 'Inputs'
 # subdirectories contain auxiliary inputs for various tests in their parent
@@ -61,7 +61,7 @@ config.substitutions.append(('%PATH%', config.environment['PATH']))
 tool_dirs = [config.clang_tools_dir, config.llvm_tools_dir]
 
 tools = [
-    'c-index-test', 'clang-diff', 'clang-format', 'clang-tblgen', 'opt',
+    'c-index-test', 'clang-diff', 'clang-format', 'clang-tblgen', 'opt', 'llvm-ifs',
     ToolSubst('%clang_extdef_map', command=FindTool(
         'clang-extdef-mapping'), unresolved='ignore'),
 ]