Skip to content
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

Fix the diagnostic verifier, plus a few other fixes. #598

Merged
merged 7 commits into from
Jun 14, 2021
26 changes: 19 additions & 7 deletions clang/include/clang/3C/3C.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ struct _3COptions {

bool AddCheckedRegions;

bool DisableCCTypeChecker;
bool EnableCCTypeChecker;

bool WarnRootCause;

Expand All @@ -68,11 +68,6 @@ struct _3COptions {
bool ForceItypes;
#endif

// Currently applies only to the rewriting phase (because it is the only phase
// that generates diagnostics, except for the declaration merging diagnostics
// that are currently fatal) and uses the default "expected" prefix.
bool VerifyDiagnosticOutput;

bool DumpUnwritableChanges;
bool AllowUnwritableChanges;

Expand Down Expand Up @@ -104,6 +99,8 @@ class _3CInterface {
const std::vector<std::string> &SourceFileList,
clang::tooling::CompilationDatabase *CompDB);

~_3CInterface();

// Call clang to provide the data
bool parseASTs();

Expand Down Expand Up @@ -141,10 +138,25 @@ class _3CInterface {
// Dump all stats related to performance.
bool dumpStats();

// Determine the exit code that the `3c` tool should exit with after the last
// 3C stage, considering diagnostic verification. Must be called exactly once
// before the _3CInterface is destructed (unless construction failed).
int determineExitCode();

private:
_3CInterface(const struct _3COptions &CCopt,
const std::vector<std::string> &SourceFileList,
clang::tooling::CompilationDatabase *CompDB, bool &Failed);
clang::tooling::CompilationDatabase *CompDB);

bool ConstructionFailed = false;
bool DeterminedExitCode = false;

bool HadNonDiagnosticError = false;

// Determine whether 3C can continue to the next stage of processing. Checks
// HadNonDiagnosticError and error diagnostics but ignores diagnostic
// verification.
bool isSuccessfulSoFar();

// saved ASTs
std::vector< std::unique_ptr< ASTUnit >> ASTs;
Expand Down
Loading