<div dir="ltr">I went ahead and reverted this change and the two follow-ups in r373556.</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Oct 2, 2019 at 10:06 PM Nico Weber <<a href="mailto:thakis@chromium.org">thakis@chromium.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">It's still failing at trunk.<div><br>Please revert, the tree's been broken for 3h by now.</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Oct 2, 2019 at 10:01 PM Puyan Lotfi <<a href="mailto:puyan@puyan.org" target="_blank">puyan@puyan.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">   <div>I committed a change to driver-test.c. Not sure if that fixes it yet. <u></u><u></u>Looks like there’s failures in some cmake and tablegen stuff. I will investigate macOS this evening. </div><div><br></div><div>PL</div><div><br></div><div id="gmail-m_7760355616973630207gmail-m_5992167339408412475protonmail_mobile_signature_block"><div>Sent from ProtonMail Mobile</div></div> <div><br></div><div><br></div>On Wed, Oct 2, 2019 at 6:50 PM, Nico Weber <<a href="mailto:thakis@chromium.org" target="_blank">thakis@chromium.org</a>> wrote:<blockquote type="cite">  <div dir="ltr">Looks like it's passing on Linux now, but still failing on macOS: <div><br></div><div>AIL: Clang :: InterfaceStubs/driver-test.c (6172 of 16012)<br>******************** TEST 'Clang :: InterfaceStubs/driver-test.c' FAILED ********************<br>Script:<br>--<br>: 'RUN: at line 3';   /Users/thakis/src/llvm-project/out/gn/bin/clang -target x86_64-unknown-linux-gnu -x c -o /Users/thakis/src/llvm-project/out/gn/obj/clang/test/InterfaceStubs/Output/<a href="http://driver-test.c.tmp1.so" target="_blank">driver-test.c.tmp1.so</a> -emit-interface-stubs /Users/thakis/src/llvm-project/clang/test/InterfaceStubs/driver-test.c /Users/thakis/src/llvm-project/clang/test/InterfaceStubs/object.c /Users/thakis/src/llvm-project/clang/test/InterfaceStubs/weak.cpp &&  llvm-nm /Users/thakis/src/llvm-project/out/gn/obj/clang/test/InterfaceStubs/Output/<a href="http://driver-test.c.tmp1.so" target="_blank">driver-test.c.tmp1.so</a> 2>&1 | /Users/thakis/src/llvm-project/out/gn/bin/FileCheck --check-prefix=CHECK-IFS /Users/thakis/src/llvm-project/clang/test/InterfaceStubs/driver-test.c<br>: 'RUN: at line 6';   /Users/thakis/src/llvm-project/out/gn/bin/clang -target x86_64-unknown-linux-gnu -x c -o /Users/thakis/src/llvm-project/out/gn/obj/clang/test/InterfaceStubs/Output/<a href="http://driver-test.c.tmp2.so" target="_blank">driver-test.c.tmp2.so</a> -shared /Users/thakis/src/llvm-project/clang/test/InterfaceStubs/driver-test.c /Users/thakis/src/llvm-project/clang/test/InterfaceStubs/object.c /Users/thakis/src/llvm-project/clang/test/InterfaceStubs/weak.cpp &&  llvm-nm /Users/thakis/src/llvm-project/out/gn/obj/clang/test/InterfaceStubs/Output/<a href="http://driver-test.c.tmp2.so" target="_blank">driver-test.c.tmp2.so</a> 2>&1 | /Users/thakis/src/llvm-project/out/gn/bin/FileCheck --check-prefix=CHECK-SO /Users/thakis/src/llvm-project/clang/test/InterfaceStubs/driver-test.c<br>--<br>Exit Code: 1<br><br>Command Output (stderr):<br>--<br>ld: unknown option: --eh-frame-hdr<br>clang: error: linker command failed with exit code 1 (use -v to see invocation)<br><br>--<br><br>********************<br>Testing: 0 .. 10.. 20.. 30.. 40.. 50.. 60.. 70.. 80.. 90.. <br>Testing Time: 162.42s<br>********************<br>Failing Tests (1):<br>    Clang :: InterfaceStubs/driver-test.c<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Oct 2, 2019 at 8:14 PM Puyan Lotfi <<a href="mailto:puyan@puyan.org" target="_blank">puyan@puyan.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div>Looking at this. Sorry for this. I think either the test needs to be restricted for the x86 target or the llvm-ifs tool is not being built with the distribution.<br></div><div>PL</div><div><br></div><div><div><br></div><div>Sent with <a href="https://protonmail.com" target="_blank">ProtonMail</a> Secure Email.<br></div></div><div><br></div><div>‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐<br></div><div> On Wednesday, October 2, 2019 7:36 PM, Nico Weber <<a href="mailto:thakis@chromium.org" target="_blank">thakis@chromium.org</a>> wrote:<br></div><div> <br></div><blockquote type="cite"><div dir="ltr"><div>Looks like this broke a bunch of tests:<br></div><div><br></div><div><a href="http://lab.llvm.org:8011/builders/clang-cuda-build/builds/37720/steps/ninja%20check%201/logs/FAIL%3A%20Clang%3A%3Aobject.cpp" target="_blank">http://lab.llvm.org:8011/builders/clang-cuda-build/builds/37720/steps/ninja%20check%201/logs/FAIL%3A%20Clang%3A%3Aobject.cpp</a><br></div><div><a href="http://lab.llvm.org:8011/builders/clang-cuda-build/builds/37720/steps/ninja%20check%201/logs/FAIL%3A%20Clang%3A%3Adriver-test.c" target="_blank">http://lab.llvm.org:8011/builders/clang-cuda-build/builds/37720/steps/ninja%20check%201/logs/FAIL%3A%20Clang%3A%3Adriver-test.c</a><br></div><div><br></div><div>If it takes a while to fix, please revert and investigate async.<br></div></div><div><br></div><div class="gmail_quote"><div dir="ltr">On Wed, Oct 2, 2019 at 6:47 PM Puyan Lotfi via cfe-commits <<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div>Author: zer0<br></div><div> Date: Wed Oct  2 15:50:07 2019<br></div><div> New Revision: 373538<br></div><div> <br></div><div> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=373538&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=373538&view=rev</a><br></div><div> Log:<br></div><div> [clang][ifs] Clang Interface Stubs ToolChain plumbing.<br></div><div> <br></div><div> This patch enables end to end support for generating ELF interface stubs<br></div><div> directly from clang. Now the following:<br></div><div> <br></div><div> clang -emit-interface-stubs -o libfoo.so a.cpp b.cpp c.cpp<br></div><div> <br></div><div> will product an ELF binary with visible symbols populated. Visibility attributes<br></div><div> and -fvisibility can be used to control what gets populated.<br></div><div> <br></div><div> * Adding ToolChain support for clang Driver IFS Merge Phase<br></div><div> * Implementing a default InterfaceStubs Merge clang Tool, used by ToolChain<br></div><div> * Adds support for the clang Driver to involve llvm-ifs on ifs files.<br></div><div> * Adds -emit-merged-ifs flag, to tell llvm-ifs to emit a merged ifs text file<br></div><div>   instead of the final object format (normally ELF)<br></div><div> <br></div><div> <br></div><div> Differential Revision: <a href="https://reviews.llvm.org/D63978" rel="noreferrer" target="_blank">https://reviews.llvm.org/D63978</a><br></div><div> <br></div><div> Added:<br></div><div>     cfe/trunk/lib/Driver/ToolChains/InterfaceStubs.cpp<br></div><div>     cfe/trunk/lib/Driver/ToolChains/InterfaceStubs.h<br></div><div>     cfe/trunk/test/InterfaceStubs/conflict-type.ifs<br></div><div>     cfe/trunk/test/InterfaceStubs/driver-test.c<br></div><div>     cfe/trunk/test/InterfaceStubs/func.ifs<br></div><div>     cfe/trunk/test/InterfaceStubs/merge-conflict-test.c<br></div><div>     cfe/trunk/test/InterfaceStubs/object-double.c<br></div><div>     cfe/trunk/test/InterfaceStubs/object-float.c<br></div><div>     cfe/trunk/test/InterfaceStubs/object.c<br></div><div>     cfe/trunk/test/InterfaceStubs/object.ifs<br></div><div> Modified:<br></div><div>     cfe/trunk/include/clang/Driver/Action.h<br></div><div>     cfe/trunk/include/clang/Driver/Options.td<br></div><div>     cfe/trunk/include/clang/Driver/Phases.h<br></div><div>     cfe/trunk/include/clang/Driver/ToolChain.h<br></div><div>     cfe/trunk/include/clang/Driver/Types.def<br></div><div>     cfe/trunk/lib/Driver/Action.cpp<br></div><div>     cfe/trunk/lib/Driver/CMakeLists.txt<br></div><div>     cfe/trunk/lib/Driver/Driver.cpp<br></div><div>     cfe/trunk/lib/Driver/Phases.cpp<br></div><div>     cfe/trunk/lib/Driver/ToolChain.cpp<br></div><div>     cfe/trunk/lib/Driver/ToolChains/Clang.cpp<br></div><div>     cfe/trunk/lib/Driver/Types.cpp<br></div><div>     cfe/trunk/lib/Frontend/CompilerInvocation.cpp<br></div><div>     cfe/trunk/test/InterfaceStubs/bad-format.cpp<br></div><div>     cfe/trunk/test/InterfaceStubs/class-template-specialization.cpp<br></div><div>     cfe/trunk/test/InterfaceStubs/externstatic.c<br></div><div>     cfe/trunk/test/InterfaceStubs/function-template-specialization.cpp<br></div><div>     cfe/trunk/test/InterfaceStubs/inline.c<br></div><div>     cfe/trunk/test/InterfaceStubs/template-namespace-function.cpp<br></div><div>     cfe/trunk/test/InterfaceStubs/weak.cpp<br></div><div>     cfe/trunk/test/<a href="http://lit.cfg.py" rel="noreferrer" target="_blank">lit.cfg.py</a><br></div><div> <br></div><div> Modified: cfe/trunk/include/clang/Driver/Action.h<br></div><div> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Action.h?rev=373538&r1=373537&r2=373538&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Action.h?rev=373538&r1=373537&r2=373538&view=diff</a><br></div><div> ==============================================================================<br></div><div> --- cfe/trunk/include/clang/Driver/Action.h (original)<br></div><div> +++ cfe/trunk/include/clang/Driver/Action.h Wed Oct  2 15:50:07 2019<br></div><div> @@ -65,6 +65,7 @@ public:<br></div><div>      BackendJobClass,<br></div><div>      AssembleJobClass,<br></div><div>      LinkJobClass,<br></div><div> +    IfsMergeJobClass,<br></div><div>      LipoJobClass,<br></div><div>      DsymutilJobClass,<br></div><div>      VerifyDebugInfoJobClass,<br></div><div> @@ -485,6 +486,17 @@ public:<br></div><div>    }<br></div><div>  };<br></div><div> <br></div><div> +class IfsMergeJobAction : public JobAction {<br></div><div> +  void anchor() override;<br></div><div> +<br></div><div> +public:<br></div><div> +  IfsMergeJobAction(ActionList &Inputs, types::ID Type);<br></div><div> +<br></div><div> +  static bool classof(const Action *A) {<br></div><div> +    return A->getKind() == IfsMergeJobClass;<br></div><div> +  }<br></div><div> +};<br></div><div> +<br></div><div>  class LinkJobAction : public JobAction {<br></div><div>    void anchor() override;<br></div><div> <br></div><div> <br></div><div> Modified: cfe/trunk/include/clang/Driver/Options.td<br></div><div> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=373538&r1=373537&r2=373538&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=373538&r1=373537&r2=373538&view=diff</a><br></div><div> ==============================================================================<br></div><div> --- cfe/trunk/include/clang/Driver/Options.td (original)<br></div><div> +++ cfe/trunk/include/clang/Driver/Options.td Wed Oct  2 15:50:07 2019<br></div><div> @@ -633,6 +633,9 @@ def emit_llvm : Flag<["-"], "emit-llvm"><br></div><div>    HelpText<"Use the LLVM representation for assembler and object files">;<br></div><div>  def emit_iterface_stubs : Flag<["-"], "emit-interface-stubs">, Flags<[CC1Option]>, Group<Action_Group>,<br></div><div>    HelpText<"Generate Inteface Stub Files.">;<br></div><div> +def emit_merged_ifs : Flag<["-"], "emit-merged-ifs">,<br></div><div> +  Flags<[CC1Option]>, Group<Action_Group>,<br></div><div> +  HelpText<"Generate Interface Stub Files, emit merged text not binary.">;<br></div><div>  def iterface_stub_version_EQ : JoinedOrSeparate<["-"], "interface-stub-version=">, Flags<[CC1Option]>;<br></div><div>  def exported__symbols__list : Separate<["-"], "exported_symbols_list">;<br></div><div>  def e : JoinedOrSeparate<["-"], "e">, Group<Link_Group>;<br></div><div> <br></div><div> Modified: cfe/trunk/include/clang/Driver/Phases.h<br></div><div> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Phases.h?rev=373538&r1=373537&r2=373538&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Phases.h?rev=373538&r1=373537&r2=373538&view=diff</a><br></div><div> ==============================================================================<br></div><div> --- cfe/trunk/include/clang/Driver/Phases.h (original)<br></div><div> +++ cfe/trunk/include/clang/Driver/Phases.h Wed Oct  2 15:50:07 2019<br></div><div> @@ -20,7 +20,8 @@ namespace phases {<br></div><div>      Compile,<br></div><div>      Backend,<br></div><div>      Assemble,<br></div><div> -    Link<br></div><div> +    Link,<br></div><div> +    IfsMerge,<br></div><div>    };<br></div><div> <br></div><div>    enum {<br></div><div> <br></div><div> Modified: cfe/trunk/include/clang/Driver/ToolChain.h<br></div><div> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/ToolChain.h?rev=373538&r1=373537&r2=373538&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/ToolChain.h?rev=373538&r1=373537&r2=373538&view=diff</a><br></div><div> ==============================================================================<br></div><div> --- cfe/trunk/include/clang/Driver/ToolChain.h (original)<br></div><div> +++ cfe/trunk/include/clang/Driver/ToolChain.h Wed Oct  2 15:50:07 2019<br></div><div> @@ -136,11 +136,13 @@ private:<br></div><div>    mutable std::unique_ptr<Tool> Clang;<br></div><div>    mutable std::unique_ptr<Tool> Assemble;<br></div><div>    mutable std::unique_ptr<Tool> Link;<br></div><div> +  mutable std::unique_ptr<Tool> IfsMerge;<br></div><div>    mutable std::unique_ptr<Tool> OffloadBundler;<br></div><div> <br></div><div>    Tool *getClang() const;<br></div><div>    Tool *getAssemble() const;<br></div><div>    Tool *getLink() const;<br></div><div> +  Tool *getIfsMerge() const;<br></div><div>    Tool *getClangAs() const;<br></div><div>    Tool *getOffloadBundler() const;<br></div><div> <br></div><div> <br></div><div> Modified: cfe/trunk/include/clang/Driver/Types.def<br></div><div> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Types.def?rev=373538&r1=373537&r2=373538&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Types.def?rev=373538&r1=373537&r2=373538&view=diff</a><br></div><div> ==============================================================================<br></div><div> --- cfe/trunk/include/clang/Driver/Types.def (original)<br></div><div> +++ cfe/trunk/include/clang/Driver/Types.def Wed Oct  2 15:50:07 2019<br></div><div> @@ -84,7 +84,8 @@ TYPE("lto-bc",                   LTO_BC,<br></div><div> <br></div><div>  // Misc.<br></div><div>  TYPE("ast",                      AST,          INVALID,         "ast",    phases::Compile, phases::Backend, phases::Assemble, phases::Link)<br></div><div> -TYPE("ifs",                      IFS,          INVALID,         "ifs",    phases::Compile, phases::Backend, phases::Assemble, phases::Link)<br></div><div> +TYPE("ifs",                      IFS,          INVALID,         "ifs",    phases::IfsMerge)<br></div><div> +TYPE("ifs-cpp",                  IFS_CPP,      INVALID,         "ifs",    phases::Compile, phases::IfsMerge)<br></div><div>  TYPE("pcm",                      ModuleFile,   INVALID,         "pcm",    phases::Compile, phases::Backend, phases::Assemble, phases::Link)<br></div><div>  TYPE("plist",                    Plist,        INVALID,         "plist",  phases::Compile, phases::Backend, phases::Assemble, phases::Link)<br></div><div>  TYPE("rewritten-objc",           RewrittenObjC,INVALID,         "cpp",    phases::Compile, phases::Backend, phases::Assemble, phases::Link)<br></div><div> <br></div><div> Modified: cfe/trunk/lib/Driver/Action.cpp<br></div><div> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Action.cpp?rev=373538&r1=373537&r2=373538&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Action.cpp?rev=373538&r1=373537&r2=373538&view=diff</a><br></div><div> ==============================================================================<br></div><div> --- cfe/trunk/lib/Driver/Action.cpp (original)<br></div><div> +++ cfe/trunk/lib/Driver/Action.cpp Wed Oct  2 15:50:07 2019<br></div><div> @@ -31,6 +31,7 @@ const char *Action::getClassName(ActionC<br></div><div>    case CompileJobClass: return "compiler";<br></div><div>    case BackendJobClass: return "backend";<br></div><div>    case AssembleJobClass: return "assembler";<br></div><div> +  case IfsMergeJobClass: return "interface-stub-merger";<br></div><div>    case LinkJobClass: return "linker";<br></div><div>    case LipoJobClass: return "lipo";<br></div><div>    case DsymutilJobClass: return "dsymutil";<br></div><div> @@ -357,6 +358,11 @@ void AssembleJobAction::anchor() {}<br></div><div>  AssembleJobAction::AssembleJobAction(Action *Input, types::ID OutputType)<br></div><div>      : JobAction(AssembleJobClass, Input, OutputType) {}<br></div><div> <br></div><div> +void IfsMergeJobAction::anchor() {}<br></div><div> +<br></div><div> +IfsMergeJobAction::IfsMergeJobAction(ActionList &Inputs, types::ID Type)<br></div><div> +    : JobAction(IfsMergeJobClass, Inputs, Type) {}<br></div><div> +<br></div><div>  void LinkJobAction::anchor() {}<br></div><div> <br></div><div>  LinkJobAction::LinkJobAction(ActionList &Inputs, types::ID Type)<br></div><div> <br></div><div> Modified: cfe/trunk/lib/Driver/CMakeLists.txt<br></div><div> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/CMakeLists.txt?rev=373538&r1=373537&r2=373538&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/CMakeLists.txt?rev=373538&r1=373537&r2=373538&view=diff</a><br></div><div> ==============================================================================<br></div><div> --- cfe/trunk/lib/Driver/CMakeLists.txt (original)<br></div><div> +++ cfe/trunk/lib/Driver/CMakeLists.txt Wed Oct  2 15:50:07 2019<br></div><div> @@ -66,6 +66,7 @@ add_clang_library(clangDriver<br></div><div>    ToolChains/WebAssembly.cpp<br></div><div>    ToolChains/XCore.cpp<br></div><div>    ToolChains/PPCLinux.cpp<br></div><div> +  ToolChains/InterfaceStubs.cpp<br></div><div>    Types.cpp<br></div><div>    XRayArgs.cpp<br></div><div> <br></div><div> <br></div><div> Modified: cfe/trunk/lib/Driver/Driver.cpp<br></div><div> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Driver.cpp?rev=373538&r1=373537&r2=373538&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Driver.cpp?rev=373538&r1=373537&r2=373538&view=diff</a><br></div><div> ==============================================================================<br></div><div> --- cfe/trunk/lib/Driver/Driver.cpp (original)<br></div><div> +++ cfe/trunk/lib/Driver/Driver.cpp Wed Oct  2 15:50:07 2019<br></div><div> @@ -274,11 +274,11 @@ phases::ID Driver::getFinalPhase(const D<br></div><div>        (PhaseArg = DAL.getLastArg(options::OPT__SLASH_P))) {<br></div><div>      FinalPhase = phases::Preprocess;<br></div><div> <br></div><div> -    // --precompile only runs up to precompilation.<br></div><div> +  // --precompile only runs up to precompilation.<br></div><div>    } else if ((PhaseArg = DAL.getLastArg(options::OPT__precompile))) {<br></div><div>      FinalPhase = phases::Precompile;<br></div><div> <br></div><div> -    // -{fsyntax-only,-analyze,emit-ast} only run up to the compiler.<br></div><div> +  // -{fsyntax-only,-analyze,emit-ast} only run up to the compiler.<br></div><div>    } else if ((PhaseArg = DAL.getLastArg(options::OPT_fsyntax_only)) ||<br></div><div>               (PhaseArg = DAL.getLastArg(options::OPT_print_supported_cpus)) ||<br></div><div>               (PhaseArg = DAL.getLastArg(options::OPT_module_file_info)) ||<br></div><div> @@ -286,20 +286,23 @@ phases::ID Driver::getFinalPhase(const D<br></div><div>               (PhaseArg = DAL.getLastArg(options::OPT_rewrite_objc)) ||<br></div><div>               (PhaseArg = DAL.getLastArg(options::OPT_rewrite_legacy_objc)) ||<br></div><div>               (PhaseArg = DAL.getLastArg(options::OPT__migrate)) ||<br></div><div> -             (PhaseArg = DAL.getLastArg(options::OPT_emit_iterface_stubs)) ||<br></div><div>               (PhaseArg = DAL.getLastArg(options::OPT__analyze)) ||<br></div><div>               (PhaseArg = DAL.getLastArg(options::OPT_emit_ast))) {<br></div><div>      FinalPhase = phases::Compile;<br></div><div> <br></div><div> -    // -S only runs up to the backend.<br></div><div> +  // clang interface stubs<br></div><div> +  } else if ((PhaseArg = DAL.getLastArg(options::OPT_emit_iterface_stubs))) {<br></div><div> +    FinalPhase = phases::IfsMerge;<br></div><div> +<br></div><div> +  // -S only runs up to the backend.<br></div><div>    } else if ((PhaseArg = DAL.getLastArg(options::OPT_S))) {<br></div><div>      FinalPhase = phases::Backend;<br></div><div> <br></div><div> -    // -c compilation only runs up to the assembler.<br></div><div> +  // -c compilation only runs up to the assembler.<br></div><div>    } else if ((PhaseArg = DAL.getLastArg(options::OPT_c))) {<br></div><div>      FinalPhase = phases::Assemble;<br></div><div> <br></div><div> -    // Otherwise do everything.<br></div><div> +  // Otherwise do everything.<br></div><div>    } else<br></div><div>      FinalPhase = phases::Link;<br></div><div> <br></div><div> @@ -3323,6 +3326,7 @@ void Driver::BuildActions(Compilation &C<br></div><div>    // Construct the actions to perform.<br></div><div>    HeaderModulePrecompileJobAction *HeaderModuleAction = nullptr;<br></div><div>    ActionList LinkerInputs;<br></div><div> +  ActionList MergerInputs;<br></div><div> <br></div><div>    for (auto &I : Inputs) {<br></div><div>      types::ID InputType = I.first;<br></div><div> @@ -3360,6 +3364,17 @@ void Driver::BuildActions(Compilation &C<br></div><div>          break;<br></div><div>        }<br></div><div> <br></div><div> +      // TODO: Consider removing this because the merged may not end up being<br></div><div> +      // the final Phase in the pipeline. Perhaps the merged could just merge<br></div><div> +      // and then pass an artifact of some sort to the Link Phase.<br></div><div> +      // Queue merger inputs.<br></div><div> +      if (Phase == phases::IfsMerge) {<br></div><div> +        assert(Phase == PL.back() && "merging must be final compilation step.");<br></div><div> +        MergerInputs.push_back(Current);<br></div><div> +        Current = nullptr;<br></div><div> +        break;<br></div><div> +      }<br></div><div> +<br></div><div>        // Each precompiled header file after a module file action is a module<br></div><div>        // header of that same module file, rather than being compiled to a<br></div><div>        // separate PCH.<br></div><div> @@ -3409,6 +3424,11 @@ void Driver::BuildActions(Compilation &C<br></div><div>      Actions.push_back(LA);<br></div><div>    }<br></div><div> <br></div><div> +  // Add an interface stubs merge action if necessary.<br></div><div> +  if (!MergerInputs.empty())<br></div><div> +    Actions.push_back(<br></div><div> +        C.MakeAction<IfsMergeJobAction>(MergerInputs, types::TY_Image));<br></div><div> +<br></div><div>    // If --print-supported-cpus, -mcpu=? or -mtune=? is specified, build a custom<br></div><div>    // Compile phase that prints out supported cpu models and quits.<br></div><div>    if (Arg *A = Args.getLastArg(options::OPT_print_supported_cpus)) {<br></div><div> @@ -3445,6 +3465,8 @@ Action *Driver::ConstructPhaseAction(<br></div><div>    switch (Phase) {<br></div><div>    case phases::Link:<br></div><div>      llvm_unreachable("link action invalid here.");<br></div><div> +  case phases::IfsMerge:<br></div><div> +    llvm_unreachable("ifsmerge action invalid here.");<br></div><div>    case phases::Preprocess: {<br></div><div>      types::ID OutputTy;<br></div><div>      // -M and -MM specify the dependency file name by altering the output type,<br></div><div> @@ -3509,7 +3531,7 @@ Action *Driver::ConstructPhaseAction(<br></div><div>      if (Args.hasArg(options::OPT_verify_pch))<br></div><div>        return C.MakeAction<VerifyPCHJobAction>(Input, types::TY_Nothing);<br></div><div>      if (Args.hasArg(options::OPT_emit_iterface_stubs))<br></div><div> -      return C.MakeAction<CompileJobAction>(Input, types::TY_IFS);<br></div><div> +      return C.MakeAction<CompileJobAction>(Input, types::TY_IFS_CPP);<br></div><div>      return C.MakeAction<CompileJobAction>(Input, types::TY_LLVM_BC);<br></div><div>    }<br></div><div>    case phases::Backend: {<br></div><div> <br></div><div> Modified: cfe/trunk/lib/Driver/Phases.cpp<br></div><div> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Phases.cpp?rev=373538&r1=373537&r2=373538&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Phases.cpp?rev=373538&r1=373537&r2=373538&view=diff</a><br></div><div> ==============================================================================<br></div><div> --- cfe/trunk/lib/Driver/Phases.cpp (original)<br></div><div> +++ cfe/trunk/lib/Driver/Phases.cpp Wed Oct  2 15:50:07 2019<br></div><div> @@ -20,6 +20,7 @@ const char *phases::getPhaseName(ID Id)<br></div><div>    case Backend: return "backend";<br></div><div>    case Assemble: return "assembler";<br></div><div>    case Link: return "linker";<br></div><div> +  case IfsMerge: return "ifsmerger";<br></div><div>    }<br></div><div> <br></div><div>    llvm_unreachable("Invalid phase id.");<br></div><div> <br></div><div> Modified: cfe/trunk/lib/Driver/ToolChain.cpp<br></div><div> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChain.cpp?rev=373538&r1=373537&r2=373538&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChain.cpp?rev=373538&r1=373537&r2=373538&view=diff</a><br></div><div> ==============================================================================<br></div><div> --- cfe/trunk/lib/Driver/ToolChain.cpp (original)<br></div><div> +++ cfe/trunk/lib/Driver/ToolChain.cpp Wed Oct  2 15:50:07 2019<br></div><div> @@ -10,6 +10,7 @@<br></div><div>  #include "InputInfo.h"<br></div><div>  #include "ToolChains/Arch/ARM.h"<br></div><div>  #include "ToolChains/Clang.h"<br></div><div> +#include "ToolChains/InterfaceStubs.h"<br></div><div>  #include "clang/Basic/ObjCRuntime.h"<br></div><div>  #include "clang/Basic/Sanitizers.h"<br></div><div>  #include "clang/Config/config.h"<br></div><div> @@ -279,6 +280,12 @@ Tool *ToolChain::getLink() const {<br></div><div>    return Link.get();<br></div><div>  }<br></div><div> <br></div><div> +Tool *ToolChain::getIfsMerge() const {<br></div><div> +  if (!IfsMerge)<br></div><div> +    IfsMerge.reset(new tools::ifstool::Merger(*this));<br></div><div> +  return IfsMerge.get();<br></div><div> +}<br></div><div> +<br></div><div>  Tool *ToolChain::getOffloadBundler() const {<br></div><div>    if (!OffloadBundler)<br></div><div>      OffloadBundler.reset(new tools::OffloadBundler(*this));<br></div><div> @@ -290,6 +297,9 @@ Tool *ToolChain::getTool(Action::ActionC<br></div><div>    case Action::AssembleJobClass:<br></div><div>      return getAssemble();<br></div><div> <br></div><div> +  case Action::IfsMergeJobClass:<br></div><div> +    return getIfsMerge();<br></div><div> +<br></div><div>    case Action::LinkJobClass:<br></div><div>      return getLink();<br></div><div> <br></div><div> <br></div><div> Modified: cfe/trunk/lib/Driver/ToolChains/Clang.cpp<br></div><div> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Clang.cpp?rev=373538&r1=373537&r2=373538&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Clang.cpp?rev=373538&r1=373537&r2=373538&view=diff</a><br></div><div> ==============================================================================<br></div><div> --- cfe/trunk/lib/Driver/ToolChains/Clang.cpp (original)<br></div><div> +++ cfe/trunk/lib/Driver/ToolChains/Clang.cpp Wed Oct  2 15:50:07 2019<br></div><div> @@ -3683,32 +3683,15 @@ void Clang::ConstructJob(Compilation &C,<br></div><div>      } else if (JA.getType() == types::TY_LLVM_BC ||<br></div><div>                 JA.getType() == types::TY_LTO_BC) {<br></div><div>        CmdArgs.push_back("-emit-llvm-bc");<br></div><div> -    } else if (JA.getType() == types::TY_IFS) {<br></div><div> +    } else if (JA.getType() == types::TY_IFS ||<br></div><div> +               JA.getType() == types::TY_IFS_CPP) {<br></div><div>        StringRef ArgStr =<br></div><div>            Args.hasArg(options::OPT_iterface_stub_version_EQ)<br></div><div>                ? Args.getLastArgValue(options::OPT_iterface_stub_version_EQ)<br></div><div> -              : "";<br></div><div> -      StringRef StubFormat =<br></div><div> -          llvm::StringSwitch<StringRef>(ArgStr)<br></div><div> -              .Case("experimental-ifs-v1", "experimental-ifs-v1")<br></div><div> -              .Default("");<br></div><div> -<br></div><div> -      if (StubFormat.empty()) {<br></div><div> -        std::string ErrorMessage =<br></div><div> -            "Invalid interface stub format: " + ArgStr.str() +<br></div><div> -            ((ArgStr == "experimental-yaml-elf-v1" ||<br></div><div> -              ArgStr == "experimental-tapi-elf-v1")<br></div><div> -                 ? " is deprecated."<br></div><div> -                 : ".");<br></div><div> -        D.Diag(diag::err_drv_invalid_value)<br></div><div> -            << "Must specify a valid interface stub format type, ie: "<br></div><div> -               "-interface-stub-version=experimental-ifs-v1"<br></div><div> -            << ErrorMessage;<br></div><div> -      }<br></div><div> -<br></div><div> +              : "experimental-ifs-v1";<br></div><div>        CmdArgs.push_back("-emit-interface-stubs");<br></div><div>        CmdArgs.push_back(<br></div><div> -          Args.MakeArgString(Twine("-interface-stub-version=") + StubFormat));<br></div><div> +          Args.MakeArgString(Twine("-interface-stub-version=") + ArgStr.str()));<br></div><div>      } else if (JA.getType() == types::TY_PP_Asm) {<br></div><div>        CmdArgs.push_back("-S");<br></div><div>      } else if (JA.getType() == types::TY_AST) {<br></div><div> <br></div><div> Added: cfe/trunk/lib/Driver/ToolChains/InterfaceStubs.cpp<br></div><div> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/InterfaceStubs.cpp?rev=373538&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/InterfaceStubs.cpp?rev=373538&view=auto</a><br></div><div> ==============================================================================<br></div><div> --- cfe/trunk/lib/Driver/ToolChains/InterfaceStubs.cpp (added)<br></div><div> +++ cfe/trunk/lib/Driver/ToolChains/InterfaceStubs.cpp Wed Oct  2 15:50:07 2019<br></div><div> @@ -0,0 +1,37 @@<br></div><div> +//===---  InterfaceStubs.cpp - Base InterfaceStubs Implementations C++  ---===//<br></div><div> +//<br></div><div> +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.<br></div><div> +// See <a href="https://llvm.org/LICENSE.txt" rel="noreferrer" target="_blank">https://llvm.org/LICENSE.txt</a> for license information.<br></div><div> +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception<br></div><div> +//<br></div><div> +//===----------------------------------------------------------------------===//<br></div><div> +<br></div><div> +#include "InterfaceStubs.h"<br></div><div> +#include "CommonArgs.h"<br></div><div> +#include "clang/Driver/Compilation.h"<br></div><div> +<br></div><div> +namespace clang {<br></div><div> +namespace driver {<br></div><div> +namespace tools {<br></div><div> +namespace ifstool {<br></div><div> +void Merger::ConstructJob(Compilation &C, const JobAction &JA,<br></div><div> +                          const InputInfo &Output, const InputInfoList &Inputs,<br></div><div> +                          const llvm::opt::ArgList &Args,<br></div><div> +                          const char *LinkingOutput) const {<br></div><div> +  std::string Merger = getToolChain().GetProgramPath(getShortName());<br></div><div> +  llvm::opt::ArgStringList CmdArgs;<br></div><div> +  CmdArgs.push_back("-action");<br></div><div> +  CmdArgs.push_back(Args.getLastArg(options::OPT_emit_merged_ifs)<br></div><div> +                        ? "write-ifs"<br></div><div> +                        : "write-bin");<br></div><div> +  CmdArgs.push_back("-o");<br></div><div> +  CmdArgs.push_back(Output.getFilename());<br></div><div> +  for (const auto &Input : Inputs)<br></div><div> +    CmdArgs.push_back(Input.getFilename());<br></div><div> +  C.addCommand(std::make_unique<Command>(JA, *this, Args.MakeArgString(Merger),<br></div><div> +                                         CmdArgs, Inputs));<br></div><div> +}<br></div><div> +} // namespace ifstool<br></div><div> +} // namespace tools<br></div><div> +} // namespace driver<br></div><div> +} // namespace clang<br></div><div> <br></div><div> Added: cfe/trunk/lib/Driver/ToolChains/InterfaceStubs.h<br></div><div> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/InterfaceStubs.h?rev=373538&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/InterfaceStubs.h?rev=373538&view=auto</a><br></div><div> ==============================================================================<br></div><div> --- cfe/trunk/lib/Driver/ToolChains/InterfaceStubs.h (added)<br></div><div> +++ cfe/trunk/lib/Driver/ToolChains/InterfaceStubs.h Wed Oct  2 15:50:07 2019<br></div><div> @@ -0,0 +1,36 @@<br></div><div> +//===---  InterfaceStubs.cpp - Base InterfaceStubs Implementations C++  ---===//<br></div><div> +//<br></div><div> +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.<br></div><div> +// See <a href="https://llvm.org/LICENSE.txt" rel="noreferrer" target="_blank">https://llvm.org/LICENSE.txt</a> for license information.<br></div><div> +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception<br></div><div> +//<br></div><div> +//===----------------------------------------------------------------------===//<br></div><div> +<br></div><div> +#ifndef LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_IFS_H<br></div><div> +#define LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_IFS_H<br></div><div> +<br></div><div> +#include "clang/Driver/Tool.h"<br></div><div> +#include "clang/Driver/ToolChain.h"<br></div><div> +<br></div><div> +namespace clang {<br></div><div> +namespace driver {<br></div><div> +namespace tools {<br></div><div> +namespace ifstool {<br></div><div> +class LLVM_LIBRARY_VISIBILITY Merger : public Tool {<br></div><div> +public:<br></div><div> +  Merger(const ToolChain &TC) : Tool("IFS::Merger", "llvm-ifs", TC) {}<br></div><div> +<br></div><div> +  bool hasIntegratedCPP() const override { return false; }<br></div><div> +  bool isLinkJob() const override { return false; }<br></div><div> +<br></div><div> +  void ConstructJob(Compilation &C, const JobAction &JA,<br></div><div> +                    const InputInfo &Output, const InputInfoList &Inputs,<br></div><div> +                    const llvm::opt::ArgList &TCArgs,<br></div><div> +                    const char *LinkingOutput) const override;<br></div><div> +};<br></div><div> +} // end namespace ifstool<br></div><div> +} // end namespace tools<br></div><div> +} // end namespace driver<br></div><div> +} // end namespace clang<br></div><div> +<br></div><div> +#endif // LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_IFS_H<br></div><div> <br></div><div> Modified: cfe/trunk/lib/Driver/Types.cpp<br></div><div> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Types.cpp?rev=373538&r1=373537&r2=373538&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Types.cpp?rev=373538&r1=373537&r2=373538&view=diff</a><br></div><div> ==============================================================================<br></div><div> --- cfe/trunk/lib/Driver/Types.cpp (original)<br></div><div> +++ cfe/trunk/lib/Driver/Types.cpp Wed Oct  2 15:50:07 2019<br></div><div> @@ -269,6 +269,7 @@ types::ID types::lookupTypeForExtension(<br></div><div>             .Case("lib", TY_Object)<br></div><div>             .Case("mii", TY_PP_ObjCXX)<br></div><div>             .Case("obj", TY_Object)<br></div><div> +           .Case("ifs", TY_IFS)<br></div><div>             .Case("pch", TY_PCH)<br></div><div>             .Case("pcm", TY_ModuleFile)<br></div><div>             .Case("c++m", TY_CXXModule)<br></div><div> @@ -319,6 +320,22 @@ void types::getCompilationPhases(const c<br></div><div>      llvm::copy_if(PhaseList, std::back_inserter(P),<br></div><div>                    [](phases::ID Phase) { return Phase <= phases::Precompile; });<br></div><div> <br></div><div> +  // Treat Interface Stubs like its own compilation mode.<br></div><div> +  else if (DAL.getLastArg(options::OPT_emit_iterface_stubs)) {<br></div><div> +    llvm::SmallVector<phases::ID, phases::MaxNumberOfPhases> IfsModePhaseList;<br></div><div> +    llvm::SmallVector<phases::ID, phases::MaxNumberOfPhases> &PL = PhaseList;<br></div><div> +    phases::ID LastPhase = phases::IfsMerge;<br></div><div> +    if (Id != types::TY_IFS) {<br></div><div> +      if (DAL.hasArg(options::OPT_c))<br></div><div> +        LastPhase = phases::Compile;<br></div><div> +      PL = IfsModePhaseList;<br></div><div> +      types::getCompilationPhases(types::TY_IFS_CPP, PL);<br></div><div> +    }<br></div><div> +    llvm::copy_if(PL, std::back_inserter(P), [&](phases::ID Phase) {<br></div><div> +      return Phase <= LastPhase;<br></div><div> +    });<br></div><div> +  }<br></div><div> +<br></div><div>    // -{fsyntax-only,-analyze,emit-ast} only run up to the compiler.<br></div><div>    else if (DAL.getLastArg(options::OPT_fsyntax_only) ||<br></div><div>             DAL.getLastArg(options::OPT_print_supported_cpus) ||<br></div><div> @@ -327,7 +344,6 @@ void types::getCompilationPhases(const c<br></div><div>             DAL.getLastArg(options::OPT_rewrite_objc) ||<br></div><div>             DAL.getLastArg(options::OPT_rewrite_legacy_objc) ||<br></div><div>             DAL.getLastArg(options::OPT__migrate) ||<br></div><div> -           DAL.getLastArg(options::OPT_emit_iterface_stubs) ||<br></div><div>             DAL.getLastArg(options::OPT__analyze) ||<br></div><div>             DAL.getLastArg(options::OPT_emit_ast))<br></div><div>      llvm::copy_if(PhaseList, std::back_inserter(P),<br></div><div> <br></div><div> Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp<br></div><div> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=373538&r1=373537&r2=373538&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=373538&r1=373537&r2=373538&view=diff</a><br></div><div> ==============================================================================<br></div><div> --- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original)<br></div><div> +++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Wed Oct  2 15:50:07 2019<br></div><div> @@ -1734,24 +1734,25 @@ static InputKind ParseFrontendArgs(Front<br></div><div>        StringRef ArgStr =<br></div><div>            Args.hasArg(OPT_iterface_stub_version_EQ)<br></div><div>                ? Args.getLastArgValue(OPT_iterface_stub_version_EQ)<br></div><div> -              : "";<br></div><div> -      llvm::Optional<frontend::ActionKind> ProgramAction =<br></div><div> -          llvm::StringSwitch<llvm::Optional<frontend::ActionKind>>(ArgStr)<br></div><div> -              .Case("experimental-ifs-v1", frontend::GenerateInterfaceIfsExpV1)<br></div><div> -              .Default(llvm::None);<br></div><div> -      if (!ProgramAction) {<br></div><div> +              : "experimental-ifs-v1";<br></div><div> +      if (ArgStr == "experimental-yaml-elf-v1" ||<br></div><div> +          ArgStr == "experimental-tapi-elf-v1") {<br></div><div>          std::string ErrorMessage =<br></div><div>              "Invalid interface stub format: " + ArgStr.str() +<br></div><div> -            ((ArgStr == "experimental-yaml-elf-v1" ||<br></div><div> -              ArgStr == "experimental-tapi-elf-v1")<br></div><div> -                 ? " is deprecated."<br></div><div> -                 : ".");<br></div><div> +            " is deprecated.";<br></div><div> +        Diags.Report(diag::err_drv_invalid_value)<br></div><div> +            << "Must specify a valid interface stub format type, ie: "<br></div><div> +               "-interface-stub-version=experimental-ifs-v1"<br></div><div> +            << ErrorMessage;<br></div><div> +      } else if (ArgStr != "experimental-ifs-v1") {<br></div><div> +        std::string ErrorMessage =<br></div><div> +            "Invalid interface stub format: " + ArgStr.str() + ".";<br></div><div>          Diags.Report(diag::err_drv_invalid_value)<br></div><div>              << "Must specify a valid interface stub format type, ie: "<br></div><div>                 "-interface-stub-version=experimental-ifs-v1"<br></div><div>              << ErrorMessage;<br></div><div>        } else {<br></div><div> -        Opts.ProgramAction = *ProgramAction;<br></div><div> +        Opts.ProgramAction = frontend::GenerateInterfaceIfsExpV1;<br></div><div>        }<br></div><div>        break;<br></div><div>      }<br></div><div> <br></div><div> Modified: cfe/trunk/test/InterfaceStubs/bad-format.cpp<br></div><div> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/InterfaceStubs/bad-format.cpp?rev=373538&r1=373537&r2=373538&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/InterfaceStubs/bad-format.cpp?rev=373538&r1=373537&r2=373538&view=diff</a><br></div><div> ==============================================================================<br></div><div> --- cfe/trunk/test/InterfaceStubs/bad-format.cpp (original)<br></div><div> +++ cfe/trunk/test/InterfaceStubs/bad-format.cpp Wed Oct  2 15:50:07 2019<br></div><div> @@ -1,28 +1,25 @@<br></div><div> -// REQUIRES: x86-registered-target<br></div><div> -// RUN: not %clang -target x86_64-linux-gnu -o - -emit-interface-stubs \<br></div><div> -// RUN: -interface-stub-version=bar-format %s 2>&1 | FileCheck %s<br></div><div> +// RUN: not %clang -emit-interface-stubs -interface-stub-version=bad-format %s 2>&1 | \<br></div><div> +// RUN: FileCheck %s<br></div><div> <br></div><div> -// RUN: not %clang -target x86_64-linux-gnu -o - -emit-interface-stubs \<br></div><div> -// RUN: -interface-stub-version=experimental-tapi-elf-v1 %s 2>&1 | \<br></div><div> +// RUN: not %clang -emit-interface-stubs -interface-stub-version=experimental-tapi-elf-v1 %s 2>&1 | \<br></div><div>  // RUN: FileCheck -check-prefix=CHECK-TAPI-DEPRECATED %s<br></div><div> <br></div><div> -// RUN: not %clang -target x86_64-linux-gnu -o - -emit-interface-stubs \<br></div><div> -// RUN: -interface-stub-version=experimental-yaml-elf-v1 %s 2>&1 | \<br></div><div> +// RUN: not %clang -emit-interface-stubs -interface-stub-version=experimental-yaml-elf-v1 %s 2>&1 | \<br></div><div>  // RUN: FileCheck -check-prefix=CHECK-YAML-DEPRECATED %s<br></div><div> <br></div><div> -// RUN: not %clang_cc1 -target x86_64-linux-gnu -o - -emit-interface-stubs \<br></div><div> -// RUN: -interface-stub-version=bar-format %s 2>&1 | FileCheck %s<br></div><div> +// RUN: not %clang -emit-interface-stubs -interface-stub-version=bad-format %s 2>&1 | \<br></div><div> +// RUN: FileCheck %s<br></div><div> <br></div><div> -// RUN: not %clang_cc1 -target x86_64-linux-gnu -o - -emit-interface-stubs \<br></div><div> +// RUN: not %clang -emit-interface-stubs \<br></div><div>  // RUN: -interface-stub-version=experimental-tapi-elf-v1 %s 2>&1 | \<br></div><div>  // RUN: FileCheck -check-prefix=CHECK-TAPI-DEPRECATED %s<br></div><div> <br></div><div> -// RUN: not %clang_cc1 -target x86_64-linux-gnu -o - -emit-interface-stubs \<br></div><div> +// RUN: not %clang -emit-interface-stubs \<br></div><div>  // RUN: -interface-stub-version=experimental-yaml-elf-v1 %s 2>&1 | \<br></div><div>  // RUN: FileCheck -check-prefix=CHECK-YAML-DEPRECATED %s<br></div><div> <br></div><div>  // CHECK: error: invalid value<br></div><div> -// CHECK: 'Invalid interface stub format: bar-format.' in 'Must specify a<br></div><div> +// CHECK: 'Invalid interface stub format: bad-format.' in 'Must specify a<br></div><div>  // CHECK: valid interface stub format type, ie:<br></div><div>  // CHECK: -interface-stub-version=experimental-ifs-v1'<br></div><div> <br></div><div> <br></div><div> Modified: cfe/trunk/test/InterfaceStubs/class-template-specialization.cpp<br></div><div> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/InterfaceStubs/class-template-specialization.cpp?rev=373538&r1=373537&r2=373538&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/InterfaceStubs/class-template-specialization.cpp?rev=373538&r1=373537&r2=373538&view=diff</a><br></div><div> ==============================================================================<br></div><div> --- cfe/trunk/test/InterfaceStubs/class-template-specialization.cpp (original)<br></div><div> +++ cfe/trunk/test/InterfaceStubs/class-template-specialization.cpp Wed Oct  2 15:50:07 2019<br></div><div> @@ -1,9 +1,9 @@<br></div><div>  // REQUIRES: x86-registered-target<br></div><div> -// RUN: %clang -target x86_64-unknown-linux-gnu -o - -emit-interface-stubs \<br></div><div> +// RUN: %clang -target x86_64-unknown-linux-gnu -o - -emit-interface-stubs -emit-merged-ifs \<br></div><div>  // RUN: -interface-stub-version=experimental-ifs-v1 %s | \<br></div><div>  // RUN: FileCheck -check-prefix=CHECK-TAPI %s<br></div><div> <br></div><div> -// RUN: %clang -target x86_64-unknown-linux-gnu -o - -emit-interface-stubs \<br></div><div> +// RUN: %clang -target x86_64-unknown-linux-gnu -o - -emit-interface-stubs -emit-merged-ifs \<br></div><div>  // RUN: -interface-stub-version=experimental-ifs-v1 %s | \<br></div><div>  // RUN: FileCheck -check-prefix=CHECK-TAPI2 %s<br></div><div>  // RUN: %clang -target x86_64-unknown-linux-gnu -o - -c %s | \<br></div><div> <br></div><div> Added: cfe/trunk/test/InterfaceStubs/conflict-type.ifs<br></div><div> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/InterfaceStubs/conflict-type.ifs?rev=373538&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/InterfaceStubs/conflict-type.ifs?rev=373538&view=auto</a><br></div><div> ==============================================================================<br></div><div> --- cfe/trunk/test/InterfaceStubs/conflict-type.ifs (added)<br></div><div> +++ cfe/trunk/test/InterfaceStubs/conflict-type.ifs Wed Oct  2 15:50:07 2019<br></div><div> @@ -0,0 +1,16 @@<br></div><div> +# RUN: not %clang -emit-merged-ifs -emit-interface-stubs -o - %s %S/func.ifs 2>&1 | \<br></div><div> +# RUN: FileCheck %s --check-prefixes=CHECK-IFS<br></div><div> +<br></div><div> +# Here we are testing to see if two symbols with identical names will fail to<br></div><div> +# merge in conflict due to mismatched types.<br></div><div> +# CHECK-IFS: error: Interface Stub: Type Mismatch for a.<br></div><div> +# CHECK-IFS-NEXT: Filename:<br></div><div> +# CHECK-IFS-NEXT: Type Values: Object Func<br></div><div> +<br></div><div> +--- !experimental-ifs-v1<br></div><div> +IfsVersion: 1.0<br></div><div> +Triple: x86_64-linux-gnu<br></div><div> +ObjectFileFormat: ELF<br></div><div> +Symbols:<br></div><div> +  a: { Type: Object, Size: 1 }<br></div><div> +...<br></div><div> <br></div><div> Added: cfe/trunk/test/InterfaceStubs/driver-test.c<br></div><div> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/InterfaceStubs/driver-test.c?rev=373538&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/InterfaceStubs/driver-test.c?rev=373538&view=auto</a><br></div><div> ==============================================================================<br></div><div> --- cfe/trunk/test/InterfaceStubs/driver-test.c (added)<br></div><div> +++ cfe/trunk/test/InterfaceStubs/driver-test.c Wed Oct  2 15:50:07 2019<br></div><div> @@ -0,0 +1,12 @@<br></div><div> +// RUN: %clang -x c -o libfoo.so -emit-interface-stubs %s %S/object.c %S/weak.cpp && \<br></div><div> +// RUN: llvm-nm libfoo.so 2>&1 | FileCheck %s<br></div><div> +<br></div><div> +// RUN: %clang -x c -o libfoo.so -shared %s %S/object.c %S/weak.cpp && \<br></div><div> +// RUN: llvm-nm libfoo.so 2>&1 | FileCheck %s<br></div><div> +<br></div><div> +// CHECK-DAG: data<br></div><div> +// CHECK-DAG: foo<br></div><div> +// CHECK-DAG: strongFunc<br></div><div> +// CHECK-DAG: weakFunc<br></div><div> +<br></div><div> +int foo(int bar) { return 42 + 1844; }<br></div><div> \ No newline at end of file<br></div><div> <br></div><div> Modified: cfe/trunk/test/InterfaceStubs/externstatic.c<br></div><div> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/InterfaceStubs/externstatic.c?rev=373538&r1=373537&r2=373538&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/InterfaceStubs/externstatic.c?rev=373538&r1=373537&r2=373538&view=diff</a><br></div><div> ==============================================================================<br></div><div> --- cfe/trunk/test/InterfaceStubs/externstatic.c (original)<br></div><div> +++ cfe/trunk/test/InterfaceStubs/externstatic.c Wed Oct  2 15:50:07 2019<br></div><div> @@ -1,24 +1,20 @@<br></div><div> -// REQUIRES: x86-registered-target<br></div><div> -// RUN: %clang -DSTORAGE="extern" -target x86_64-unknown-linux-gnu -o - \<br></div><div> -// RUN: -emit-interface-stubs \<br></div><div> -// RUN: -interface-stub-version=experimental-ifs-v1 -std=c99 -xc %s | \<br></div><div> +// RUN: %clang -c -DSTORAGE="extern" -o - -emit-interface-stubs -std=c99 -xc %s | \<br></div><div>  // RUN: FileCheck -check-prefix=CHECK-EXTERN %s<br></div><div> -// RUN: %clang -DSTORAGE="extern" -target x86_64-linux-gnu -O0 -o - -c -std=c99 \<br></div><div> +<br></div><div> +// RUN: %clang -DSTORAGE="extern" -O0 -o - -c -std=c99 \<br></div><div>  // RUN: -xc %s | llvm-nm - 2>&1 | FileCheck -check-prefix=CHECK-EXTERN %s<br></div><div> <br></div><div> -// RUN: %clang -DSTORAGE="extern" -target x86_64-unknown-linux-gnu -o - \<br></div><div> -// RUN: -emit-interface-stubs \<br></div><div> -// RUN: -interface-stub-version=experimental-ifs-v1 -std=c99 -xc %s | \<br></div><div> +// RUN: %clang -c -DSTORAGE="extern" -o - -emit-interface-stubs -std=c99 -xc %s | \<br></div><div> +// RUN: FileCheck -check-prefix=CHECK-EXTERN2 %s<br></div><div> +<br></div><div> +// RUN: %clang -DSTORAGE="extern" -O0 -o - -c -std=c99 -xc %s | llvm-nm - 2>&1 | \<br></div><div>  // RUN: FileCheck -check-prefix=CHECK-EXTERN2 %s<br></div><div> -// RUN: %clang -DSTORAGE="extern" -target x86_64-linux-gnu -O0 -o - -c -std=c99 \<br></div><div> -// RUN: -xc %s | llvm-nm - 2>&1 | FileCheck -check-prefix=CHECK-EXTERN2 %s<br></div><div> <br></div><div> -// RUN: %clang -DSTORAGE="static" -target x86_64-unknown-linux-gnu -o - \<br></div><div> -// RUN: -emit-interface-stubs \<br></div><div> -// RUN: -interface-stub-version=experimental-ifs-v1 -std=c99 -xc %s | \<br></div><div> +// RUN: %clang -c -DSTORAGE="static" -o - -emit-interface-stubs -std=c99 -xc %s | \<br></div><div> +// RUN: FileCheck -check-prefix=CHECK-STATIC %s<br></div><div> +<br></div><div> +// RUN: %clang -DSTORAGE="static" -O0 -o - -c -std=c99 -xc %s | llvm-nm - 2>&1 | \<br></div><div>  // RUN: FileCheck -check-prefix=CHECK-STATIC %s<br></div><div> -// RUN: %clang -DSTORAGE="static" -target x86_64-linux-gnu -O0 -o - -c -std=c99 \<br></div><div> -// RUN: -xc %s | llvm-nm - 2>&1 | FileCheck -check-prefix=CHECK-STATIC %s<br></div><div> <br></div><div>  // CHECK-EXTERN-NOT: foo<br></div><div>  // CHECK-STATIC-NOT: foo<br></div><div> <br></div><div> Added: cfe/trunk/test/InterfaceStubs/func.ifs<br></div><div> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/InterfaceStubs/func.ifs?rev=373538&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/InterfaceStubs/func.ifs?rev=373538&view=auto</a><br></div><div> ==============================================================================<br></div><div> --- cfe/trunk/test/InterfaceStubs/func.ifs (added)<br></div><div> +++ cfe/trunk/test/InterfaceStubs/func.ifs Wed Oct  2 15:50:07 2019<br></div><div> @@ -0,0 +1,40 @@<br></div><div> +# RUN: %clang -emit-interface-stubs -o - %s %S/object.ifs -emit-merged-ifs | \<br></div><div> +# RUN: FileCheck %s --check-prefixes=CHECK-IFS<br></div><div> +<br></div><div> +# RUN: %clang -emit-interface-stubs -o - %s %S/object.ifs | llvm-readelf --all | \<br></div><div> +# RUN: FileCheck %s --check-prefixes=CHECK-ELF<br></div><div> +<br></div><div> +# RUN: %clang -emit-interface-stubs -o - %s %s -emit-merged-ifs | \<br></div><div> +# RUN: FileCheck %s --check-prefixes=CHECK-MERGE-IFS<br></div><div> +<br></div><div> +# CHECK-IFS: --- !experimental-ifs-v1<br></div><div> +# CHECK-IFS-NEXT: IfsVersion:      1.0<br></div><div> +# CHECK-IFS-NEXT: Triple:          x86_64-linux-gnu<br></div><div> +# CHECK-IFS-NEXT: ObjectFileFormat: ELF<br></div><div> +# CHECK-IFS-NEXT: Symbols:<br></div><div> +# CHECK-IFS-DAG:   a:               { Type: Func }<br></div><div> +# CHECK-IFS-DAG:   b:               { Type: Object, Size: 4 }<br></div><div> +# CHECK-IFS: ...<br></div><div> +<br></div><div> +# CHECK-ELF: ELF Header:<br></div><div> +# CHECK-ELF:   Class:                             ELF64<br></div><div> +# CHECK-ELF:   Type:                              DYN (Shared object file)<br></div><div> +# CHECK-ELF:   FUNC    GLOBAL DEFAULT  1 a<br></div><div> +# CHECK-ELF:   OBJECT  GLOBAL DEFAULT  1 b<br></div><div> +<br></div><div> +# Here we are testing to see if two identical symbols will merge.<br></div><div> +# CHECK-MERGE-IFS: --- !experimental-ifs-v1<br></div><div> +# CHECK-MERGE-IFS-NEXT: IfsVersion:      1.0<br></div><div> +# CHECK-MERGE-IFS-NEXT: Triple:          x86_64-linux-gnu<br></div><div> +# CHECK-MERGE-IFS-NEXT: ObjectFileFormat: ELF<br></div><div> +# CHECK-MERGE-IFS-NEXT: Symbols:<br></div><div> +# CHECK-MERGE-IFS-NEXT:   a:               { Type: Func }<br></div><div> +# CHECK-MERGE-IFS-NEXT: ...<br></div><div> +<br></div><div> +--- !experimental-ifs-v1<br></div><div> +IfsVersion: 1.0<br></div><div> +Triple: x86_64-linux-gnu<br></div><div> +ObjectFileFormat: ELF<br></div><div> +Symbols:<br></div><div> +  a: { Type: Func }<br></div><div> +...<br></div><div> <br></div><div> Modified: cfe/trunk/test/InterfaceStubs/function-template-specialization.cpp<br></div><div> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/InterfaceStubs/function-template-specialization.cpp?rev=373538&r1=373537&r2=373538&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/InterfaceStubs/function-template-specialization.cpp?rev=373538&r1=373537&r2=373538&view=diff</a><br></div><div> ==============================================================================<br></div><div> --- cfe/trunk/test/InterfaceStubs/function-template-specialization.cpp (original)<br></div><div> +++ cfe/trunk/test/InterfaceStubs/function-template-specialization.cpp Wed Oct  2 15:50:07 2019<br></div><div> @@ -1,13 +1,15 @@<br></div><div>  // REQUIRES: x86-registered-target<br></div><div> -// RUN: %clang -target x86_64-unknown-linux-gnu -o - -emit-interface-stubs \<br></div><div> +<br></div><div> +// TODO: Fix the case in llvm-ifs where it crashes on an empty Symbols list.<br></div><div> +// RUN: %clang -target x86_64-unknown-linux-gnu -o - -emit-interface-stubs -c \<br></div><div>  // RUN: -interface-stub-version=experimental-ifs-v1 %s | FileCheck %s<br></div><div> <br></div><div> -// RUN: %clang -target x86_64-unknown-linux-gnu -o - -emit-interface-stubs \<br></div><div> +// RUN: %clang -target x86_64-unknown-linux-gnu -o - -emit-interface-stubs -emit-merged-ifs \<br></div><div>  // RUN: -interface-stub-version=experimental-ifs-v1 \<br></div><div>  // RUN: -DUSE_TEMPLATE_FUNCTION=1 %s | \<br></div><div>  // RUN: FileCheck -check-prefix=CHECK-USES-TEMPLATE-FUNCTION %s<br></div><div> <br></div><div> -// RUN: %clang -target x86_64-unknown-linux-gnu -o - -emit-interface-stubs \<br></div><div> +// RUN: %clang -target x86_64-unknown-linux-gnu -o - -emit-interface-stubs -emit-merged-ifs \<br></div><div>  // RUN: -interface-stub-version=experimental-ifs-v1 \<br></div><div>  // RUN: -DSPECIALIZE_TEMPLATE_FUNCTION=1 %s | \<br></div><div>  // RUN: FileCheck -check-prefix=CHECK-SPECIALIZES-TEMPLATE-FUNCTION %s<br></div><div> <br></div><div> Modified: cfe/trunk/test/InterfaceStubs/inline.c<br></div><div> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/InterfaceStubs/inline.c?rev=373538&r1=373537&r2=373538&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/InterfaceStubs/inline.c?rev=373538&r1=373537&r2=373538&view=diff</a><br></div><div> ==============================================================================<br></div><div> --- cfe/trunk/test/InterfaceStubs/inline.c (original)<br></div><div> +++ cfe/trunk/test/InterfaceStubs/inline.c Wed Oct  2 15:50:07 2019<br></div><div> @@ -1,37 +1,32 @@<br></div><div>  // REQUIRES: x86-registered-target<br></div><div> -// RUN: %clang -DINLINE=inline -target x86_64-unknown-linux-gnu -o - \<br></div><div> -// RUN: -emit-interface-stubs \<br></div><div> -// RUN: -interface-stub-version=experimental-ifs-v1 -std=gnu89 -xc %s | \<br></div><div> +// RUN: %clang -c -DINLINE=inline -target x86_64-unknown-linux-gnu -o - \<br></div><div> +// RUN: -emit-interface-stubs -std=gnu89 -xc %s | \<br></div><div>  // RUN: FileCheck -check-prefix=CHECK-GNU %s<br></div><div>  // RUN: %clang -DINLINE=inline -target x86_64-linux-gnu -O0 -o - -c \<br></div><div>  // RUN: -std=gnu89 -xc %s | llvm-nm - | FileCheck -check-prefix=CHECK-GNU %s<br></div><div> <br></div><div> -// RUN: %clang -DINLINE="__attribute__((always_inline))" \<br></div><div> -// RUN: -target x86_64-unknown-linux-gnu -o - -emit-interface-stubs \<br></div><div> -// RUN: -interface-stub-version=experimental-ifs-v1 -xc %s | \<br></div><div> +// RUN: %clang -c -DINLINE="__attribute__((always_inline))" \<br></div><div> +// RUN: -target x86_64-unknown-linux-gnu -o - -emit-interface-stubs -xc %s | \<br></div><div>  // RUN: FileCheck -check-prefix=CHECK-GNU %s<br></div><div>  // RUN: %clang -DINLINE="__attribute__((always_inline))" \<br></div><div>  // RUN: -target x86_64-linux-gnu -O0 -o - -c -xc %s | \<br></div><div>  // RUN: llvm-nm - | FileCheck -check-prefix=CHECK-GNU %s<br></div><div> <br></div><div> -// RUN: %clang -DINLINE=inline -target x86_64-unknown-linux-gnu -o - \<br></div><div> -// RUN: -emit-interface-stubs \<br></div><div> -// RUN: -interface-stub-version=experimental-ifs-v1 -std=c99 -xc %s | \<br></div><div> +// RUN: %clang -c -DINLINE=inline -target x86_64-unknown-linux-gnu -o - \<br></div><div> +// RUN: -emit-interface-stubs -std=c99 -xc %s | \<br></div><div>  // RUN: FileCheck -check-prefix=CHECK-STD %s<br></div><div>  // RUN: %clang -DINLINE=inline -target x86_64-linux-gnu -O0 -o - -c -std=c99 \<br></div><div>  // RUN: -xc %s | llvm-nm - 2>&1 | FileCheck -check-prefix=CHECK-STD %s<br></div><div> <br></div><div> -// RUN: %clang -DINLINE="__attribute__((noinline))" \<br></div><div> -// RUN: -target x86_64-unknown-linux-gnu -o - -emit-interface-stubs \<br></div><div> -// RUN: -interface-stub-version=experimental-ifs-v1 -std=c99 -xc %s | \<br></div><div> +// RUN: %clang -c -DINLINE="__attribute__((noinline))" \<br></div><div> +// RUN: -target x86_64-unknown-linux-gnu -o - -emit-interface-stubs -std=c99 -xc %s | \<br></div><div>  // RUN: FileCheck -check-prefix=CHECK-NOINLINE %s<br></div><div>  // RUN: %clang -DINLINE="__attribute__((noinline))" -target x86_64-linux-gnu \<br></div><div>  // RUN: -O0 -o - -c -std=c99 -xc %s | llvm-nm - 2>&1 | \<br></div><div>  // RUN: FileCheck -check-prefix=CHECK-NOINLINE %s<br></div><div> <br></div><div> -// RUN: %clang -DINLINE="static" -target x86_64-unknown-linux-gnu -o - \<br></div><div> -// RUN: -emit-interface-stubs \<br></div><div> -// RUN: -interface-stub-version=experimental-ifs-v1 -std=c99 -xc %s | \<br></div><div> +// RUN: %clang -c -DINLINE="static" -target x86_64-unknown-linux-gnu -o - \<br></div><div> +// RUN: -emit-interface-stubs -std=c99 -xc %s | \<br></div><div>  // RUN: FileCheck -check-prefix=CHECK-STATIC %s<br></div><div>  // RUN: %clang -DINLINE="static" -target x86_64-linux-gnu -O0 -o - -c \<br></div><div>  // RUN: -std=c99 -xc %s | llvm-nm - 2>&1 | \<br></div><div> @@ -50,12 +45,12 @@ INLINE int foo() {<br></div><div>    return var;<br></div><div>  }<br></div><div> <br></div><div> -// RUN: %clang -DINLINE=inline -target x86_64-linux-gnu -o - \<br></div><div> -// RUN: -emit-interface-stubs -interface-stub-version=experimental-ifs-v1 \<br></div><div> +// RUN: %clang -c -DINLINE=inline -target x86_64-linux-gnu -o - \<br></div><div> +// RUN: -emit-interface-stubs \<br></div><div>  // RUN: -std=gnu89 -xc %s | FileCheck -check-prefix=CHECK-TAPI %s<br></div><div> <br></div><div> -// RUN: %clang -DINLINE=inline -target x86_64-linux-gnu -o - \<br></div><div> -// RUN: -emit-interface-stubs -interface-stub-version=experimental-ifs-v1 \<br></div><div> +// RUN: %clang -c -DINLINE=inline -target x86_64-linux-gnu -o - \<br></div><div> +// RUN: -emit-interface-stubs \<br></div><div>  // RUN: -std=gnu89 -xc %s | FileCheck -check-prefix=CHECK-SYMBOLS %s<br></div><div>  // RUN: %clang -DINLINE=inline -target x86_64-linux-gnu -o - \<br></div><div>  // RUN: -c -std=gnu89 -xc %s | llvm-nm - 2>&1 | \<br></div><div> <br></div><div> Added: cfe/trunk/test/InterfaceStubs/merge-conflict-test.c<br></div><div> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/InterfaceStubs/merge-conflict-test.c?rev=373538&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/InterfaceStubs/merge-conflict-test.c?rev=373538&view=auto</a><br></div><div> ==============================================================================<br></div><div> --- cfe/trunk/test/InterfaceStubs/merge-conflict-test.c (added)<br></div><div> +++ cfe/trunk/test/InterfaceStubs/merge-conflict-test.c Wed Oct  2 15:50:07 2019<br></div><div> @@ -0,0 +1,3 @@<br></div><div> +// RUN: not %clang -o libfoo.so -emit-interface-stubs %s %S/driver-test.c 2>&1 | FileCheck %s<br></div><div> +// CHECK: error: Interface Stub: Type Mismatch<br></div><div> +int foo;<br></div><div> \ No newline at end of file<br></div><div> <br></div><div> Added: cfe/trunk/test/InterfaceStubs/object-double.c<br></div><div> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/InterfaceStubs/object-double.c?rev=373538&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/InterfaceStubs/object-double.c?rev=373538&view=auto</a><br></div><div> ==============================================================================<br></div><div> --- cfe/trunk/test/InterfaceStubs/object-double.c (added)<br></div><div> +++ cfe/trunk/test/InterfaceStubs/object-double.c Wed Oct  2 15:50:07 2019<br></div><div> @@ -0,0 +1,5 @@<br></div><div> +// RUN: not %clang -o - -emit-interface-stubs %s %S/object.c 2>&1 | FileCheck %s<br></div><div> +// Need to encode more type info or weak vs strong symbol resolution in llvm-ifs<br></div><div> +// XFAIL: *<br></div><div> +// CHECK: error: Interface Stub: Size Mismatch<br></div><div> +float data = 42.0;<br></div><div> \ No newline at end of file<br></div><div> <br></div><div> Added: cfe/trunk/test/InterfaceStubs/object-float.c<br></div><div> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/InterfaceStubs/object-float.c?rev=373538&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/InterfaceStubs/object-float.c?rev=373538&view=auto</a><br></div><div> ==============================================================================<br></div><div> --- cfe/trunk/test/InterfaceStubs/object-float.c (added)<br></div><div> +++ cfe/trunk/test/InterfaceStubs/object-float.c Wed Oct  2 15:50:07 2019<br></div><div> @@ -0,0 +1,3 @@<br></div><div> +// RUN: not %clang -o - -emit-interface-stubs %s %S/object.c 2>&1 | FileCheck %s<br></div><div> +// CHECK: error: Interface Stub: Size Mismatch<br></div><div> +double data = 42.0;<br></div><div> \ No newline at end of file<br></div><div> <br></div><div> Added: cfe/trunk/test/InterfaceStubs/object.c<br></div><div> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/InterfaceStubs/object.c?rev=373538&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/InterfaceStubs/object.c?rev=373538&view=auto</a><br></div><div> ==============================================================================<br></div><div> --- cfe/trunk/test/InterfaceStubs/object.c (added)<br></div><div> +++ cfe/trunk/test/InterfaceStubs/object.c Wed Oct  2 15:50:07 2019<br></div><div> @@ -0,0 +1,7 @@<br></div><div> +// RUN: %clang -c -o - -emit-interface-stubs %s | FileCheck -check-prefix=CHECK-TAPI %s<br></div><div> +// RUN: %clang -c -o - -emit-interface-stubs %s | FileCheck -check-prefix=CHECK-SYMBOLS %s<br></div><div> +// RUN: %clang -c -o - %s | llvm-nm - 2>&1 | FileCheck -check-prefix=CHECK-SYMBOLS %s<br></div><div> +<br></div><div> +// CHECK-TAPI: data: { Type: Object, Size: 4 }<br></div><div> +// CHECK-SYMBOLS: data<br></div><div> +int data = 42;<br></div><div> <br></div><div> Added: cfe/trunk/test/InterfaceStubs/object.ifs<br></div><div> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/InterfaceStubs/object.ifs?rev=373538&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/InterfaceStubs/object.ifs?rev=373538&view=auto</a><br></div><div> ==============================================================================<br></div><div> --- cfe/trunk/test/InterfaceStubs/object.ifs (added)<br></div><div> +++ cfe/trunk/test/InterfaceStubs/object.ifs Wed Oct  2 15:50:07 2019<br></div><div> @@ -0,0 +1,28 @@<br></div><div> +# RUN: %clang -emit-interface-stubs -o - -emit-merged-ifs %s | \<br></div><div> +# RUN: FileCheck %s --check-prefixes=CHECK-IFS<br></div><div> +<br></div><div> +# RUN: %clang -emit-interface-stubs -o - %s | llvm-readelf --all | \<br></div><div> +# RUN: FileCheck %s --check-prefixes=CHECK-ELF<br></div><div> +<br></div><div> +# CHECK-IFS: --- !experimental-ifs-v1<br></div><div> +# CHECK-IFS-NEXT: IfsVersion:      1.0<br></div><div> +# CHECK-IFS-NEXT: Triple: x86_64-linux-gnu<br></div><div> +# CHECK-IFS-NEXT: ObjectFileFormat: ELF<br></div><div> +# CHECK-IFS-NEXT: Symbols:<br></div><div> +# CHECK-IFS-NEXT:   b:               { Type: Object, Size: 4 }<br></div><div> +# CHECK-IFS-NEXT: ...<br></div><div> +<br></div><div> +# CHECK-ELF: ELF Header:<br></div><div> +# CHECK-ELF:   Class:                             ELF64<br></div><div> +# CHECK-ELF:   Data:                              2's complement, little endian<br></div><div> +# CHECK-ELF:   Type:                              DYN (Shared object file)<br></div><div> +# CHECK-ELF-NOT:   FUNC    GLOBAL DEFAULT  1 a<br></div><div> +# CHECK-ELF:   OBJECT  GLOBAL DEFAULT  1 b<br></div><div> +<br></div><div> +--- !experimental-ifs-v1<br></div><div> +IfsVersion: 1.0<br></div><div> +Triple: x86_64-linux-gnu<br></div><div> +ObjectFileFormat: ELF<br></div><div> +Symbols:<br></div><div> +  b: { Type: Object, Size: 4 }<br></div><div> +...<br></div><div> <br></div><div> Modified: cfe/trunk/test/InterfaceStubs/template-namespace-function.cpp<br></div><div> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/InterfaceStubs/template-namespace-function.cpp?rev=373538&r1=373537&r2=373538&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/InterfaceStubs/template-namespace-function.cpp?rev=373538&r1=373537&r2=373538&view=diff</a><br></div><div> ==============================================================================<br></div><div> --- cfe/trunk/test/InterfaceStubs/template-namespace-function.cpp (original)<br></div><div> +++ cfe/trunk/test/InterfaceStubs/template-namespace-function.cpp Wed Oct  2 15:50:07 2019<br></div><div> @@ -1,5 +1,5 @@<br></div><div>  // REQUIRES: x86-registered-target<br></div><div> -// RUN: %clang -target x86_64-unknown-linux-gnu -o - -emit-interface-stubs \<br></div><div> +// RUN: %clang -target x86_64-unknown-linux-gnu -o - -emit-interface-stubs -emit-merged-ifs \<br></div><div>  // RUN: -interface-stub-version=experimental-ifs-v1 %s | \<br></div><div>  // RUN: FileCheck %s<br></div><div> <br></div><div> <br></div><div> Modified: cfe/trunk/test/InterfaceStubs/weak.cpp<br></div><div> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/InterfaceStubs/weak.cpp?rev=373538&r1=373537&r2=373538&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/InterfaceStubs/weak.cpp?rev=373538&r1=373537&r2=373538&view=diff</a><br></div><div> ==============================================================================<br></div><div> --- cfe/trunk/test/InterfaceStubs/weak.cpp (original)<br></div><div> +++ cfe/trunk/test/InterfaceStubs/weak.cpp Wed Oct  2 15:50:07 2019<br></div><div> @@ -1,5 +1,5 @@<br></div><div>  // REQUIRES: x86-registered-target<br></div><div> -// RUN: %clang -target x86_64-linux-gnu -o - -emit-interface-stubs \<br></div><div> +// RUN: %clang -target x86_64-linux-gnu -o - -emit-interface-stubs -emit-merged-ifs \<br></div><div>  // RUN: -interface-stub-version=experimental-ifs-v1 %s | \<br></div><div>  // RUN: FileCheck %s<br></div><div> <br></div><div> <br></div><div> Modified: cfe/trunk/test/<a href="http://lit.cfg.py" rel="noreferrer" target="_blank">lit.cfg.py</a><br></div><div> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/lit.cfg.py?rev=373538&r1=373537&r2=373538&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/lit.cfg.py?rev=373538&r1=373537&r2=373538&view=diff</a><br></div><div> ==============================================================================<br></div><div> --- cfe/trunk/test/<a href="http://lit.cfg.py" rel="noreferrer" target="_blank">lit.cfg.py</a> (original)<br></div><div> +++ cfe/trunk/test/<a href="http://lit.cfg.py" rel="noreferrer" target="_blank">lit.cfg.py</a> Wed Oct  2 15:50:07 2019<br></div><div> @@ -26,7 +26,7 @@ config.test_format = lit.formats.ShTest(<br></div><div> <br></div><div>  # suffixes: A list of file extensions to treat as test files.<br></div><div>  config.suffixes = ['.c', '.cpp', '.cppm', '.m', '.mm', '.cu',<br></div><div> -                   '.ll', '.cl', '.s', '.S', '.modulemap', '.test', '.rs']<br></div><div> +                   '.ll', '.cl', '.s', '.S', '.modulemap', '.test', '.rs', '.ifs']<br></div><div> <br></div><div>  # excludes: A list of directories to exclude from the testsuite. The 'Inputs'<br></div><div>  # subdirectories contain auxiliary inputs for various tests in their parent<br></div><div> @@ -61,7 +61,7 @@ config.substitutions.append(('%PATH%', c<br></div><div>  tool_dirs = [config.clang_tools_dir, config.llvm_tools_dir]<br></div><div> <br></div><div>  tools = [<br></div><div> -    'c-index-test', 'clang-diff', 'clang-format', 'clang-tblgen', 'opt',<br></div><div> +    'c-index-test', 'clang-diff', 'clang-format', 'clang-tblgen', 'opt', 'llvm-ifs',<br></div><div>      ToolSubst('%clang_extdef_map', command=FindTool(<br></div><div>          'clang-extdef-mapping'), unresolved='ignore'),<br></div><div>  ]<br></div><div> <br></div><div> <br></div><div> _______________________________________________<br></div><div> cfe-commits mailing list<br></div><div> <a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a><br></div><div> <a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits</a><br></div></blockquote></div></blockquote><div><br></div></blockquote></div>
</blockquote><div><br></div><div><br></div></blockquote></div>
</blockquote></div>