History log of /llvm-project/clang/unittests/Frontend/CompilerInvocationTest.cpp (Results 26 – 50 of 57)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 8e3e148c 08-Jan-2021 Jan Svoboda <jan_svoboda@apple.com>

Revert "[clang][cli] Port DiagnosticOpts to new option parsing system"

This reverts commit 8e3230ff


# 8e3230ff 22-Dec-2020 Jan Svoboda <jan_svoboda@apple.com>

[clang][cli] Port DiagnosticOpts to new option parsing system

This patch introduces additional infrastructure necessary to accommodate DiagnosticOptions.

DiagnosticOptions are unique in that they a

[clang][cli] Port DiagnosticOpts to new option parsing system

This patch introduces additional infrastructure necessary to accommodate DiagnosticOptions.

DiagnosticOptions are unique in that they are parsed by the same function in cc1 AND in the Clang driver. The call to the parsing function from the driver occurs early on in the compilation process, where no proper DiagnosticEngine exists, because the diagnostic options (passed through command line) are not known yet.

To preserve the current behavior, we need to be able to selectively parse:
* all options (for -cc1),
* only diagnostic options (for driver).

This patch achieves that in the following way:
* new MacroPrefix field is added to the Option TableGen class,
* new IsDiag TableGen mixin sets MacroPrefix to "DIAG_",
* TableGen backend serializes option records into a macro with the prefix,
* CompilerInvocation parse/generate methods define the [DIAG_]OPTION_WITH_MARSHALLING macros to handle diagnostic options separately.

Depends on D93700, D93701 & D93702.

Reviewed By: dexonsmith

Differential Revision: https://reviews.llvm.org/D84673

show more ...


# 33f90f38 22-Dec-2020 Jan Svoboda <jan_svoboda@apple.com>

[clang][cli] Report the actual argument parsing result

Reviewed By: Bigcheese

Differential Revision: https://reviews.llvm.org/D93700


# a828fb46 21-Dec-2020 Jan Svoboda <jan_svoboda@apple.com>

[clang][cli] Port a CommaJoined option to the marshalling infrastructure

Reviewed By: dexonsmith

Differential Revision: https://reviews.llvm.org/D93698


# 67a4c672 07-Jan-2021 Jan Svoboda <jan_svoboda@apple.com>

Reapply "[clang][cli] Allow users to specify a conditional to prevent parsing options with MarshallingInfo"

This reverts commit d0fa7a05 and fixes failing OptionMarshallingTest by adding the SHOULD_

Reapply "[clang][cli] Allow users to specify a conditional to prevent parsing options with MarshallingInfo"

This reverts commit d0fa7a05 and fixes failing OptionMarshallingTest by adding the SHOULD_PARSE macro argument

show more ...


# d0fa7a05 07-Jan-2021 Jan Svoboda <jan_svoboda@apple.com>

Revert "[clang][cli] Allow users to specify a conditional to prevent parsing options with MarshallingInfo"

This reverts commit 77db83ae


# c6ea4d5b 21-Dec-2020 Jan Svoboda <jan_svoboda@apple.com>

[clang][cli] Implement ContainsN Google Test matcher

This allows us to verify that we don't emit options multiple times.

