Repository navigation
fix(compilerlib): run no job after a driver error - #268
Draft
SizzleUnrlsd wants to merge 7 commits into
Draft
SizzleUnrlsd wants to merge 7 commits into
SizzleUnrlsd wants to merge 7 commits into
Conversation
When Clang's driver reports an error while it builds the compilation, such as an unknown argument or a working directory it cannot move to, clang runs no job: Driver::ExecuteCompilation returns a failure. Plain file output goes through it. The other modes, which run the jobs themselves, went on: a compilation to memory, to a module or with --instrument printed the error and gave its output. They now fail with the driver's diagnostics before any job runs. Refs #264
A working directory that does not exist: the compilation fails with the driver's error and gives no IR. Refs #264
The compilation fails and writes no object. Refs #264
Another error of the driver's: the profile of -fprofile-sample-use= does not exist. Refs #264
An argument the compilation does not use: the IR comes with the driver's warning. Refs #264
Merged
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
When Clang's driver reports an error while it builds the compilation,
compilerlib::compilestill ran the jobs, and succeeded, in every mode but plain file output (#264). A compilation to memory, to a module or with--instrumentnow fails with the driver's error, before any job runs, as clang does.Closes #264
Not part of 0.13.0: that release lists #264 among its known issues, so that the effect of this change on the hosts of compilerlib can be checked before they move to it. The changelog entry comes with a new Unreleased section, once 0.13.0 is released.
Behaviour changes
compileToModule) and with--instrument, a compilation printed the error and gave its output. Plain file output already failed, through the driver'sExecuteCompilation.-fno-var-tracking-assignments, gave its IR witherror: unknown argument; it now fails, as clang does. A command written for GCC whose arguments clang accepts is not affected. See Impact.Change
fix(compilerlib): run no job after a driver error: the modes that run the jobs themselves ask the driver's diagnostics for an error once the job plan is checked, where clang'sDriver::ExecuteCompilationreturns its failure, and return the driver's diagnostics.test(compilerlib), six tests: with a working directory that does not exist, a compilation to memory, to bitcode in memory, to a module and an instrumented one fail with the driver's error, and give no IR, module or object; so does a compilation whose sample profile does not exist; a compilation with an argument it does not use succeeds, with the driver's warning.Tests
macOS arm64, LLVM 20.1.2. Each command compiles a source of one function, with
-S -emit-llvm:cc --in-memat 6eb4646cc --in-mem, this branch-working-directory <missing>-fno-such-flagunknown argument-fno-var-tracking-assignmentsunknown argument-L<dir>, unused-Wno-such-warning-Werror -L<dir>The last row is a difference this pull request does not change: compilerlib does not apply
-Werrorto the driver's warnings.With
--instrument -fno-such-flag -c,ccwrote the object and returned 0 at 6eb4646; this branch writes none and returns 1, as plain file output does.FailsACompilationToMemoryandFailsACompilationToBitcodeInMemory:successis true and the IR is returned;FailsAnInstrumentedCompilation:successis true and the object is written;FailsACompilationToAModule:successis true and the module is returned;FailsACompilationWhoseProfileIsMissing:successis true;LeavesACompilationWithADriverWarningAlonepasses, as it must before and after.ctest -j2315/315, the 309 of main plus the 6 new tests; the 221 unit tests of compilerlib pass in a shuffled order;scripts/check-license-compliance.shand the commit checker pass.CI at dcb6170
Impact
-fno-var-tracking-assignmentsin a command forgcc, the analyzer of perf(input): compile sources in parallel, each in its directory coretrace-stack-analyzer#272, built with compilerlib 8a99cf3, warnserror: unknown argumentand reports the unit: exit status 0, one function and one diagnostic. With this change, that compilation fails. The analyzer was not built with this change.successgets a failure where it got an output with an error line.