[clang] [InstallAPI] Cleanup HeaderFile Interface & options handling, NFC (PR #82544)
Cyndy Ishida via cfe-commits
cfe-commits at lists.llvm.org
Wed Feb 21 14:11:51 PST 2024
https://github.com/cyndyishida created https://github.com/llvm/llvm-project/pull/82544
None
>From 1a5a7904364af0ab74b43f41fba819752074cd6f Mon Sep 17 00:00:00 2001
From: Cyndy Ishida <cyndy_ishida at apple.com>
Date: Wed, 21 Feb 2024 14:09:26 -0800
Subject: [PATCH] [InstallAPI] Cleanup HeaderFile Interface & options handling,
NFC
---
clang/include/clang/InstallAPI/HeaderFile.h | 3 +++
clang/tools/clang-installapi/Options.cpp | 14 ++++----------
2 files changed, 7 insertions(+), 10 deletions(-)
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)) {
More information about the cfe-commits
mailing list