Skip to content

Conversation

@redstar
Copy link
Member

@redstar redstar commented Jan 6, 2025

The dependency file and the P1689 file are text files, but the
open call misses the OF_Text flag. This PR adds the flag.
Fixes regressions in test cases ClangScanDeps/modules-extern-unrelated.m
and ClangScanDeps/P1689.cppm.

The dependency file and the P1689 file are text files, but the open call misses the OF_Text flag. This PR adds the flag. Fixes regressions in test cases ClangScanDeps/modules-extern-unrelated.m and ClangScanDeps/P1689.cppm.
@llvmbot llvmbot added the clang Clang issues not falling into any other category label Jan 6, 2025
@redstar redstar requested a review from ChuanqiXu9 January 6, 2025 22:13
@redstar redstar self-assigned this Jan 6, 2025
@llvmbot
Copy link
Member

llvmbot commented Jan 6, 2025

@llvm/pr-subscribers-clang

Author: Kai Nacke (redstar)

Changes

The dependency file and the P1689 file are text files, but the
open call misses the OF_Text flag. This PR adds the flag.
Fixes regressions in test cases ClangScanDeps/modules-extern-unrelated.m
and ClangScanDeps/P1689.cppm.


Full diff: https://github.com/llvm/llvm-project/pull/121849.diff

1 Files Affected:

  • (modified) clang/tools/clang-scan-deps/ClangScanDeps.cpp (+4-4)
diff --git a/clang/tools/clang-scan-deps/ClangScanDeps.cpp b/clang/tools/clang-scan-deps/ClangScanDeps.cpp index bd36181fca3f31..709dc513be2811 100644 --- a/clang/tools/clang-scan-deps/ClangScanDeps.cpp +++ b/clang/tools/clang-scan-deps/ClangScanDeps.cpp @@ -913,7 +913,7 @@ int clang_scan_deps_main(int argc, char **argv, const llvm::ToolContext &) { return llvm::nulls(); std::error_code EC; - FileOS.emplace(OutputFileName, EC); + FileOS.emplace(OutputFileName, EC, llvm::sys::fs::OF_Text); if (EC) { llvm::errs() << "Failed to open output file '" << OutputFileName << "': " << llvm::errorCodeToError(EC) << '\n'; @@ -1003,9 +1003,9 @@ int clang_scan_deps_main(int argc, char **argv, const llvm::ToolContext &) { auto OSIter = OSs.find(MakeformatOutputPath); if (OSIter == OSs.end()) { std::error_code EC; - OSIter = - OSs.try_emplace(MakeformatOutputPath, MakeformatOutputPath, EC) - .first; + OSIter = OSs.try_emplace(MakeformatOutputPath, MakeformatOutputPath, + EC, llvm::sys::fs::OF_Text) + .first; if (EC) llvm::errs() << "Failed to open P1689 make format output file \"" << MakeformatOutputPath << "\" for " << EC.message() 
Copy link
Contributor

@abhina-sree abhina-sree left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@redstar redstar merged commit fdd7caf into llvm:main Jan 8, 2025
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clang Clang issues not falling into any other category

3 participants