This is an archive of the discontinued LLVM Phabricator instance.

[GCC] PR23529 Sema part of attrbute abi_tag support

Authored by DmitryPolukhin on Feb 24 2016, 3:37 AM.



Original patch by Stefan Bühler

Difference between original and this one:

  • fixed all comments in original code review
  • added more tests, all new diagnostics now covered by tests
  • moved abi_tag on re-declaration checks to Sema::mergeDeclAttributes where they actually may work as designed
  • clang-format + other stylistic changes

Mangle part will be sent for review as a separate patch.

Diff Detail


Event Timeline

DmitryPolukhin retitled this revision from to [GCC] Sema part of attrbute abi_tag support.
DmitryPolukhin updated this object.
DmitryPolukhin added a reviewer: aaron.ballman.
DmitryPolukhin added subscribers: cfe-commits, stbuehler.
DmitryPolukhin retitled this revision from [GCC] Sema part of attrbute abi_tag support to [GCC] PR23529 Sema part of attrbute abi_tag support.Feb 24 2016, 3:42 AM

Aaron, friendly ping, please take a look!

aaron.ballman edited edge metadata.Mar 2 2016, 5:27 AM
aaron.ballman added a subscriber: aaron.ballman.

I'll definitely take a look as I have the chance. In WG21 meetings all
week, so it may likely be sometime next week.


sberg added a subscriber: sberg.Mar 2 2016, 6:46 AM
sberg added inline comments.
4497 ↗(On Diff #48901)

needs to be SmallVector<StringRef, 4> with current trunk

DmitryPolukhin edited edge metadata.
DmitryPolukhin marked an inline comment as done.


aaron.ballman added inline comments.Mar 7 2016, 7:27 AM
2 ↗(On Diff #49617)

ABI tags (since it's an acronym). Elsewhere as well.

30 ↗(On Diff #49617)

an <unqualified-name>

49 ↗(On Diff #49617)

A namespace does not have any active tags.

50 ↗(On Diff #49617)

Comma after "enum)".

52 ↗(On Diff #49617)

Comma after "functions".

68 ↗(On Diff #49617)

Code examples for these might be useful for the reader.

79 ↗(On Diff #49617)

Separate into two sentences instead of using a semicolon.

"Also, for functions, all tags from the..."

83 ↗(On Diff #49617)

Replace the ! with a .

Also, an example might be useful for the reader.

89 ↗(On Diff #49617)

as an active tag.

1965 ↗(On Diff #49617)

to modify the mangled name

1966 ↗(On Diff #49617)

the ability to distinguish between different versions

1967 ↗(On Diff #49617)

versions supported.

a newer version of a class could have a different set of data members

1968 ↗(On Diff #49617)

a different size.

Comma after attribute.

1969 ↗(On Diff #49617)


1970 ↗(On Diff #49617)

Therefore, (note the comma)

the old mangled name

will use the new

2465 ↗(On Diff #49617)

Comma after functions.

4179 ↗(On Diff #49617)

in a redeclaration

DmitryPolukhin marked 17 inline comments as done.
  • fixed comments
  • rebase with resolving conflicts

Thank you for the comments!

83 ↗(On Diff #49617)

I'm 100% sure what exactly Stefan meant here and what is intended GCC behavior vs observed behavior, for example:

namespace A {

inline namespace B __attribute__((abi_tag)) {
   struct C { int x; };


std::string foo() {

struct E {
  static A::C bar() {
    // mangle as _ZZ3fooB5cxx11vEN1E3barB1XEv
    // i.e. foo[abi:cxx11]()::E::bar[abi:X]()
    // abi_tag 'B' is missing for bar in GCC 5.3.0
    return A::C();


Perhaps we should skip this part.

aaron.ballman accepted this revision.Mar 9 2016, 7:10 AM
aaron.ballman edited edge metadata.

LGTM, thank you!

This revision is now accepted and ready to land.Mar 9 2016, 7:10 AM
This revision was automatically updated to reflect the committed changes.
olifre added a subscriber: olifre.Mar 15 2016, 1:51 AM
cecio added a subscriber: cecio.May 9 2016, 2:38 AM