[clang] 0e06ddf - Revert "[APINotes] Upstream APINotesOptions"

Johannes Doerfert via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 1 11:34:25 PDT 2023


Author: Johannes Doerfert
Date: 2023-11-01T11:33:25-07:00
New Revision: 0e06ddf0f6896cfd817a1b97a43b78331e0b1d66

URL: https://github.com/llvm/llvm-project/commit/0e06ddf0f6896cfd817a1b97a43b78331e0b1d66
DIFF: https://github.com/llvm/llvm-project/commit/0e06ddf0f6896cfd817a1b97a43b78331e0b1d66.diff

LOG: Revert "[APINotes] Upstream APINotesOptions"

This reverts commit c0a1857928c557400af0ed53d198cc9f3f185f9a.

A shared_ptr assertion always triggers causes all bots to fail.

Added: 
    

Modified: 
    clang/include/clang/Driver/Options.td
    clang/include/clang/Frontend/CompilerInvocation.h
    clang/lib/Frontend/CompilerInvocation.cpp

Removed: 
    clang/include/clang/APINotes/APINotesOptions.h


################################################################################
diff  --git a/clang/include/clang/APINotes/APINotesOptions.h b/clang/include/clang/APINotes/APINotesOptions.h
deleted file mode 100644
index e8b8a9ed2261fa1..000000000000000
--- a/clang/include/clang/APINotes/APINotesOptions.h
+++ /dev/null
@@ -1,34 +0,0 @@
-//===--- APINotesOptions.h --------------------------------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_CLANG_APINOTES_APINOTESOPTIONS_H
-#define LLVM_CLANG_APINOTES_APINOTESOPTIONS_H
-
-#include "llvm/Support/VersionTuple.h"
-#include <string>
-#include <vector>
-
-namespace clang {
-
-/// Tracks various options which control how API notes are found and handled.
-class APINotesOptions {
-public:
-  /// The Swift version which should be used for API notes.
-  llvm::VersionTuple SwiftVersion;
-
-  /// The set of search paths where we API notes can be found for particular
-  /// modules.
-  ///
-  /// The API notes in this directory are stored as <ModuleName>.apinotes, and
-  /// are only applied when building the module <ModuleName>.
-  std::vector<std::string> ModuleSearchPaths;
-};
-
-} // namespace clang
-
-#endif // LLVM_CLANG_APINOTES_APINOTESOPTIONS_H

diff  --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td
index fcf6a4b2ccb2369..b1229b2f4562379 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -1733,10 +1733,6 @@ def fswift_async_fp_EQ : Joined<["-"], "fswift-async-fp=">,
     NormalizedValuesScope<"CodeGenOptions::SwiftAsyncFramePointerKind">,
     NormalizedValues<["Auto", "Always", "Never"]>,
     MarshallingInfoEnum<CodeGenOpts<"SwiftAsyncFramePointer">, "Always">;
-def fapinotes_swift_version : Joined<["-"], "fapinotes-swift-version=">,
-  Group<f_clang_Group>, Visibility<[ClangOption, CC1Option]>,
-  MetaVarName<"<version>">,
-  HelpText<"Specify the Swift version to use when filtering API notes">;
 
 defm addrsig : BoolFOption<"addrsig",
   CodeGenOpts<"Addrsig">, DefaultFalse,
@@ -4133,9 +4129,6 @@ def ibuiltininc : Flag<["-"], "ibuiltininc">, Group<clang_i_Group>,
 def index_header_map : Flag<["-"], "index-header-map">,
   Visibility<[ClangOption, CC1Option]>,
   HelpText<"Make the next included directory (-I or -F) an indexer header map">;
-def iapinotes_modules : JoinedOrSeparate<["-"], "iapinotes-modules">, Group<clang_i_Group>,
-  Visibility<[ClangOption, CC1Option]>,
-  HelpText<"Add directory to the API notes search path referenced by module name">, MetaVarName<"<directory>">;
 def idirafter : JoinedOrSeparate<["-"], "idirafter">, Group<clang_i_Group>,
   Visibility<[ClangOption, CC1Option]>,
   HelpText<"Add directory to AFTER include search path">;

