Skip to content

Commit e7be9e2

Browse files
committed
Remove the directory condition in path per discussion in llvm#90166
1 parent 0710ef4 commit e7be9e2

File tree

4 files changed

+5
-9
lines changed

4 files changed

+5
-9
lines changed

clang/include/clang/Driver/Options.td

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1896,13 +1896,13 @@ def fprofile_selected_function_group :
18961896
MarshallingInfoInt<CodeGenOpts<"ProfileSelectedFunctionGroup">>;
18971897
def fcodegen_data_generate_EQ : Joined<["-"], "fcodegen-data-generate=">,
18981898
Group<f_Group>, Visibility<[ClangOption, CLOption]>, MetaVarName<"<path>">,
1899-
HelpText<"Emit codegen data into the object file. LLD for MachO (currently) merges them into a <path> file. If the path is a directory, it writes to <path>/default.cgdata.">;
1899+
HelpText<"Emit codegen data into the object file. LLD for MachO (currently) merges them into the specified <path>.">;
19001900
def fcodegen_data_generate : Flag<["-"], "fcodegen-data-generate">,
19011901
Group<f_Group>, Visibility<[ClangOption, CLOption]>, Alias<fcodegen_data_generate_EQ>,
19021902
HelpText<"Emit codegen data into the object file. LLD for MachO (currently) merges them into default.cgdata.">;
19031903
def fcodegen_data_use_EQ : Joined<["-"], "fcodegen-data-use=">,
19041904
Group<f_Group>, Visibility<[ClangOption, CLOption]>, MetaVarName<"<path>">,
1905-
HelpText<"Use codegen data read from a <path> file. If the path is a directory, it reads from <path>/default.cgdata.">;
1905+
HelpText<"Use codegen data read from the specified <path>.">;
19061906
def fcodegen_data_use : Flag<["-"], "fcodegen-data-use">,
19071907
Group<f_Group>, Visibility<[ClangOption, CLOption]>, Alias<fcodegen_data_use_EQ>,
19081908
HelpText<"Use codegen data read from default.cgdata to optimize the binary">;

clang/lib/Driver/ToolChains/CommonArgs.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2776,7 +2776,7 @@ void tools::addMachineOutlinerArgs(const Driver &D,
27762776
SmallString<128> Path(CodeGenDataUseArg->getNumValues() == 0
27772777
? ""
27782778
: CodeGenDataUseArg->getValue());
2779-
if (Path.empty() || llvm::sys::fs::is_directory(Path))
2779+
if (Path.empty())
27802780
llvm::sys::path::append(Path, "default.cgdata");
27812781
addArg(Twine("-codegen-data-use-path=" + Path.str()));
27822782
}

clang/lib/Driver/ToolChains/Darwin.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -484,7 +484,7 @@ void darwin::Linker::AddLinkArgs(Compilation &C, const ArgList &Args,
484484
SmallString<128> Path(CodeGenDataGenArg->getNumValues() == 0
485485
? ""
486486
: CodeGenDataGenArg->getValue());
487-
if (Path.empty() || llvm::sys::fs::is_directory(Path))
487+
if (Path.empty())
488488
llvm::sys::path::append(Path, "default.cgdata");
489489
CmdArgs.push_back(
490490
Args.MakeArgString(Twine("--codegen-data-generate-path=") + Path));
@@ -672,7 +672,7 @@ void darwin::Linker::ConstructJob(Compilation &C, const JobAction &JA,
672672
SmallString<128> Path(CodeGenDataUseArg->getNumValues() == 0
673673
? ""
674674
: CodeGenDataUseArg->getValue());
675-
if (Path.empty() || llvm::sys::fs::is_directory(Path))
675+
if (Path.empty())
676676
llvm::sys::path::append(Path, "default.cgdata");
677677
CmdArgs.push_back("-mllvm");
678678
CmdArgs.push_back(

clang/test/Driver/codegen-data.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,9 @@
1111
// Verify the codegen-data-use-path flag (with a default value) is passed to LLVM.
1212
// RUN: %clang -### -S --target=aarch64-linux-gnu -fcodegen-data-use %s 2>&1| FileCheck %s --check-prefix=USE
1313
// RUN: %clang -### -S --target=arm64-apple-darwin -fcodegen-data-use %s 2>&1| FileCheck %s --check-prefix=USE
14-
// RUN: mkdir -p %t.d/some/dir
15-
// RUN: %clang -### -S --target=aarch64-linux-gnu -fcodegen-data-use=%t.d/some/dir %s 2>&1 | FileCheck %s --check-prefix=USE-DIR
16-
// RUN: %clang -### -S --target=arm64-apple-darwin -fcodegen-data-use=%t.d/some/dir %s 2>&1 | FileCheck %s --check-prefix=USE-DIR
1714
// RUN: %clang -### -S --target=aarch64-linux-gnu -fcodegen-data-use=file %s 2>&1 | FileCheck %s --check-prefix=USE-FILE
1815
// RUN: %clang -### -S --target=arm64-apple-darwin -fcodegen-data-use=file %s 2>&1 | FileCheck %s --check-prefix=USE-FILE
1916
// USE: "-mllvm" "-codegen-data-use-path=default.cgdata"
20-
// USE-DIR: "-mllvm" "-codegen-data-use-path={{.*}}.d/some/dir{{/|\\\\}}default.cgdata"
2117
// USE-FILE: "-mllvm" "-codegen-data-use-path=file"
2218

2319
// Verify the codegen-data-generate (boolean) flag with a LTO.

0 commit comments

Comments
 (0)