arichardson added a comment.

In D97462#2678889 <https://reviews.llvm.org/D97462#2678889>, @jansvoboda11 
wrote:

> In D97462#2677130 <https://reviews.llvm.org/D97462#2677130>, @arichardson 
> wrote:
>
>> I just merged this commit into our CHERI fork and noticed some failing tests 
>> due to round tripping:
>> We add some additional CodeGenOptions and LangOptions, but are not including 
>> those in the generated command line.
>>
>> For example, I added an additional `std::string CHERIStatsFile;` to 
>> `CodeGenOptions`. This is set inside `bool 
>> CompilerInvocation::ParseCodeGenArgs` using `Opts.CHERIStatsFile = 
>> Args.getLastArgValue(OPT_cheri_stats_file).str();`.
>> I haven't added logic to round trip this flag (yet). If CC1 argument round 
>> tripping is enabled, the flag is stripped and the output goes to stderr 
>> instead of the defined file, causing some tests to fail.
>>
>> Unfortunately this is not caught by any assertions, so I worry that there 
>> are other arguments that might be silently removed after this commit. Are 
>> there any open reviews/plans to check CodeGenOptions/etc, for equality after 
>> round-tripping?
>
> We currently don't have the infrastructure to compare `CompilerInvocation` 
> instances directly. Instead we rely on good test coverage of command line 
> options: if the round-tripped `CompilerInvocation` doesn't contain the 
> option, tests will fail. You can then check the generated command lines by 
> passing `-Rround-trip-cc1-args` to the failing CC1 invocation.
>
> There was an attempt to generate `operator==` for `CompilerInvocation` and 
> assert when the round-tripped instance isn't equal to the original, as you 
> suggest. This is the patch that started by moving members to definition 
> databases, but it got reverted: D86290 <https://reviews.llvm.org/D86290>.

Thanks, that would have caught the problem. Fortunately we don't add too many 
options, so I'll just go through them all and check that they are also handled 
in the Generate* functions.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D97462/new/

https://reviews.llvm.org/D97462

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to