[clang] [InstallAPI] Cleanup HeaderFile Interface & options handling, NFC (PR #82544)
via cfe-commits
cfe-commits at lists.llvm.org
Wed Feb 21 14:12:24 PST 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang
Author: Cyndy Ishida (cyndyishida)
<details>
<summary>Changes</summary>
---
Full diff: https://github.com/llvm/llvm-project/pull/82544.diff
2 Files Affected:
- (modified) clang/include/clang/InstallAPI/HeaderFile.h (+3)
- (modified) clang/tools/clang-installapi/Options.cpp (+4-10)
``````````diff
diff --git a/clang/include/clang/InstallAPI/HeaderFile.h b/clang/include/clang/InstallAPI/HeaderFile.h
index 6ccd944f8b01be..fc64a43b3def5c 100644
--- a/clang/include/clang/InstallAPI/HeaderFile.h
+++ b/clang/include/clang/InstallAPI/HeaderFile.h
@@ -21,6 +21,8 @@
namespace clang::installapi {
enum class HeaderType {
+ /// Unset or unknown type.
+ Unknown,
/// Represents declarations accessible to all clients.
Public,
/// Represents declarations accessible to a disclosed set of clients.
@@ -41,6 +43,7 @@ class HeaderFile {
std::optional<clang::Language> Language;
public:
+ HeaderFile() = delete;
HeaderFile(StringRef FullPath, HeaderType Type,
StringRef IncludeName = StringRef(),
std::optional<clang::Language> Language = std::nullopt)
diff --git a/clang/tools/clang-installapi/Options.cpp b/clang/tools/clang-installapi/Options.cpp
index 08d1c0e8e660fc..562a643edfcf40 100644
--- a/clang/tools/clang-installapi/Options.cpp
+++ b/clang/tools/clang-installapi/Options.cpp
@@ -22,14 +22,7 @@ namespace installapi {
bool Options::processDriverOptions(InputArgList &Args) {
// Handle inputs.
- llvm::vfs::Status Stat;
- for (const auto &Path : Args.getAllArgValues(OPT_INPUT)) {
- if (FM->getNoncachedStatValue(Path, Stat) || !Stat.exists()) {
- Diags->Report(clang::diag::err_drv_no_such_file) << Path;
- return false;
- }
- DriverOpts.FileLists.push_back(std::move(Path));
- }
+ llvm::append_range(DriverOpts.FileLists, Args.getAllArgValues(OPT_INPUT));
// Handle output.
SmallString<PATH_MAX> OutputPath;
@@ -61,8 +54,9 @@ bool Options::processDriverOptions(InputArgList &Args) {
// Capture target triples first.
if (ArgTarget) {
- for (auto *Arg : Args.filtered(OPT_target)) {
- llvm::Triple TargetTriple(Arg->getValue());
+ for (const Arg *A : Args.filtered(OPT_target)) {
+ A->claim();
+ llvm::Triple TargetTriple(A->getValue());
Target TAPITarget = Target(TargetTriple);
if ((TAPITarget.Arch == AK_unknown) ||
(TAPITarget.Platform == PLATFORM_UNKNOWN)) {
``````````
</details>
https://github.com/llvm/llvm-project/pull/82544
More information about the cfe-commits
mailing list