Skip to content

[InstallAPI] Cleanup HeaderFile Interface & options handling, NFC #82544

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions clang/include/clang/InstallAPI/HeaderFile.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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)
Expand Down
14 changes: 4 additions & 10 deletions clang/tools/clang-installapi/Options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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)) {
Expand Down