[llvm] llvm-profdata: Resolve tilde for weighted input filenames (PR #146206)
via llvm-commits
llvm-commits at lists.llvm.org
Sat Jun 28 03:20:22 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-pgo
Author: Yi Kong (kongy)
<details>
<summary>Changes</summary>
Since the weighted input argument is in the format of <weight>,<filename>, shell does not automatically expand the tilde in the file name.
---
Full diff: https://github.com/llvm/llvm-project/pull/146206.diff
1 Files Affected:
- (modified) llvm/tools/llvm-profdata/llvm-profdata.cpp (+4-1)
``````````diff
diff --git a/llvm/tools/llvm-profdata/llvm-profdata.cpp b/llvm/tools/llvm-profdata/llvm-profdata.cpp
index a7cbd4bfc8387..45eac90aef935 100644
--- a/llvm/tools/llvm-profdata/llvm-profdata.cpp
+++ b/llvm/tools/llvm-profdata/llvm-profdata.cpp
@@ -1705,7 +1705,10 @@ static WeightedFile parseWeightedFile(const StringRef &WeightedFilename) {
if (WeightStr.getAsInteger(10, Weight) || Weight < 1)
exitWithError("input weight must be a positive integer");
- return {std::string(FileName), Weight};
+ llvm::SmallString<128> ResolvedFileName;
+ llvm::sys::fs::expand_tilde(FileName, ResolvedFileName);
+
+ return {std::string(ResolvedFileName), Weight};
}
static void addWeightedInput(WeightedFileVector &WNI, const WeightedFile &WF) {
``````````
</details>
https://github.com/llvm/llvm-project/pull/146206
More information about the llvm-commits
mailing list