-
Notifications
You must be signed in to change notification settings - Fork 10.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[InstallAPI] Add installapi specific options & diagnostics (#85100)
* A lot of `tapi installapi` options are already shared with clang, but not all. This patch handles installapi-specific options by filtering for them in the initial argv input, then passing the rest to the clang driver. * Installapi not only generates a text file but also reports to library developers when there are inconsistencies between an interface and its implementation. To allow this, add support for reporting installapi diagnostics. This will be leveraged in the verifier service.
- Loading branch information
1 parent
f694f63
commit c51095f
Showing
17 changed files
with
347 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
//===--- DiagnosticInstallAPI.h - Diagnostics for InstallAPI-----*- 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_BASIC_DIAGNOSTICINSTALLAPI_H | ||
#define LLVM_CLANG_BASIC_DIAGNOSTICINSTALLAPI_H | ||
|
||
#include "clang/Basic/Diagnostic.h" | ||
namespace clang { | ||
namespace diag { | ||
enum { | ||
#define DIAG(ENUM, FLAGS, DEFAULT_MAPPING, DESC, GROUP, SFINAE, NOWERROR, \ | ||
SHOWINSYSHEADER, SHOWINSYSMACRO, DEFERRABLE, CATEGORY) \ | ||
ENUM, | ||
#define INSTALLAPISTART | ||
#include "clang/Basic/DiagnosticInstallAPIKinds.inc" | ||
#undef DIAG | ||
NUM_BUILTIN_INSTALLAPI_DIAGNOSTICS | ||
}; | ||
} // namespace diag | ||
} // namespace clang | ||
#endif // LLVM_CLANG_BASIC_DIAGNOSTICINSTALLAPI_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
//==--- DiagnosticInstallAPIKinds.td - installapi diagnostics -------------===// | ||
// | ||
// 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 | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
//===----------------------------------------------------------------------===// | ||
// InstallAPI Diagnostics | ||
//===----------------------------------------------------------------------===// | ||
|
||
let Component = "InstallAPI" in { | ||
let CategoryName = "Command line" in { | ||
def err_cannot_write_file : Error<"cannot write file '%0': %1">; | ||
def err_no_install_name : Error<"no install name specified: add -install_name <path>">; | ||
def err_no_output_file: Error<"no output file specified">; | ||
} // end of command line category. | ||
|
||
} // end of InstallAPI component |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
//===- InstallAPI/DylibVerifier.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_INSTALLAPI_DYLIBVERIFIER_H | ||
#define LLVM_CLANG_INSTALLAPI_DYLIBVERIFIER_H | ||
|
||
#include "llvm/TextAPI/Target.h" | ||
|
||
namespace clang { | ||
namespace installapi { | ||
|
||
/// A list of InstallAPI verification modes. | ||
enum class VerificationMode { | ||
Invalid, | ||
ErrorsOnly, | ||
ErrorsAndWarnings, | ||
Pedantic, | ||
}; | ||
|
||
} // namespace installapi | ||
} // namespace clang | ||
#endif // LLVM_CLANG_INSTALLAPI_DYLIBVERIFIER_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
//===--- InstallAPIDiagnostic.h - Diagnostics for InstallAPI ----*- 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_INSTALLAPI_INSTALLAPIDIAGNOSTIC_H | ||
#define LLVM_CLANG_INSTALLAPI_INSTALLAPIDIAGNOSTIC_H | ||
|
||
#include "clang/Basic/DiagnosticInstallAPI.h" | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,9 @@ | ||
/// Check non-darwin triple is rejected. | ||
// RUN: not clang-installapi -target x86_64-unknown-unknown %s 2> %t | ||
// RUN: not clang-installapi -target x86_64-unknown-unknown %s -o tmp.tbd 2> %t | ||
// RUN: FileCheck --check-prefix INVALID_INSTALLAPI -input-file %t %s | ||
// INVALID_INSTALLAPI: error: unsupported option 'installapi' for target 'x86_64-unknown-unknown' | ||
|
||
/// Check that missing install_name is reported. | ||
// RUN: not clang-installapi -target x86_64-apple-ios-simulator %s -o tmp.tbd 2> %t | ||
// RUN: FileCheck --check-prefix INVALID_INSTALL_NAME -input-file %t %s | ||
// INVALID_INSTALL_NAME: error: no install name specified: add -install_name <path> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
//===--- InstallAPIOpts.td ------------------------------------------------===// | ||
// | ||
// 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 | ||
// | ||
//===----------------------------------------------------------------------===// | ||
// | ||
// This file defines the specific options for InstallAPI. | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
// Include the common option parsing interfaces. | ||
include "llvm/Option/OptParser.td" | ||
|
||
|
||
///////// | ||
// Options | ||
|
||
// TextAPI options. | ||
def filetype : Joined<["--"], "filetype=">, | ||
HelpText<"Specify the output file type (tbd-v4 or tbd-v5)">; | ||
|
||
// Verification options. | ||
def verify_against : Separate<["-"], "verify-against">, | ||
HelpText<"Verify the specified dynamic library/framework against the headers">; | ||
def verify_against_EQ : Joined<["--"], "verify-against=">, Alias<verify_against>; | ||
def verify_mode_EQ : Joined<["--"], "verify-mode=">, | ||
HelpText<"Specify the severity and extend of the validation. Valid modes are ErrorsOnly, ErrorsAndWarnings, and Pedantic.">; | ||
def demangle : Flag<["--", "-"], "demangle">, | ||
HelpText<"Demangle symbols when printing warnings and errors">; |
Oops, something went wrong.