[clang] 828bf13 - [InstallAPI] Cleanup HeaderFile Interface & options handling, NFC (#82544)

via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 21 14:50:25 PST 2024


Author: Cyndy Ishida
Date: 2024-02-21T14:50:21-08:00
New Revision: 828bf134d732a29146d1dd666548c75b49012b08

URL: https://github.com/llvm/llvm-project/commit/828bf134d732a29146d1dd666548c75b49012b08
DIFF: https://github.com/llvm/llvm-project/commit/828bf134d732a29146d1dd666548c75b49012b08.diff

LOG: [InstallAPI] Cleanup HeaderFile Interface & options handling, NFC (#82544)

Added: 
    

Modified: 
    clang/include/clang/InstallAPI/HeaderFile.h
    clang/tools/clang-installapi/Options.cpp

Removed: 
    


################################################################################
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