miyuki added a comment.

In D69903#2340020 <https://reviews.llvm.org/D69903#2340020>, @dexonsmith wrote:

> An alternative would be to update the unions to an `AlignedCharArrayUnion` 
> and use `SourceLocation` directly. WDYT?

So, say, in `DeclarationNameLoc`, I would add `AlignedCharArrayUnion` as 
follows:

  union {
    llvm::AlignedCharArrayUnion<struct NT, struct CXXOpName, struct 
CXXLitOpName> UninitStorage;
    struct NT NamedType;
    struct CXXOpName CXXOperatorName;
    struct CXXLitOpName CXXLiteralOperatorName;
  };

And change the constructor of `DeclarationNameLoc` to default-construct 
`UninitStorage`, i.e.:

  DeclarationNameLoc() : UninitStorage() {
    memset(UninitStorage.buffer, 0, sizeof(UninitStorage.buffer));
  }

After that, I can use `SourceLocation` in `DeclarationNameLoc` directly.

Do I understand your idea correctly?


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

https://reviews.llvm.org/D69903

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
  • [PATCH] D69903: [B... Duncan P. N. Exon Smith via Phabricator via cfe-commits
    • [PATCH] D6990... Mikhail Maltsev via Phabricator via cfe-commits
    • [PATCH] D6990... Duncan P. N. Exon Smith via Phabricator via cfe-commits

Reply via email to