Skip to content

Commit 51859f9

Browse files
authored
Fixup InstallAPI post merge (#8434)
AM merge introduced some test failures.
1 parent c137e48 commit 51859f9

File tree

2 files changed

+14
-9
lines changed

2 files changed

+14
-9
lines changed

clang/lib/Basic/DiagnosticIDs.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ struct StaticDiagInfoDescriptionStringTable {
4949
#include "clang/Basic/DiagnosticSemaKinds.inc"
5050
#include "clang/Basic/DiagnosticAnalysisKinds.inc"
5151
#include "clang/Basic/DiagnosticRefactoringKinds.inc"
52-
#include "clang/Basic/DiagnosticCASKinds.inc"
5352
#include "clang/Basic/DiagnosticInstallAPIKinds.inc"
53+
#include "clang/Basic/DiagnosticCASKinds.inc"
5454
// clang-format on
5555
#undef DIAG
5656
};
@@ -72,8 +72,8 @@ const StaticDiagInfoDescriptionStringTable StaticDiagInfoDescriptions = {
7272
#include "clang/Basic/DiagnosticSemaKinds.inc"
7373
#include "clang/Basic/DiagnosticAnalysisKinds.inc"
7474
#include "clang/Basic/DiagnosticRefactoringKinds.inc"
75-
#include "clang/Basic/DiagnosticCASKinds.inc"
7675
#include "clang/Basic/DiagnosticInstallAPIKinds.inc"
76+
#include "clang/Basic/DiagnosticCASKinds.inc"
7777
// clang-format on
7878
#undef DIAG
7979
};
@@ -99,8 +99,8 @@ const uint32_t StaticDiagInfoDescriptionOffsets[] = {
9999
#include "clang/Basic/DiagnosticSemaKinds.inc"
100100
#include "clang/Basic/DiagnosticAnalysisKinds.inc"
101101
#include "clang/Basic/DiagnosticRefactoringKinds.inc"
102-
#include "clang/Basic/DiagnosticCASKinds.inc"
103102
#include "clang/Basic/DiagnosticInstallAPIKinds.inc"
103+
#include "clang/Basic/DiagnosticCASKinds.inc"
104104
// clang-format on
105105
#undef DIAG
106106
};
@@ -179,8 +179,8 @@ VALIDATE_DIAG_SIZE(CROSSTU)
179179
VALIDATE_DIAG_SIZE(SEMA)
180180
VALIDATE_DIAG_SIZE(ANALYSIS)
181181
VALIDATE_DIAG_SIZE(REFACTORING)
182-
VALIDATE_DIAG_SIZE(CAS)
183182
VALIDATE_DIAG_SIZE(INSTALLAPI)
183+
VALIDATE_DIAG_SIZE(CAS)
184184
#undef VALIDATE_DIAG_SIZE
185185
#undef STRINGIFY_NAME
186186

@@ -212,8 +212,8 @@ const StaticDiagInfoRec StaticDiagInfo[] = {
212212
#include "clang/Basic/DiagnosticSemaKinds.inc"
213213
#include "clang/Basic/DiagnosticAnalysisKinds.inc"
214214
#include "clang/Basic/DiagnosticRefactoringKinds.inc"
215-
#include "clang/Basic/DiagnosticCASKinds.inc"
216215
#include "clang/Basic/DiagnosticInstallAPIKinds.inc"
216+
#include "clang/Basic/DiagnosticCASKinds.inc"
217217
// clang-format on
218218
#undef DIAG
219219
};
@@ -256,8 +256,8 @@ CATEGORY(CROSSTU, COMMENT)
256256
CATEGORY(SEMA, CROSSTU)
257257
CATEGORY(ANALYSIS, SEMA)
258258
CATEGORY(REFACTORING, ANALYSIS)
259-
CATEGORY(CAS, REFACTORING)
260259
CATEGORY(INSTALLAPI, REFACTORING)
260+
CATEGORY(CAS, INSTALLAPI)
261261
#undef CATEGORY
262262

263263
// Avoid out of bounds reads.

clang/tools/clang-installapi/ClangInstallAPI.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,10 @@ static bool run(ArrayRef<const char *> Args, const char *ProgName) {
126126
}
127127
}
128128

129+
if (Ctx.Verifier->getState() == DylibVerifier::Result::Invalid)
130+
return EXIT_FAILURE;
131+
132+
// After symbols have been collected, prepare to write output.
129133
llvm::vfs::OnDiskOutputBackend Backend;
130134
std::optional<llvm::vfs::OutputFile> Out = llvm::expectedToOptional(
131135
Backend.createFile(Ctx.OutputLoc, llvm::vfs::OutputConfig()
@@ -146,14 +150,15 @@ static bool run(ArrayRef<const char *> Args, const char *ProgName) {
146150

147151
// Write output file and perform CI cleanup.
148152
if (auto Err = TextAPIWriter::writeToStream(Out->getOS(), IF, Ctx.FT)) {
149-
Diag->Report(diag::err_cannot_open_file) << Ctx.OutputLoc;
150-
CI->clearOutputFiles(/*EraseFiles=*/true);
153+
Diag->Report(diag::err_cannot_write_file)
154+
<< Ctx.OutputLoc << std::move(Err);
151155
if (auto Err = Out->discard())
152156
llvm::consumeError(std::move(Err));
153157
return EXIT_FAILURE;
154158
}
155159
if (auto Err = Out->keep()) {
156-
Diag->Report(diag::err_cannot_open_file) << Ctx.OutputLoc << std::move(Err);
160+
Diag->Report(diag::err_cannot_write_file)
161+
<< Ctx.OutputLoc << std::move(Err);
157162
return EXIT_FAILURE;
158163
}
159164
return EXIT_SUCCESS;

0 commit comments

Comments
 (0)