summaryrefslogtreecommitdiffstats
path: root/clang/lib/Driver/Driver.cpp
diff options
context:
space:
mode:
authorJustin Lebar <jlebar@google.com>2016-01-08 19:04:11 +0000
committerJustin Lebar <jlebar@google.com>2016-01-08 19:04:11 +0000
commit23bcef990e4e3174c80928087b2970d73bb2283f (patch)
tree392a11f8c6f892937c3373cca87b325ab0458fde /clang/lib/Driver/Driver.cpp
parentdc3ad6fc1c50d1006d5dbb3edb998d281b61e8d2 (diff)
downloadbcm5719-llvm-23bcef990e4e3174c80928087b2970d73bb2283f.tar.gz
bcm5719-llvm-23bcef990e4e3174c80928087b2970d73bb2283f.zip
Update code in buildCudaActions and BuildActions to latest idiom.
Summary: Use llvm::any_of, llvm::find, etc. No functional changes. Reviewers: tra Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D15936 llvm-svn: 257190
Diffstat (limited to 'clang/lib/Driver/Driver.cpp')
-rw-r--r--clang/lib/Driver/Driver.cpp32
1 files changed, 14 insertions, 18 deletions
diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp
index 85bbcb4113a..0969a7a83c7 100644
--- a/clang/lib/Driver/Driver.cpp
+++ b/clang/lib/Driver/Driver.cpp
@@ -1298,11 +1298,11 @@ buildCudaActions(Compilation &C, DerivedArgList &Args, const Arg *InputArg,
SmallVector<const char *, 4> GpuArchList;
llvm::StringSet<> GpuArchNames;
for (Arg *A : Args) {
- if (A->getOption().matches(options::OPT_cuda_gpu_arch_EQ)) {
- A->claim();
- if (GpuArchNames.insert(A->getValue()).second)
- GpuArchList.push_back(A->getValue());
- }
+ if (!A->getOption().matches(options::OPT_cuda_gpu_arch_EQ))
+ continue;
+ A->claim();
+ if (GpuArchNames.insert(A->getValue()).second)
+ GpuArchList.push_back(A->getValue());
}
// Default to sm_20 which is the lowest common denominator for supported GPUs.
@@ -1325,13 +1325,10 @@ buildCudaActions(Compilation &C, DerivedArgList &Args, const Arg *InputArg,
"Failed to create actions for all devices");
// Check whether any of device actions stopped before they could generate PTX.
- bool PartialCompilation = false;
- for (unsigned I = 0, E = GpuArchList.size(); I != E; ++I) {
- if (CudaDeviceActions[I]->getKind() != Action::BackendJobClass) {
- PartialCompilation = true;
- break;
- }
- }
+ bool PartialCompilation =
+ llvm::any_of(CudaDeviceActions, [](const Action *a) {
+ return a->getKind() != Action::BackendJobClass;
+ });
// Figure out what to do with device actions -- pass them as inputs to the
// host action or run each of them independently.
@@ -1470,12 +1467,11 @@ void Driver::BuildActions(Compilation &C, const ToolChain &TC,
continue;
}
- phases::ID CudaInjectionPhase = FinalPhase;
- for (const auto &Phase : PL)
- if (Phase <= FinalPhase && Phase == phases::Compile) {
- CudaInjectionPhase = Phase;
- break;
- }
+ phases::ID CudaInjectionPhase =
+ (phases::Compile < FinalPhase &&
+ llvm::find(PL, phases::Compile) != PL.end())
+ ? phases::Compile
+ : FinalPhase;
// Build the pipeline for this file.
std::unique_ptr<Action> Current(new InputAction(*InputArg, InputType));
OpenPOWER on IntegriCloud