Details
Diff Detail
Event Timeline
I may have more comments when I catch up on email next week. Just a drive-by as I added myself as reviewer.
include/clang/Basic/Attr.td | ||
---|---|---|
1582 | No new undocumented attributes, please. Same below. |
include/clang/Basic/Attr.td | ||
---|---|---|
1582 | Yes, sorry, forgot to go back and add documentation for these attributes. Will do. (Reckon it's not worth documenting the feature itself until it actually does something.) |
Missing some attribute-related tests like attaching the attribute to something other than a record, or passing arguments to the attribute.
include/clang/Basic/DiagnosticSemaKinds.td | ||
---|---|---|
8376 | It would be good to combine these into one Note using %select. | |
8380 | Same for these. | |
8389 | Should this also be a %select, or can you really add either attribute to silence the warning? | |
lib/Sema/SemaDeclCXX.cpp | ||
4896 | Since the attributes do nothing for a non-dynamic class, should the user get a warning if the place the attribute on one (so they know it does nothing)? |
Missing some attribute-related tests like attaching the attribute to something other than a record, or passing arguments to the attribute.
Added.
include/clang/Basic/DiagnosticSemaKinds.td | ||
---|---|---|
8389 | The latter. I gave this a better name to make things clear. | |
lib/Sema/SemaDeclCXX.cpp | ||
4896 | I suppose so; done. |
Attribute side of things looks good, but I leave it to others to decide if the ABI functionality makes sense (it does to me, but I'm no ABI expert).
LGTM, but I'm not a clang expert, so if Richard or someone else could double-check?
lib/Sema/SemaDeclCXX.cpp | ||
---|---|---|
4999 | Isn't this correct by the loop which starts with DC = InnermostExternalDC? |
lib/Sema/SemaDeclCXX.cpp | ||
---|---|---|
4999 | s/correct/already covered/ |
lib/Sema/SemaDeclCXX.cpp | ||
---|---|---|
4999 | That loop checks for glob contexts (contexts ending in ** in the ABI list), which have different semantics to regular contexts (ending in *). |
lib/Sema/SemaDeclCXX.cpp | ||
---|---|---|
4999 | Oh, I misread UnstableABIGlobContexts for UnstableABIContexts... |
include/clang/Basic/DiagnosticSemaKinds.td | ||
---|---|---|
8380 | How valuable is it to warn on this? It seems like we may want unstable_abi to affect other things than virtual functions in future (for instance, we may want to apply the ARM ABI "return this from constructors" change to classes with unstable ABI, fix some subtle problems in the class layout algorithm, pass certain trivially-copyable structs in registers even though they're not POD for the purpose of layout, ...). If the design intent is that this only affects the virtual call portion of the ABI, then I think it has the wrong name. (If someone asks for the unstable ABI for the class, and it happens that the unstable ABI is the same as the stable one, I don't think that warrants a warning.) | |
lib/Sema/SemaDeclCXX.cpp | ||
4891 | Can we exit early if no unstable class ABI flags were passed? | |
4935–4943 | Should you also diagnose conflicts with other struct ABI attributes like ms_struct? | |
5018–5019 | -Weverything users will not like this. |
- Make -Wunused-stability-attr a non-default flag
include/clang/Basic/DiagnosticSemaKinds.td | ||
---|---|---|
8380 | I agree that the attribute should permit other struct ABI changes. I also agree that we shouldn't warn by default. We've traditionally warned when an attribute has no effect, but that's probably the wrong decision in this case. I've made this a non-default warning. | |
lib/Sema/SemaDeclCXX.cpp | ||
4891 | We may need to inherit an ABI from a base, even if no flags were passed. | |
4935–4943 | I'd expect those attributes to be orthogonal, e.g. ms_struct + unstable_abi would give you whatever just unstable_abi would give you when targeting Windows. | |
5018–5019 | That's unfortunate, but I think the alternative of creating a category of warnings that -Weverything does not warn on would be worse. My understanding is that as a user-facing flag -Weverything is mostly intended for manual discovery of warnings that Clang produces; as part of that manual process, users can easily add the -Wno-c++-stable-abi flag. |
lib/Sema/SemaDeclCXX.cpp | ||
---|---|---|
4935–4943 | No, ms_struct is a request for a specific ABI; this would be a conflict. |
lib/Sema/SemaDeclCXX.cpp | ||
---|---|---|
4935–4943 | Fair point. I think we can handle this by making ms_struct imply stable_abi in the same way that uuid would imply stable_abi. Then there would be a conflict between ms_struct and unstable_abi, and we would infer the correct ABI in implied namespaces. Are there any other attributes like that? I could only find vecreturn and novtable. |
lib/Sema/SemaDeclCXX.cpp | ||
---|---|---|
4935–4943 | I can't think of anything else that's a conflict. vecreturn affects a different aspect of the ABI. novtable is advisory and orthogonal. Alignment/packed attributes should still be honored under an unstable ABI. |
- Attributes uuid and ms_struct imply stable_abi. Also improve docs and diagnostics for non-dynamic classes
lib/Sema/SemaDeclCXX.cpp | ||
---|---|---|
4935–4943 | Thanks, I've added conflicts for ms_struct and uuid. |
No new undocumented attributes, please. Same below.