Skip to content

Commit e865154

Browse files
authored
[Clang][Driver] Clean up nfc from divergence to upstream (#750)
Cleans up easy to fix non functional changes like whitespaces, added/removed braces, ...
1 parent eecf9f2 commit e865154

File tree

9 files changed

+28
-8
lines changed

9 files changed

+28
-8
lines changed

clang/lib/Driver/Driver.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3784,10 +3784,9 @@ class OffloadingActionBuilder final {
37843784
}
37853785

37863786
// By default, we produce an action for each device arch.
3787-
for (Action *&A : CudaDeviceActions) {
3787+
for (Action *&A : CudaDeviceActions)
37883788
A = C.getDriver().ConstructPhaseAction(C, Args, CurPhase, A,
37893789
AssociatedOffloadKind);
3790-
}
37913790

37923791
if (CompileDeviceOnly && CurPhase == FinalPhase && BundleOutput &&
37933792
*BundleOutput) {
@@ -7468,3 +7467,4 @@ void driver::applyOverrideOptions(SmallVectorImpl<const char *> &Args,
74687467
++S;
74697468
}
74707469
}
7470+

clang/lib/Driver/ToolChain.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1909,3 +1909,4 @@ llvm::opt::DerivedArgList *ToolChain::TranslateXarchArgs(
19091909
delete DAL;
19101910
return nullptr;
19111911
}
1912+

clang/lib/Driver/ToolChains/AMDGPUOpenMP.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,6 @@ void AMDGPUOpenMPToolChain::addClangTargetOptions(
445445
llvm::opt::DerivedArgList *AMDGPUOpenMPToolChain::TranslateArgs(
446446
const llvm::opt::DerivedArgList &Args, StringRef BoundArch,
447447
Action::OffloadKind DeviceOffloadKind) const {
448-
449448
DerivedArgList *DAL =
450449
HostTC.TranslateArgs(Args, BoundArch, DeviceOffloadKind);
451450

clang/lib/Driver/ToolChains/AMDGPUOpenMP.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,6 @@ class LLVM_LIBRARY_VISIBILITY AMDGPUOpenMPToolChain final
9494

9595
void addClangWarningOptions(llvm::opt::ArgStringList &CC1Args) const override;
9696
CXXStdlibType GetCXXStdlibType(const llvm::opt::ArgList &Args) const override;
97-
9897
void AddClangCXXStdlibIncludeArgs(
9998
const llvm::opt::ArgList &Args,
10099
llvm::opt::ArgStringList &CC1Args) const override;

clang/lib/Driver/ToolChains/Clang.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9516,3 +9516,4 @@ void LinkerWrapper::ConstructJob(Compilation &C, const JobAction &JA,
95169516
LinkCommand->replaceExecutable(Exec);
95179517
LinkCommand->replaceArguments(CmdArgs);
95189518
}
9519+

clang/lib/Driver/ToolChains/CommonArgs.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1019,7 +1019,6 @@ void tools::addLTOOptions(const ToolChain &ToolChain, const ArgList &Args,
10191019
StringRef Linker = Args.getLastArgValue(options::OPT_fuse_ld_EQ);
10201020
const char *LinkerPath = Args.MakeArgString(ToolChain.GetLinkerPath());
10211021
const Driver &D = ToolChain.getDriver();
1022-
10231022
const bool IsFatLTO = Args.hasFlag(options::OPT_ffat_lto_objects,
10241023
options::OPT_fno_fat_lto_objects, false);
10251024
const bool IsUnifiedLTO = Args.hasArg(options::OPT_funified_lto);
@@ -3185,7 +3184,6 @@ void tools::addOpenMPDeviceRTL(const Driver &D,
31853184
: Triple.isNVPTX() ? options::OPT_libomptarget_nvptx_bc_path_EQ
31863185
: options::OPT_libomptarget_spirv_bc_path_EQ;
31873186

3188-
31893187
StringRef ArchPrefix = Triple.isAMDGCN() ? "amdgpu"
31903188
: Triple.isNVPTX() ? "nvptx"
31913189
: "spirv";

clang/lib/Driver/ToolChains/Cuda.h

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
1-
21
//===--- Cuda.h - Cuda ToolChain Implementations ----------------*- C++ -*-===//
32
//
43
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
54
// See https://llvm.org/LICENSE.txt for license information.
65
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
76
//
87
//===----------------------------------------------------------------------===//
8+
99
#ifndef LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_CUDA_H
1010
#define LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_CUDA_H
11+
1112
#include "clang/Basic/Cuda.h"
1213
#include "clang/Driver/Action.h"
1314
#include "clang/Driver/CudaInstallationDetector.h"
@@ -19,10 +20,12 @@
1920
#include <bitset>
2021
#include <set>
2122
#include <vector>
23+
2224
namespace clang {
2325
namespace driver {
2426
namespace tools {
2527
namespace NVPTX {
28+
2629
// Run ptxas, the NVPTX assembler.
2730
class LLVM_LIBRARY_VISIBILITY Assembler final : public Tool {
2831
public:
@@ -33,6 +36,7 @@ class LLVM_LIBRARY_VISIBILITY Assembler final : public Tool {
3336
const llvm::opt::ArgList &TCArgs,
3437
const char *LinkingOutput) const override;
3538
};
39+
3640
// Runs fatbinary, which combines GPU object files ("cubin" files) and/or PTX
3741
// assembly into a single output file.
3842
class LLVM_LIBRARY_VISIBILITY FatBinary : public Tool {
@@ -44,6 +48,7 @@ class LLVM_LIBRARY_VISIBILITY FatBinary : public Tool {
4448
const llvm::opt::ArgList &TCArgs,
4549
const char *LinkingOutput) const override;
4650
};
51+
4752
// Runs nvlink, which links GPU object files ("cubin" files) into a single file.
4853
class LLVM_LIBRARY_VISIBILITY Linker final : public Tool {
4954
public:
@@ -55,6 +60,7 @@ class LLVM_LIBRARY_VISIBILITY Linker final : public Tool {
5560
const llvm::opt::ArgList &TCArgs,
5661
const char *LinkingOutput) const override;
5762
};
63+
5864
class LLVM_LIBRARY_VISIBILITY OpenMPLinker : public Tool {
5965
public:
6066
OpenMPLinker(const ToolChain &TC)
@@ -65,12 +71,15 @@ class LLVM_LIBRARY_VISIBILITY OpenMPLinker : public Tool {
6571
const llvm::opt::ArgList &TCArgs,
6672
const char *LinkingOutput) const override;
6773
};
74+
6875
void getNVPTXTargetFeatures(const Driver &D, const llvm::Triple &Triple,
6976
const llvm::opt::ArgList &Args,
7077
std::vector<StringRef> &Features);
7178
} // end namespace NVPTX
7279
} // end namespace tools
80+
7381
namespace toolchains {
82+
7483
class LLVM_LIBRARY_VISIBILITY NVPTXToolChain : public ToolChain {
7584
public:
7685
NVPTXToolChain(const Driver &D, const llvm::Triple &Triple,
@@ -79,6 +88,7 @@ class LLVM_LIBRARY_VISIBILITY NVPTXToolChain : public ToolChain {
7988

8089
NVPTXToolChain(const Driver &D, const llvm::Triple &Triple,
8190
const llvm::opt::ArgList &Args);
91+
8292
llvm::opt::DerivedArgList *
8393
TranslateArgs(const llvm::opt::DerivedArgList &Args, StringRef BoundArch,
8494
Action::OffloadKind DeviceOffloadKind) const override;
@@ -102,10 +112,13 @@ class LLVM_LIBRARY_VISIBILITY NVPTXToolChain : public ToolChain {
102112
bool HasNativeLLVMSupport() const override { return true; }
103113
bool isPICDefaultForced() const override { return false; }
104114
bool SupportsProfiling() const override { return false; }
115+
105116
bool IsMathErrnoDefault() const override { return false; }
117+
106118
bool supportsDebugInfoOption(const llvm::opt::Arg *A) const override;
107119
void adjustDebugInfoKind(llvm::codegenoptions::DebugInfoKind &DebugInfoKind,
108120
const llvm::opt::ArgList &Args) const override;
121+
109122
// NVPTX supports only DWARF2.
110123
unsigned GetDefaultDwarfVersion() const override { return 2; }
111124
unsigned getMaxDwarfVersion() const override { return 2; }
@@ -116,6 +129,7 @@ class LLVM_LIBRARY_VISIBILITY NVPTXToolChain : public ToolChain {
116129
getSystemGPUArchs(const llvm::opt::ArgList &Args) const override;
117130

118131
CudaInstallationDetector CudaInstallation;
132+
119133
protected:
120134
Tool *buildAssembler() const override; // ptxas.
121135
Tool *buildLinker() const override; // nvlink.
@@ -128,25 +142,30 @@ class LLVM_LIBRARY_VISIBILITY CudaToolChain : public NVPTXToolChain {
128142
CudaToolChain(const Driver &D, const llvm::Triple &Triple,
129143
const ToolChain &HostTC, const llvm::opt::ArgList &Args,
130144
const std::string TargetID);
145+
131146
const llvm::Triple *getAuxTriple() const override {
132147
return &HostTC.getTriple();
133148
}
134149

135150
bool HasNativeLLVMSupport() const override { return false; }
136151

137152
std::string getInputFilename(const InputInfo &Input) const override;
153+
138154
llvm::opt::DerivedArgList *
139155
TranslateArgs(const llvm::opt::DerivedArgList &Args, StringRef BoundArch,
140156
Action::OffloadKind DeviceOffloadKind) const override;
141157
void
142158
addClangTargetOptions(const llvm::opt::ArgList &DriverArgs,
143159
llvm::opt::ArgStringList &CC1Args,
144160
Action::OffloadKind DeviceOffloadKind) const override;
161+
145162
llvm::DenormalMode getDefaultDenormalModeForType(
146163
const llvm::opt::ArgList &DriverArgs, const JobAction &JA,
147164
const llvm::fltSemantics *FPType = nullptr) const override;
165+
148166
void AddCudaIncludeArgs(const llvm::opt::ArgList &DriverArgs,
149167
llvm::opt::ArgStringList &CC1Args) const override;
168+
150169
void addClangWarningOptions(llvm::opt::ArgStringList &CC1Args) const override;
151170
CXXStdlibType GetCXXStdlibType(const llvm::opt::ArgList &Args) const override;
152171
void
@@ -157,6 +176,7 @@ class LLVM_LIBRARY_VISIBILITY CudaToolChain : public NVPTXToolChain {
157176
llvm::opt::ArgStringList &CC1Args) const override;
158177
void AddIAMCUIncludeArgs(const llvm::opt::ArgList &DriverArgs,
159178
llvm::opt::ArgStringList &CC1Args) const override;
179+
160180
SanitizerMask getSupportedSanitizers() const override;
161181
VersionTuple
162182
computeMSVCVersion(const Driver *D,
@@ -168,7 +188,9 @@ class LLVM_LIBRARY_VISIBILITY CudaToolChain : public NVPTXToolChain {
168188
Tool *buildAssembler() const override; // ptxas
169189
Tool *buildLinker() const override; // fatbinary (ok, not really a linker)
170190
};
191+
171192
} // end namespace toolchains
172193
} // end namespace driver
173194
} // end namespace clang
195+
174196
#endif // LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_CUDA_H

clang/lib/Driver/ToolChains/Flang.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1189,3 +1189,4 @@ void Flang::ConstructJob(Compilation &C, const JobAction &JA,
11891189
Flang::Flang(const ToolChain &TC) : Tool("flang", "flang frontend", TC) {}
11901190

11911191
Flang::~Flang() {}
1192+

clang/test/Driver/cuda-version-check.cu

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,4 +77,3 @@
7777
// RUN: %clang --target=nvptx64-nvidia-cuda -v -### -nogpulib -march=sm_60 --cuda-path=%S/Inputs/CUDA-new/usr/local/cuda 2>&1 -x c %s | \
7878
// RUN: FileCheck %s --check-prefix=VERSION
7979
// VERSION-NOT: CUDA version is newer than the latest
80-

0 commit comments

Comments
 (0)