diff  --git a/clang/include/clang/Frontend/CompilerInvocation.h b/clang/include/clang/Frontend/CompilerInvocation.h
index d9c757a8a156861..45e263e7bc76822 100644
--- a/clang/include/clang/Frontend/CompilerInvocation.h
+++ b/clang/include/clang/Frontend/CompilerInvocation.h
@@ -9,7 +9,6 @@
 #ifndef LLVM_CLANG_FRONTEND_COMPILERINVOCATION_H
 #define LLVM_CLANG_FRONTEND_COMPILERINVOCATION_H
 
-#include "clang/APINotes/APINotesOptions.h"
 #include "clang/Basic/CodeGenOptions.h"
 #include "clang/Basic/DiagnosticOptions.h"
 #include "clang/Basic/FileSystemOptions.h"
@@ -93,9 +92,6 @@ class CompilerInvocationBase {
 
   std::shared_ptr<MigratorOptions> MigratorOpts;
 
-  /// Options controlling API notes.
-  std::shared_ptr<APINotesOptions> APINotesOpts;
-
   /// Options controlling IRgen and the backend.
   std::shared_ptr<CodeGenOptions> CodeGenOpts;
 
@@ -135,7 +131,6 @@ class CompilerInvocationBase {
   const PreprocessorOptions &getPreprocessorOpts() const { return *PPOpts; }
   const AnalyzerOptions &getAnalyzerOpts() const { return *AnalyzerOpts; }
   const MigratorOptions &getMigratorOpts() const { return *MigratorOpts; }
-  const APINotesOptions &getAPINotesOpts() const { return *APINotesOpts; }
   const CodeGenOptions &getCodeGenOpts() const { return *CodeGenOpts; }
   const FileSystemOptions &getFileSystemOpts() const { return *FSOpts; }
   const FrontendOptions &getFrontendOpts() const { return *FrontendOpts; }
@@ -247,7 +242,6 @@ class CompilerInvocation : public CompilerInvocationBase {
   PreprocessorOptions &getPreprocessorOpts() { return *PPOpts; }
   AnalyzerOptions &getAnalyzerOpts() { return *AnalyzerOpts; }
   MigratorOptions &getMigratorOpts() { return *MigratorOpts; }
-  APINotesOptions &getAPINotesOpts() { return *APINotesOpts; }
   CodeGenOptions &getCodeGenOpts() { return *CodeGenOpts; }
   FileSystemOptions &getFileSystemOpts() { return *FSOpts; }
   FrontendOptions &getFrontendOpts() { return *FrontendOpts; }

diff  --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp
index 140feb0ff9e79ae..fd6c250efeda2a8 100644
--- a/clang/lib/Frontend/CompilerInvocation.cpp
+++ b/clang/lib/Frontend/CompilerInvocation.cpp
@@ -3261,17 +3261,6 @@ static bool ParseHeaderSearchArgs(HeaderSearchOptions &Opts, ArgList &Args,
   return Diags.getNumErrors() == NumErrorsBefore;
 }
 
-static void ParseAPINotesArgs(APINotesOptions &Opts, ArgList &Args,
-                              DiagnosticsEngine &diags) {
-  if (const Arg *A = Args.getLastArg(OPT_fapinotes_swift_version)) {
-    if (Opts.SwiftVersion.tryParse(A->getValue()))
-      diags.Report(diag::err_drv_invalid_value)
-          << A->getAsString(Args) << A->getValue();
-  }
-  for (const Arg *A : Args.filtered(OPT_iapinotes_modules))
-    Opts.ModuleSearchPaths.push_back(A->getValue());
-}
-
 /// Check if input file kind and language standard are compatible.
 static bool IsInputCompatibleWithStandard(InputKind IK,
                                           const LangStandard &S) {
@@ -4549,7 +4538,6 @@ bool CompilerInvocation::CreateFromArgsImpl(
   llvm::Triple T(Res.getTargetOpts().Triple);
   ParseHeaderSearchArgs(Res.getHeaderSearchOpts(), Args, Diags,
                         Res.getFileSystemOpts().WorkingDir);
-  ParseAPINotesArgs(Res.getAPINotesOpts(), Args, Diags);
 
   ParseLangArgs(LangOpts, Args, DashX, T, Res.getPreprocessorOpts().Includes,
                 Diags);


        


More information about the cfe-commits mailing list