Skip to content

Commit 907d3d5

Browse files
committed
clang-format
1 parent cf4cbcb commit 907d3d5

File tree

9 files changed

+36
-39
lines changed

9 files changed

+36
-39
lines changed

clang/include/clang/Driver/Driver.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -403,10 +403,10 @@ class Driver {
403403
SmallString<128> &CrashDiagDir);
404404

405405
public:
406-
407406
/// Takes the path to a binary that's either in bin/ or lib/ and returns
408407
/// the path to clang's resource directory.
409-
/// Do not pass argv[0] as argument, llvm-lit does not adjust argv[0] to the changing cwd. Use llvm::sys::fs::getMainExecutable instead.
408+
/// Do not pass argv[0] as argument, llvm-lit does not adjust argv[0] to the
409+
/// changing cwd. Use llvm::sys::fs::getMainExecutable instead.
410410
static std::string GetResourcesPath(StringRef BinaryPath);
411411

412412
Driver(StringRef ClangExecutable, StringRef TargetTriple,

clang/include/clang/Driver/ToolChain.h

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -542,11 +542,9 @@ class ToolChain {
542542
// Returns Triple without the OSs version.
543543
llvm::Triple getTripleWithoutOSVersion() const;
544544

545-
546-
/// Returns the target-specific path for Flang's intrinsic modules in the resource directory if it exists.
547-
std::optional<std::string> getDefaultIntrinsicModuleDir( ) const;
548-
549-
545+
/// Returns the target-specific path for Flang's intrinsic modules in the
546+
/// resource directory if it exists.
547+
std::optional<std::string> getDefaultIntrinsicModuleDir() const;
550548

551549
// Returns the target specific runtime path if it exists.
552550
std::optional<std::string> getRuntimePath() const;

clang/lib/Driver/Driver.cpp

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6537,13 +6537,14 @@ std::string Driver::GetFilePath(StringRef Name, const ToolChain &TC) const {
65376537
if (llvm::sys::fs::exists(Twine(P)))
65386538
return std::string(P);
65396539

6540-
if (IsFlangMode()) {
6541-
if (std::optional<std::string> IntrPath = TC.getDefaultIntrinsicModuleDir ()) {
6542-
SmallString<128> P(*IntrPath);
6543-
llvm::sys::path::append(P, Name);
6544-
if (llvm::sys::fs::exists(Twine(P)))
6545-
return std::string(P);
6546-
}
6540+
if (IsFlangMode()) {
6541+
if (std::optional<std::string> IntrPath =
6542+
TC.getDefaultIntrinsicModuleDir()) {
6543+
SmallString<128> P(*IntrPath);
6544+
llvm::sys::path::append(P, Name);
6545+
if (llvm::sys::fs::exists(Twine(P)))
6546+
return std::string(P);
6547+
}
65476548
}
65486549

65496550
SmallString<128> D(Dir);

clang/lib/Driver/ToolChain.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -983,10 +983,10 @@ ToolChain::getTargetSubDirPath(StringRef BaseDir) const {
983983
return {};
984984
}
985985

986-
std::optional< std::string> ToolChain::getDefaultIntrinsicModuleDir( ) const {
986+
std::optional<std::string> ToolChain::getDefaultIntrinsicModuleDir() const {
987987
SmallString<128> P(D.ResourceDir);
988988
llvm::sys::path::append(P, "finclude");
989-
return getTargetSubDirPath(P );
989+
return getTargetSubDirPath(P);
990990
}
991991

992992
std::optional<std::string> ToolChain::getRuntimePath() const {

clang/lib/Driver/ToolChains/Flang.cpp

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -957,16 +957,13 @@ void Flang::ConstructJob(Compilation &C, const JobAction &JA,
957957
CmdArgs.push_back("-resource-dir");
958958
CmdArgs.push_back(D.ResourceDir.c_str());
959959

960-
961-
962-
// Default intrinsic module dirs must be added after any user-provided -fintrinsic-modules-path to have lower precedence
963-
if ( auto IntrModPath = TC.getDefaultIntrinsicModuleDir()) {
960+
// Default intrinsic module dirs must be added after any user-provided
961+
// -fintrinsic-modules-path to have lower precedence
962+
if (auto IntrModPath = TC.getDefaultIntrinsicModuleDir()) {
964963
CmdArgs.push_back("-fintrinsic-modules-path");
965-
CmdArgs.push_back( Args.MakeArgString(*IntrModPath));
964+
CmdArgs.push_back(Args.MakeArgString(*IntrModPath));
966965
}
967966

968-
969-
970967
// Offloading related options
971968
addOffloadOptions(C, Inputs, JA, Args, CmdArgs);
972969

flang/include/flang/Frontend/CompilerInvocation.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,8 @@ class CompilerInvocation : public CompilerInvocationBase {
9292
// intrinsic of iso_fortran_env.
9393
std::string allCompilerInvocOpts;
9494

95-
/// Location of the resource directory containing files specific to this instance/version of Flang.
95+
/// Location of the resource directory containing files specific to this
96+
/// instance/version of Flang.
9697
std::string resourceDir;
9798

9899
/// Semantic options
@@ -183,8 +184,6 @@ class CompilerInvocation : public CompilerInvocationBase {
183184
std::string &getResourceDir() { return resourceDir; }
184185
const std::string &getResourceDir() const { return resourceDir; }
185186

186-
187-
188187
std::string &getModuleDir() { return moduleDir; }
189188
const std::string &getModuleDir() const { return moduleDir; }
190189

flang/lib/Frontend/CompilerInvocation.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1500,10 +1500,12 @@ bool CompilerInvocation::createFromArgs(
15001500
}
15011501

15021502
// User-specified or default resource dir
1503-
if (const llvm::opt::Arg *a = args.getLastArg(clang::driver::options::OPT_resource_dir))
1504-
invoc.resourceDir = a->getValue();
1505-
else
1506-
invoc.resourceDir = clang::driver::Driver::GetResourcesPath(llvm::sys::fs::getMainExecutable(argv0, nullptr));
1503+
if (const llvm::opt::Arg *a =
1504+
args.getLastArg(clang::driver::options::OPT_resource_dir))
1505+
invoc.resourceDir = a->getValue();
1506+
else
1507+
invoc.resourceDir = clang::driver::Driver::GetResourcesPath(
1508+
llvm::sys::fs::getMainExecutable(argv0, nullptr));
15071509

15081510
// -flang-experimental-hlfir
15091511
if (args.hasArg(clang::driver::options::OPT_flang_experimental_hlfir) ||
@@ -1755,7 +1757,6 @@ void CompilerInvocation::setFortranOpts() {
17551757
preprocessorOptions.searchDirectoriesFromIntrModPath.begin(),
17561758
preprocessorOptions.searchDirectoriesFromIntrModPath.end());
17571759

1758-
17591760
// Add the ordered list of -fintrinsic-modules-path
17601761
fortranOptions.intrinsicModuleDirectories.insert(
17611762
fortranOptions.intrinsicModuleDirectories.end(),

flang/lib/Optimizer/CodeGen/CodeGen.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1364,7 +1364,10 @@ getTypeDescriptor(ModOpTy mod, mlir::ConversionPatternRewriter &rewriter,
13641364
return rewriter.create<mlir::LLVM::ZeroOp>(loc, llvmPtrTy);
13651365

13661366
if (!options.skipExternalRttiDefinition)
1367-
fir::emitFatalError(loc, llvm::Twine( "runtime derived type info descriptor of '") + name + "' was not generated and skipExternalRttiDefinition and ignoreMissingTypeDescriptors options are not set");
1367+
fir::emitFatalError(
1368+
loc, llvm::Twine("runtime derived type info descriptor of '") + name +
1369+
"' was not generated and skipExternalRttiDefinition and "
1370+
"ignoreMissingTypeDescriptors options are not set");
13681371

13691372
// Rtti for a derived type defined in another compilation unit and for which
13701373
// rtti was not defined in lowering because of the skipExternalRttiDefinition

flang/tools/bbc/bbc.cpp

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,10 @@ static llvm::cl::alias
9898
llvm::cl::desc("intrinsic module directory"),
9999
llvm::cl::aliasopt(intrinsicIncludeDirs));
100100

101-
102-
static llvm::cl::alias intrinsicModulePath("fintrinsic-modules-path", llvm::cl::desc("intrinsic module search paths"), llvm::cl::aliasopt(intrinsicIncludeDirs));
103-
101+
static llvm::cl::alias
102+
intrinsicModulePath("fintrinsic-modules-path",
103+
llvm::cl::desc("intrinsic module search paths"),
104+
llvm::cl::aliasopt(intrinsicIncludeDirs));
104105

105106
static llvm::cl::opt<std::string>
106107
moduleDir("module", llvm::cl::desc("module output directory (default .)"),
@@ -572,12 +573,9 @@ int main(int argc, char **argv) {
572573
ProgramName programPrefix;
573574
programPrefix = argv[0] + ": "s;
574575

575-
576-
if (includeDirs.size() == 0)
576+
if (includeDirs.size() == 0)
577577
includeDirs.push_back(".");
578578

579-
580-
581579
Fortran::parser::Options options;
582580
options.predefinitions.emplace_back("__flang__"s, "1"s);
583581
options.predefinitions.emplace_back("__flang_major__"s,

0 commit comments

Comments
 (0)