Skip to content

Commit

Permalink
Revert 373538 and follow-ups 373549 and 373552.
Browse files Browse the repository at this point in the history
They break tests on (at least) macOS.

llvm-svn: 373556
  • Loading branch information
nico committed Oct 3, 2019
1 parent 45f682f commit 6713f82
Show file tree
Hide file tree
Showing 32 changed files with 111 additions and 340 deletions.
12 changes: 0 additions & 12 deletions clang/include/clang/Driver/Action.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ class Action {
BackendJobClass,
AssembleJobClass,
LinkJobClass,
IfsMergeJobClass,
LipoJobClass,
DsymutilJobClass,
VerifyDebugInfoJobClass,
Expand Down Expand Up @@ -486,17 +485,6 @@ class AssembleJobAction : public JobAction {
}
};

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;

Expand Down
3 changes: 0 additions & 3 deletions clang/include/clang/Driver/Options.td
Original file line number Diff line number Diff line change
Expand Up @@ -633,9 +633,6 @@ 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>;
Expand Down
3 changes: 1 addition & 2 deletions clang/include/clang/Driver/Phases.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ namespace phases {
Compile,
Backend,
Assemble,
Link,
IfsMerge,
Link
};

enum {
Expand Down
2 changes: 0 additions & 2 deletions clang/include/clang/Driver/ToolChain.h
Original file line number Diff line number Diff line change
Expand Up @@ -136,13 +136,11 @@ class ToolChain {
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;

Expand Down
3 changes: 1 addition & 2 deletions clang/include/clang/Driver/Types.def
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,7 @@ 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::IfsMerge)
TYPE("ifs-cpp", IFS_CPP, INVALID, "ifs", phases::Compile, phases::IfsMerge)
TYPE("ifs", IFS, INVALID, "ifs", phases::Compile, phases::Backend, phases::Assemble, phases::Link)
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)
Expand Down
6 changes: 0 additions & 6 deletions clang/lib/Driver/Action.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ 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";
Expand Down Expand Up @@ -358,11 +357,6 @@ 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)
Expand Down
1 change: 0 additions & 1 deletion clang/lib/Driver/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ add_clang_library(clangDriver
ToolChains/WebAssembly.cpp
ToolChains/XCore.cpp
ToolChains/PPCLinux.cpp
ToolChains/InterfaceStubs.cpp
Types.cpp
XRayArgs.cpp

Expand Down
36 changes: 7 additions & 29 deletions clang/lib/Driver/Driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -274,35 +274,32 @@ 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)) ||
(PhaseArg = DAL.getLastArg(options::OPT_verify_pch)) ||
(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;

// clang interface stubs
} else if ((PhaseArg = DAL.getLastArg(options::OPT_emit_iterface_stubs))) {
FinalPhase = phases::IfsMerge;

// -S only runs up to the backend.
// -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;

Expand Down Expand Up @@ -3326,7 +3323,6 @@ 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;
Expand Down Expand Up @@ -3364,17 +3360,6 @@ 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.
Expand Down Expand Up @@ -3424,11 +3409,6 @@ 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)) {
Expand Down Expand Up @@ -3465,8 +3445,6 @@ 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,
Expand Down Expand Up @@ -3531,7 +3509,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_CPP);
return C.MakeAction<CompileJobAction>(Input, types::TY_IFS);
return C.MakeAction<CompileJobAction>(Input, types::TY_LLVM_BC);
}
case phases::Backend: {
Expand Down
1 change: 0 additions & 1 deletion clang/lib/Driver/Phases.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ 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.");
Expand Down
10 changes: 0 additions & 10 deletions clang/lib/Driver/ToolChain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#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"
Expand Down Expand Up @@ -280,12 +279,6 @@ 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));
Expand All @@ -297,9 +290,6 @@ Tool *ToolChain::getTool(Action::ActionClass AC) const {
case Action::AssembleJobClass:
return getAssemble();

case Action::IfsMergeJobClass:
return getIfsMerge();

case Action::LinkJobClass:
return getLink();

Expand Down
25 changes: 21 additions & 4 deletions clang/lib/Driver/ToolChains/Clang.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3683,15 +3683,32 @@ 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 ||
JA.getType() == types::TY_IFS_CPP) {
} else if (JA.getType() == types::TY_IFS) {
StringRef ArgStr =
Args.hasArg(options::OPT_iterface_stub_version_EQ)
? Args.getLastArgValue(options::OPT_iterface_stub_version_EQ)
: "experimental-ifs-v1";
: "";
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;
}

CmdArgs.push_back("-emit-interface-stubs");
CmdArgs.push_back(
Args.MakeArgString(Twine("-interface-stub-version=") + ArgStr.str()));
Args.MakeArgString(Twine("-interface-stub-version=") + StubFormat));
} else if (JA.getType() == types::TY_PP_Asm) {
CmdArgs.push_back("-S");
} else if (JA.getType() == types::TY_AST) {
Expand Down
37 changes: 0 additions & 37 deletions clang/lib/Driver/ToolChains/InterfaceStubs.cpp

This file was deleted.

36 changes: 0 additions & 36 deletions clang/lib/Driver/ToolChains/InterfaceStubs.h

This file was deleted.

18 changes: 1 addition & 17 deletions clang/lib/Driver/Types.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,6 @@ 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)
Expand Down Expand Up @@ -320,22 +319,6 @@ 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) ||
Expand All @@ -344,6 +327,7 @@ 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),
Expand Down
Loading

0 comments on commit 6713f82

Please sign in to comment.