Don't rely on the use of non-POD types within unions.

They aren't universally supported and we're not getting any benefit
from using them.

llvm-svn: 241564
This commit is contained in:
Douglas Gregor 2015-07-07 06:20:46 +00:00
parent 89442bbb79
commit 0a8890ff45
2 changed files with 16 additions and 5 deletions

View File

@ -610,7 +610,10 @@ public:
class ObjCTypeParamList {
union {
/// Location of the left and right angle brackets.
SourceRange Brackets;
struct {
unsigned Begin;
unsigned End;
} Brackets;
// Used only for alignment.
ObjCTypeParamDecl *AlignmentHack;
@ -661,9 +664,15 @@ public:
return *(end() - 1);
}
SourceLocation getLAngleLoc() const { return Brackets.getBegin(); }
SourceLocation getRAngleLoc() const { return Brackets.getEnd(); }
SourceRange getSourceRange() const { return Brackets; }
SourceLocation getLAngleLoc() const {
return SourceLocation::getFromRawEncoding(Brackets.Begin);
}
SourceLocation getRAngleLoc() const {
return SourceLocation::getFromRawEncoding(Brackets.End);
}
SourceRange getSourceRange() const {
return SourceRange(getLAngleLoc(), getRAngleLoc());
}
/// Gather the default set of type arguments to be substituted for
/// these type parameters when dealing with an unspecialized type.

View File

@ -1251,8 +1251,10 @@ SourceRange ObjCTypeParamDecl::getSourceRange() const {
ObjCTypeParamList::ObjCTypeParamList(SourceLocation lAngleLoc,
ArrayRef<ObjCTypeParamDecl *> typeParams,
SourceLocation rAngleLoc)
: Brackets(lAngleLoc, rAngleLoc), NumParams(typeParams.size())
: NumParams(typeParams.size())
{
Brackets.Begin = lAngleLoc.getRawEncoding();
Brackets.End = rAngleLoc.getRawEncoding();
std::copy(typeParams.begin(), typeParams.end(), begin());
}