summaryrefslogtreecommitdiffstats
path: root/clang/lib/Driver/Driver.cpp
diff options
context:
space:
mode:
authorPuyan Lotfi <puyan@puyan.org>2019-07-22 23:10:10 +0000
committerPuyan Lotfi <puyan@puyan.org>2019-07-22 23:10:10 +0000
commit298a1ed4add3247819650fd719b2848e6d8df4b6 (patch)
tree45e641d2bcaf0730668fdb8fbe5c4f4b94babb6c /clang/lib/Driver/Driver.cpp
parent67713e2687d3699a2c44db9f600669f19261e730 (diff)
downloadbcm5719-llvm-298a1ed4add3247819650fd719b2848e6d8df4b6.tar.gz
bcm5719-llvm-298a1ed4add3247819650fd719b2848e6d8df4b6.zip
[NFC][clang] Refactor getCompilationPhases()+Types.def step 1.
Moves list of phases into Types.def table: Currently Types.def contains a table of strings that are used to assemble a list of compilation phases to be setup in the clang driver's jobs pipeline. This change makes it so that the table itself contains the list of phases. A subsequent patch will remove the strings. Differential Revision: https://reviews.llvm.org/D64098 llvm-svn: 366761
Diffstat (limited to 'clang/lib/Driver/Driver.cpp')
-rw-r--r--clang/lib/Driver/Driver.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp
index 396ddf4dd81..bc6b23d5827 100644
--- a/clang/lib/Driver/Driver.cpp
+++ b/clang/lib/Driver/Driver.cpp
@@ -2223,7 +2223,7 @@ class OffloadingActionBuilder final {
/// Builder interface. It doesn't build anything or keep any state.
class DeviceActionBuilder {
public:
- typedef llvm::SmallVector<phases::ID, phases::MaxNumberOfPhases> PhasesTy;
+ typedef const llvm::SmallVectorImpl<phases::ID> PhasesTy;
enum ActionBuilderReturnCode {
// The builder acted successfully on the current action.
@@ -3237,13 +3237,14 @@ void Driver::BuildActions(Compilation &C, DerivedArgList &Args,
HeaderModulePrecompileJobAction *HeaderModuleAction = nullptr;
ActionList LinkerInputs;
- llvm::SmallVector<phases::ID, phases::MaxNumberOfPhases> PL;
+ unsigned LastPLSize = 0;
for (auto &I : Inputs) {
types::ID InputType = I.first;
const Arg *InputArg = I.second;
- PL.clear();
+ llvm::SmallVector<phases::ID, phases::MaxNumberOfPhases> PL;
types::getCompilationPhases(InputType, PL);
+ LastPLSize = PL.size();
// If the first step comes after the final phase we are doing as part of
// this compilation, warn the user about it.
@@ -3309,9 +3310,7 @@ void Driver::BuildActions(Compilation &C, DerivedArgList &Args,
if (OffloadBuilder.addHostDependenceToDeviceActions(Current, InputArg))
break;
- for (SmallVectorImpl<phases::ID>::iterator i = PL.begin(), e = PL.end();
- i != e; ++i) {
- phases::ID Phase = *i;
+ for (phases::ID Phase : PL) {
// We are done if this step is past what the user requested.
if (Phase > FinalPhase)
@@ -3325,7 +3324,7 @@ void Driver::BuildActions(Compilation &C, DerivedArgList &Args,
// Queue linker inputs.
if (Phase == phases::Link) {
- assert((i + 1) == e && "linking must be final compilation step.");
+ assert(Phase == PL.back() && "linking must be final compilation step.");
LinkerInputs.push_back(Current);
Current = nullptr;
break;
@@ -3382,7 +3381,8 @@ void Driver::BuildActions(Compilation &C, DerivedArgList &Args,
// If we are linking, claim any options which are obviously only used for
// compilation.
- if (FinalPhase == phases::Link && PL.size() == 1) {
+ // FIXME: Understand why the last Phase List length is used here.
+ if (FinalPhase == phases::Link && LastPLSize == 1) {
Args.ClaimAllArgs(options::OPT_CompileOnly_Group);
Args.ClaimAllArgs(options::OPT_cl_compile_Group);
}
OpenPOWER on IntegriCloud