In most cases, that would be benign, but for options with `MarshallingInfoVe

[clang][cli] Implement ContainsN Google Test matcher

This allows us to verify that we don't emit options multiple times.

In most cases, that would be benign, but for options with `MarshallingInfoVectorString`, emitting wrong number of arguments might change the semantics.

Reviewed By: Bigcheese

Differential Revision: https://reviews.llvm.org/D93636

show more ...


Revision tags: llvmorg-11.0.1, llvmorg-11.0.1-rc2
# 77db83ae 18-Dec-2020 Jan Svoboda <jan_svoboda@apple.com>

[clang][cli] Allow users to specify a conditional to prevent parsing options with MarshallingInfo

Depends on D84189 & D93540.

Reviewed By: Bigcheese

Differential Revision: https://reviews.llvm.org

[clang][cli] Allow users to specify a conditional to prevent parsing options with MarshallingInfo

Depends on D84189 & D93540.

Reviewed By: Bigcheese

Differential Revision: https://reviews.llvm.org/D84674

show more ...


# ce8c59e6 05-Jan-2021 Jan Svoboda <jan_svoboda@apple.com>

Reapply multiple "[clang][cli]" patches

This reverts 7ad666798f12 and 1876a2914fe0 that reverted:

741978d727a4 [clang][cli] Port CodeGen option flags to new option parsing system
383778e2171b [clan

Reapply multiple "[clang][cli]" patches

This reverts 7ad666798f12 and 1876a2914fe0 that reverted:

741978d727a4 [clang][cli] Port CodeGen option flags to new option parsing system
383778e2171b [clang][cli] Port LangOpts option flags to new option parsing system
aec2991d083a [clang][cli] Port LangOpts simple string based options to new option parsing system
95d3cc67caac [clang][cli] Port CodeGenOpts simple string flags to new option parsing system
27b7d646886d [clang][cli] Streamline MarshallingInfoFlag description
70410a264949 [clang][cli] Let denormalizer decide how to render the option based on the option class
63a24816f561 [clang][cli] Implement `getAllArgValues` marshalling

Commit 741978d727a4 accidentally changed the `Group` attribute of `g[no_]column_info` options from `g_flags_Group` to `g_Group`, which changed the debug info options passed to cc1 by the driver.

Similar change was also present in 383778e2171b, which accidentally added `Group<f_Group>` to `f[no_]const_strings` and `f[no_]signed_wchar`.

This patch corrects all three accidental changes by replacing `Bool{G,F}Option` with `BoolCC1Option`.

show more ...


# f111cf99 05-Jan-2021 Jan Svoboda <jan_svoboda@apple.com>

[clang][cli] Specify correct integer width for -fbuild-session-timestamp

This fixes an issue where large integer values were rejected as invalid.

Reviewed By: arphaman

Differential Revision: https

[clang][cli] Specify correct integer width for -fbuild-session-timestamp

This fixes an issue where large integer values were rejected as invalid.

Reviewed By: arphaman

Differential Revision: https://reviews.llvm.org/D94101

show more ...


# 1876a291 23-Dec-2020 Nico Weber <thakis@chromium.org>

Revert more changes that landed on top of 741978d727

This should've been in 7ad666798f12456d9 but wasn't.

Squashes these twoc commits:
Revert "[clang][cli] Let denormalizer decide how to render the

Revert more changes that landed on top of 741978d727

This should've been in 7ad666798f12456d9 but wasn't.

Squashes these twoc commits:
Revert "[clang][cli] Let denormalizer decide how to render the option based on the option class"
This reverts commit 70410a264949101ced3ce3458f37dd4cc2f5af85.

Revert "[clang][cli] Implement `getAllArgValues` marshalling"
This reverts commit 63a24816f561a5d8e28ca7054892bd8602618be4.

show more ...


# 63a24816 21-Dec-2020 Jan Svoboda <jan_svoboda@apple.com>

[clang][cli] Implement `getAllArgValues` marshalling

This infrastructure can be used ~30 more command line options.

Reviewed By: dexonsmith

Differential Revision: https://reviews.llvm.org/D93631


# 70410a26 18-Dec-2020 Jan Svoboda <jan_svoboda@apple.com>

[clang][cli] Let denormalizer decide how to render the option based on the option class

Before this patch, you needed to use `AutoNormalizeEnumJoined` whenever you wanted to **de**normalize joined e

[clang][cli] Let denormalizer decide how to render the option based on the option class

Before this patch, you needed to use `AutoNormalizeEnumJoined` whenever you wanted to **de**normalize joined enum.
Besides the naming confusion, this means the fact the option is joined is specified in two places: in the normalization multiclass and in the `Joined<["-"], ...>` multiclass.
This patch makes this work automatically, taking into account the `OptionClass` of options.

Also, the enum denormalizer now just looks up the spelling of the present enum case in a table and forwards it to the string denormalizer.

I also added more tests that exercise this.

Reviewed By: dexonsmith

Original patch by Daniel Grumberg.

Differential Revision: https://reviews.llvm.org/D84189

show more ...


# f2661bed 09-Dec-2020 Jan Svoboda <jan_svoboda@apple.com>

[clang][cli] Prevent double denormalization

If both flags created through BoolOption are CC1Option and the keypath has a non-default or non-implied value, the denormalizer gets called twice. If the

[clang][cli] Prevent double denormalization

If both flags created through BoolOption are CC1Option and the keypath has a non-default or non-implied value, the denormalizer gets called twice. If the denormalizer has the ability to generate both flags, we can end up generating the same flag twice.

Reviewed By: dexonsmith, Bigcheese

Differential Revision: https://reviews.llvm.org/D93094

show more ...


# 95114f21 08-Dec-2020 Jan Svoboda <jan_svoboda@apple.com>

[clang][cli] Do not marshall only CC1Option flags in BoolOption

We cannot be sure whether a flag is CC1Option inside the definition of `BoolOption`. Take the example below:

```
let Flags = [CC1Opti

[clang][cli] Do not marshall only CC1Option flags in BoolOption

We cannot be sure whether a flag is CC1Option inside the definition of `BoolOption`. Take the example below:

```
let Flags = [CC1Option] in {
defm xxx : BoolOption<...>;
}
```

where TableGen applies `Flags = [CC1Option]` to the `xxx` and `no_xxx` records **after** they have been is fully declared by `BoolOption`.

For the refactored `-f[no-]debug-pass-manager` flags (see the diff), this means `BoolOption` never adds any marshalling info, as it doesn't see either of the flags as `CC1Option`.

For that reason, we should defensively append the marshalling information to both flags inside `BoolOption`. Now the check for `CC1Option` needs to happen later, in the parsing macro, when all TableGen logic has been resolved.

However, for some flags defined through `BoolOption`, we can run into issues:

```
// Options.td
def fenable_xxx : /* ... */;

// Both flags are CC1Option, the first is implied.
defm xxx : BoolOption<"xxx,
"Opts.Xxx", DefaultsToFalse,
ChangedBy<PosFlag, [CC1Option], "", [fenable_xxx]>,
ResetBy<NegFlag, [CC1Option]>>;
```

When parsing `clang -cc1 -fenable-xxx`:
* we run parsing for `PosFlag`:
* set `Opts.Xxx` to default `false`,
* discover `PosFlag` is implied by `-fenable-xxx`: set `Opts.Xxx` to `true`,
* don't see `-fxxx` on command line: do nothing,
* we run parsing for `NegFlag`:
* set `Opts.Xxx` to default `false`,
* discover `NegFlag` cannot be implied: do nothing,
* don't see `-fno-xxx` on command line: do nothing.

Now we ended up with `Opts.Xxx` set to `false` instead of `true`. For this reason, we need to ensure to append the same `ImpliedByAnyOf` instance to both flags.

This means both parsing runs now behave identically (they set the same default value, run the same "implied by" check, and call `makeBooleanOptionNormalizer` that already has information on both flags, so it returns the same value in both calls).

The solution works well, but what might be confusing is this: you have defined a flag **A** that is not `CC1Option`, but can be implied by another flag **B** that is `CC1Option`:
* if **A** is defined manually, it will never get implied, as the code never runs
```
def no_signed_zeros : Flag<["-"], "fno-signed-zeros">, Group<f_Group>, Flags<[]>,
MarshallingInfoFlag<"LangOpts->NoSignedZero">, ImpliedByAnyOf<[menable_unsafe_fp_math]>;
```
* if **A** is defined by `BoolOption`, it could get implied, as the code is run by its `CC1Option` counterpart:
```
defm signed_zeros : BoolOption<"signed-zeros",
"LangOpts->NoSignedZero", DefaultsToFalse,
ChangedBy<NegFlag, [], "Allow optimizations that ignore the sign of floating point zeros",
[cl_no_signed_zeros, menable_unsafe_fp_math]>,
ResetBy<PosFlag, [CC1Option]>, "f">, Group<f_Group>;
```

This is a surprising inconsistency.

One solution might be to somehow propagate the final `Flags` of the implied flag in `ImpliedByAnyOf` and check whether it has `CC1Option` in the parsing macro. However, I think it doesn't make sense to spend time thinking about a corner case that won't come up in real code.

An observation: it is unfortunate that the marshalling information is a part of the flag definition. If we represented it in a separate structure, we could avoid the "double parsing" problem by having a single source of truth. This would require a lot of additional work though.

Note: the original patch missed the `CC1Option` check in the parsing macro, making my reasoning here incomplete. Moreover, it contained a change to denormalization that wasn't necessarily related to these changes, so I've extracted that to a follow-up patch: D93094.

Reviewed By: dexonsmith, Bigcheese

Differential Revision: https://reviews.llvm.org/D93008

show more ...


# 6baa9769 08-Dec-2020 Jan Svoboda <jan_svoboda@apple.com>

[clang][cli] Add flexible TableGen multiclass for boolean options

This introduces more flexible multiclass for declaring two flags controlling the same boolean keypath.

Compared to existing Opt{In,

[clang][cli] Add flexible TableGen multiclass for boolean options

This introduces more flexible multiclass for declaring two flags controlling the same boolean keypath.

Compared to existing Opt{In,Out}FFlag multiclasses, the new syntax makes it easier to read option declarations and reason about the keypath.

This also makes specifying common properties of both flags possible.

I'm open to suggestions on the class names. Not 100% sure the benefits are worth the added complexity.

Depends on D92774.

Reviewed By: dexonsmith

Differential Revision: https://reviews.llvm.org/D92775

show more ...


# 10f40576 08-Dec-2020 Jan Svoboda <jan_svoboda@apple.com>

[clang][cli] Don't always emit -f[no-]legacy-pass-manager

We don't need to always generate `-f[no-]experimental-new-pass-manager`.

This patch does not change the behavior of any other command line

[clang][cli] Don't always emit -f[no-]legacy-pass-manager

We don't need to always generate `-f[no-]experimental-new-pass-manager`.

This patch does not change the behavior of any other command line flag. (For example `-triple` is still being always generated.)

Reviewed By: dexonsmith, Bigcheese

Differential Revision: https://reviews.llvm.org/D92857

show more ...


# 6f26a6de 11-Dec-2020 Jan Svoboda <jan_svoboda@apple.com>

Reland "[clang][cli] CompilerInvocationTest: add tests for boolean options"

Add more tests of the command line marshalling infrastructure.

The new tests now make a "round-trip": from arguments, to

Reland "[clang][cli] CompilerInvocationTest: add tests for boolean options"

Add more tests of the command line marshalling infrastructure.

The new tests now make a "round-trip": from arguments, to CompilerInvocation instance to arguments again in a single test case.

The TODOs are resolved in a follow-up patch.

Depends on D92830.

Reviewed By: dexonsmith

Differential Revision: https://reviews.llvm.org/D92774

show more ...


# 13e4e5ed 09-Dec-2020 Jan Svoboda <jan_svoboda@apple.com>

Revert "[clang][cli] CompilerInvocationTest: add tests for boolean options"

Differential Revision of original patch: https://reviews.llvm.org/D92774


# 35621cc2 08-Dec-2020 Jan Svoboda <jan_svoboda@apple.com>

[clang][cli] CompilerInvocationTest: add tests for boolean options

Add more tests of the command line marshalling infrastructure.

The new tests now make a "round-trip": from arguments, to CompilerI

[clang][cli] CompilerInvocationTest: add tests for boolean options

Add more tests of the command line marshalling infrastructure.

The new tests now make a "round-trip": from arguments, to CompilerInvocation instance to arguments again in a single test case.

The TODOs are resolved in a follow-up patch.

Depends on D92830.

Reviewed By: dexonsmith

Differential Revision: https://reviews.llvm.org/D92774

show more ...


# 216d4305 08-Dec-2020 Jan Svoboda <jan_svoboda@apple.com>

[clang][cli] CompilerInvocationTest: join and add test cases

Depends on D92829.

Reviewed By: dexonsmith

Differential Revision: https://reviews.llvm.org/D92830


# 03692bae 08-Dec-2020 Jan Svoboda <jan_svoboda@apple.com>

[clang][cli] CompilerInvocationTest: check arg parsing does not produce diagnostics

Depends on D92828.

Reviewed By: dexonsmith

Differential Revision: https://reviews.llvm.org/D92829


# 4894e423 08-Dec-2020 Jan Svoboda <jan_svoboda@apple.com>

[clang][cli] CompilerInvocationTest: remove unnecessary command line arguments

Depends on D92827.

Reviewed By: dexonsmith

Differential Revision: https://reviews.llvm.org/D92828


# 5afff86d 08-Dec-2020 Jan Svoboda <jan_svoboda@apple.com>

[clang][cli] CompilerInvocationTest: split enum test into two

Depends on D92826.

Reviewed By: dexonsmith

Differential Revision: https://reviews.llvm.org/D92827


# f825ec86 08-Dec-2020 Jan Svoboda <jan_svoboda@apple.com>

[clang][cli] CompilerInvocationTest: rename member variable in fixture

Depends on D92825.

Reviewed By: dexonsmith

Differential Revision: https://reviews.llvm.org/D92826


123