HomePhabricator

[clang] Use SourceLocations in unions [NFCI]

Authored by miyuki on Jan 14 2021, 2:56 AM.

Description

[clang] Use SourceLocations in unions [NFCI]

Currently, there are many instances where SourceLocation objects are
converted to raw representation to be stored in structs that are
used as fields of tagged unions.

This is done to make the corresponding structs trivial.
Triviality allows avoiding undefined behavior when implicitly changing
the active member of the union.

However, in most cases, we can explicitly construct an active member
using placement new. This patch adds the required active member
selections and replaces SourceLocation-s represented as
unsigned int with proper SourceLocation-s.

One notable exception is DeclarationNameLoc: the objects of this class
are often not properly initialized (so the code currently relies on
its default constructor which uses memset). This class will be fixed
in a separate patch.

Reviewed By: dblaikie

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

Details

Committed
miyukiJan 14 2021, 2:56 AM
Reviewer
dblaikie
Differential Revision
D94237: [clang] Use SourceLocations in unions [NFCI]
Parents
rGd58512b2e31a: [SLP] Don't vectorize stores of non-packed types (like i1, i2)
Branches
Unknown
Tags
Unknown