mirror of https://github.com/microsoft/clang.git
Add an Action* member to InputInfo.
Summary: The CUDA toolchain needs to know which Actions created which InputInfos, because it needs to attach GPU archs to the various InputInfos. Reviewers: echristo Subscribers: jfb, dschuff, jhen, tra, cfe-commits Differential Revision: http://reviews.llvm.org/D16078 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@257411 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
97672aaa30
commit
d168c091f7
|
@ -1801,9 +1801,9 @@ InputInfo Driver::BuildJobsForAction(Compilation &C, const Action *A,
|
|||
Input.claim();
|
||||
if (Input.getOption().matches(options::OPT_INPUT)) {
|
||||
const char *Name = Input.getValue();
|
||||
return InputInfo(Name, A->getType(), Name);
|
||||
return InputInfo(A, Name, /* BaseInput = */ Name);
|
||||
}
|
||||
return InputInfo(&Input, A->getType(), "");
|
||||
return InputInfo(A, &Input, /* BaseInput = */ "");
|
||||
}
|
||||
|
||||
if (const BindArchAction *BAA = dyn_cast<BindArchAction>(A)) {
|
||||
|
@ -1877,11 +1877,11 @@ InputInfo Driver::BuildJobsForAction(Compilation &C, const Action *A,
|
|||
// Determine the place to write output to, if any.
|
||||
InputInfo Result;
|
||||
if (JA->getType() == types::TY_Nothing)
|
||||
Result = InputInfo(A->getType(), BaseInput);
|
||||
Result = InputInfo(A, BaseInput);
|
||||
else
|
||||
Result = InputInfo(GetNamedOutputPath(C, *JA, BaseInput, BoundArch,
|
||||
AtTopLevel, MultipleArchs),
|
||||
A->getType(), BaseInput);
|
||||
Result = InputInfo(A, GetNamedOutputPath(C, *JA, BaseInput, BoundArch,
|
||||
AtTopLevel, MultipleArchs),
|
||||
BaseInput);
|
||||
|
||||
if (CCCPrintBindings && !CCGenDiagnostics) {
|
||||
llvm::errs() << "# \"" << T->getToolChain().getTripleString() << '"'
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#ifndef LLVM_CLANG_LIB_DRIVER_INPUTINFO_H
|
||||
#define LLVM_CLANG_LIB_DRIVER_INPUTINFO_H
|
||||
|
||||
#include "clang/Driver/Action.h"
|
||||
#include "clang/Driver/Types.h"
|
||||
#include "llvm/Option/Arg.h"
|
||||
#include <cassert>
|
||||
|
@ -38,21 +39,36 @@ class InputInfo {
|
|||
const llvm::opt::Arg *InputArg;
|
||||
} Data;
|
||||
Class Kind;
|
||||
const Action* Act;
|
||||
types::ID Type;
|
||||
const char *BaseInput;
|
||||
|
||||
public:
|
||||
InputInfo() {}
|
||||
InputInfo(types::ID _Type, const char *_BaseInput)
|
||||
: Kind(Nothing), Type(_Type), BaseInput(_BaseInput) {
|
||||
static types::ID GetActionType(const Action *A) {
|
||||
return A != nullptr ? A->getType() : types::TY_Nothing;
|
||||
}
|
||||
InputInfo(const char *_Filename, types::ID _Type, const char *_BaseInput)
|
||||
: Kind(Filename), Type(_Type), BaseInput(_BaseInput) {
|
||||
|
||||
public:
|
||||
InputInfo() : InputInfo(nullptr, nullptr) {}
|
||||
InputInfo(const Action *A, const char *_BaseInput)
|
||||
: Kind(Nothing), Act(A), Type(GetActionType(A)), BaseInput(_BaseInput) {}
|
||||
|
||||
InputInfo(types::ID _Type, const char *_Filename, const char *_BaseInput)
|
||||
: Kind(Filename), Act(nullptr), Type(_Type), BaseInput(_BaseInput) {
|
||||
Data.Filename = _Filename;
|
||||
}
|
||||
InputInfo(const llvm::opt::Arg *_InputArg, types::ID _Type,
|
||||
InputInfo(const Action *A, const char *_Filename, const char *_BaseInput)
|
||||
: Kind(Filename), Act(A), Type(GetActionType(A)), BaseInput(_BaseInput) {
|
||||
Data.Filename = _Filename;
|
||||
}
|
||||
|
||||
InputInfo(types::ID _Type, const llvm::opt::Arg *_InputArg,
|
||||
const char *_BaseInput)
|
||||
: Kind(InputArg), Type(_Type), BaseInput(_BaseInput) {
|
||||
: Kind(InputArg), Act(nullptr), Type(_Type), BaseInput(_BaseInput) {
|
||||
Data.InputArg = _InputArg;
|
||||
}
|
||||
InputInfo(const Action *A, const llvm::opt::Arg *_InputArg,
|
||||
const char *_BaseInput)
|
||||
: Kind(InputArg), Act(A), Type(GetActionType(A)), BaseInput(_BaseInput) {
|
||||
Data.InputArg = _InputArg;
|
||||
}
|
||||
|
||||
|
@ -61,6 +77,9 @@ public:
|
|||
bool isInputArg() const { return Kind == InputArg; }
|
||||
types::ID getType() const { return Type; }
|
||||
const char *getBaseInput() const { return BaseInput; }
|
||||
/// The action for which this InputInfo was created. May be null.
|
||||
const Action *getAction() const { return Act; }
|
||||
void setAction(const Action *A) { Act = A; }
|
||||
|
||||
const char *getFilename() const {
|
||||
assert(isFilename() && "Invalid accessor.");
|
||||
|
|
|
@ -2980,7 +2980,7 @@ static void SplitDebugInfo(const ToolChain &TC, Compilation &C, const Tool &T,
|
|||
ExtractArgs.push_back(OutFile);
|
||||
|
||||
const char *Exec = Args.MakeArgString(TC.GetProgramPath("objcopy"));
|
||||
InputInfo II(Output.getFilename(), types::TY_Object, Output.getFilename());
|
||||
InputInfo II(types::TY_Object, Output.getFilename(), Output.getFilename());
|
||||
|
||||
// First extract the dwo sections.
|
||||
C.addCommand(llvm::make_unique<Command>(JA, T, Exec, ExtractArgs, II));
|
||||
|
@ -8987,7 +8987,7 @@ void nacltools::AssemblerARM::ConstructJob(Compilation &C, const JobAction &JA,
|
|||
const char *LinkingOutput) const {
|
||||
const toolchains::NaClToolChain &ToolChain =
|
||||
static_cast<const toolchains::NaClToolChain &>(getToolChain());
|
||||
InputInfo NaClMacros(ToolChain.GetNaClArmMacrosPath(), types::TY_PP_Asm,
|
||||
InputInfo NaClMacros(types::TY_PP_Asm, ToolChain.GetNaClArmMacrosPath(),
|
||||
"nacl-arm-macros.s");
|
||||
InputInfoList NewInputs;
|
||||
NewInputs.push_back(NaClMacros);
|
||||
|
|
Loading…
Reference in New Issue