QualType BaseObjectType,
const PartialDiagnostic &PDiag) {
DependentDiagnostic *DD = Create(Context, Parent, PDiag);
- DD->AccessData.Loc = Loc.getRawEncoding();
+ DD->AccessData.Loc = Loc;
DD->AccessData.IsMember = IsMemberAccess;
DD->AccessData.Access = AS;
DD->AccessData.TargetDecl = TargetDecl;
SourceLocation getAccessLoc() const {
assert(getKind() == Access);
- return SourceLocation::getFromRawEncoding(AccessData.Loc);
+ return AccessData.Loc;
}
NamedDecl *getAccessTarget() const {
PartialDiagnostic Diag;
struct {
- unsigned Loc;
+ SourceLocation Loc;
unsigned Access : 2;
unsigned IsMember : 1;
NamedDecl *TargetDecl;
uintptr_t NameOrField;
/// The location of the '.' in the designated initializer.
- unsigned DotLoc;
+ SourceLocation DotLoc;
/// The location of the field name in the designated initializer.
- unsigned FieldLoc;
+ SourceLocation FieldLoc;
};
/// An array or GNU array-range designator, e.g., "[9]" or "[10..15]".
/// initializer expression's list of subexpressions.
unsigned Index;
/// The location of the '[' starting the array range designator.
- unsigned LBracketLoc;
+ SourceLocation LBracketLoc;
/// The location of the ellipsis separating the start and end
/// indices. Only valid for GNU array-range designators.
- unsigned EllipsisLoc;
+ SourceLocation EllipsisLoc;
/// The location of the ']' terminating the array range designator.
- unsigned RBracketLoc;
+ SourceLocation RBracketLoc;
};
/// Represents a single C99 designator.
Designator(const IdentifierInfo *FieldName, SourceLocation DotLoc,
SourceLocation FieldLoc)
: Kind(FieldDesignator) {
+ new (&Field) DesignatedInitExpr::FieldDesignator;
Field.NameOrField = reinterpret_cast<uintptr_t>(FieldName) | 0x01;
- Field.DotLoc = DotLoc.getRawEncoding();
- Field.FieldLoc = FieldLoc.getRawEncoding();
+ Field.DotLoc = DotLoc;
+ Field.FieldLoc = FieldLoc;
}
/// Initializes an array designator.
Designator(unsigned Index, SourceLocation LBracketLoc,
SourceLocation RBracketLoc)
: Kind(ArrayDesignator) {
+ new (&ArrayOrRange) DesignatedInitExpr::ArrayOrRangeDesignator;
ArrayOrRange.Index = Index;
- ArrayOrRange.LBracketLoc = LBracketLoc.getRawEncoding();
- ArrayOrRange.EllipsisLoc = SourceLocation().getRawEncoding();
- ArrayOrRange.RBracketLoc = RBracketLoc.getRawEncoding();
+ ArrayOrRange.LBracketLoc = LBracketLoc;
+ ArrayOrRange.EllipsisLoc = SourceLocation();
+ ArrayOrRange.RBracketLoc = RBracketLoc;
}
/// Initializes a GNU array-range designator.
Designator(unsigned Index, SourceLocation LBracketLoc,
SourceLocation EllipsisLoc, SourceLocation RBracketLoc)
: Kind(ArrayRangeDesignator) {
+ new (&ArrayOrRange) DesignatedInitExpr::ArrayOrRangeDesignator;
ArrayOrRange.Index = Index;
- ArrayOrRange.LBracketLoc = LBracketLoc.getRawEncoding();
- ArrayOrRange.EllipsisLoc = EllipsisLoc.getRawEncoding();
- ArrayOrRange.RBracketLoc = RBracketLoc.getRawEncoding();
+ ArrayOrRange.LBracketLoc = LBracketLoc;
+ ArrayOrRange.EllipsisLoc = EllipsisLoc;
+ ArrayOrRange.RBracketLoc = RBracketLoc;
}
bool isFieldDesignator() const { return Kind == FieldDesignator; }
SourceLocation getDotLoc() const {
assert(Kind == FieldDesignator && "Only valid on a field designator");
- return SourceLocation::getFromRawEncoding(Field.DotLoc);
+ return Field.DotLoc;
}
SourceLocation getFieldLoc() const {
assert(Kind == FieldDesignator && "Only valid on a field designator");
- return SourceLocation::getFromRawEncoding(Field.FieldLoc);
+ return Field.FieldLoc;
}
SourceLocation getLBracketLoc() const {
assert((Kind == ArrayDesignator || Kind == ArrayRangeDesignator) &&
"Only valid on an array or array-range designator");
- return SourceLocation::getFromRawEncoding(ArrayOrRange.LBracketLoc);
+ return ArrayOrRange.LBracketLoc;
}
SourceLocation getRBracketLoc() const {
assert((Kind == ArrayDesignator || Kind == ArrayRangeDesignator) &&
"Only valid on an array or array-range designator");
- return SourceLocation::getFromRawEncoding(ArrayOrRange.RBracketLoc);
+ return ArrayOrRange.RBracketLoc;
}
SourceLocation getEllipsisLoc() const {
assert(Kind == ArrayRangeDesignator &&
"Only valid on an array-range designator");
- return SourceLocation::getFromRawEncoding(ArrayOrRange.EllipsisLoc);
+ return ArrayOrRange.EllipsisLoc;
}
unsigned getFirstExprIndex() const {
// but template arguments get canonicalized too quickly.
NestedNameSpecifier *Qualifier;
void *QualifierLocData;
- unsigned TemplateNameLoc;
- unsigned EllipsisLoc;
+ SourceLocation TemplateNameLoc;
+ SourceLocation EllipsisLoc;
};
llvm::PointerUnion<TemplateTemplateArgLocInfo *, Expr *, TypeSourceInfo *>
}
SourceLocation getTemplateNameLoc() const {
- return SourceLocation::getFromRawEncoding(getTemplate()->TemplateNameLoc);
+ return getTemplate()->TemplateNameLoc;
}
SourceLocation getTemplateEllipsisLoc() const {
- return SourceLocation::getFromRawEncoding(getTemplate()->EllipsisLoc);
+ return getTemplate()->EllipsisLoc;
}
};
/// The location of the \#include that brought in this file.
///
/// This is an invalid SLOC for the main file (top of the \#include chain).
- unsigned IncludeLoc; // Really a SourceLocation
+ SourceLocation IncludeLoc;
/// Number of FileIDs (files and macros) that were created during
/// preprocessing of this \#include, including this SLocEntry.
static FileInfo get(SourceLocation IL, ContentCache &Con,
CharacteristicKind FileCharacter, StringRef Filename) {
FileInfo X;
- X.IncludeLoc = IL.getRawEncoding();
+ X.IncludeLoc = IL;
X.NumCreatedFIDs = 0;
X.HasLineDirectives = false;
X.ContentAndKind.setPointer(&Con);
}
SourceLocation getIncludeLoc() const {
- return SourceLocation::getFromRawEncoding(IncludeLoc);
+ return IncludeLoc;
}
const ContentCache &getContentCache() const {
// Really these are all SourceLocations.
/// Where the spelling for the token can be found.
- unsigned SpellingLoc;
+ SourceLocation SpellingLoc;
/// In a macro expansion, ExpansionLocStart and ExpansionLocEnd
/// indicate the start and end of the expansion. In object-like macros,
/// will be the identifier and the end will be the ')'. Finally, in
/// macro-argument instantiations, the end will be 'SourceLocation()', an
/// invalid location.
- unsigned ExpansionLocStart, ExpansionLocEnd;
+ SourceLocation ExpansionLocStart, ExpansionLocEnd;
/// Whether the expansion range is a token range.
bool ExpansionIsTokenRange;
public:
SourceLocation getSpellingLoc() const {
- SourceLocation SpellLoc = SourceLocation::getFromRawEncoding(SpellingLoc);
- return SpellLoc.isInvalid() ? getExpansionLocStart() : SpellLoc;
+ return SpellingLoc.isInvalid() ? getExpansionLocStart() : SpellingLoc;
}
SourceLocation getExpansionLocStart() const {
- return SourceLocation::getFromRawEncoding(ExpansionLocStart);
+ return ExpansionLocStart;
}
SourceLocation getExpansionLocEnd() const {
- SourceLocation EndLoc = SourceLocation::getFromRawEncoding(ExpansionLocEnd);
- return EndLoc.isInvalid() ? getExpansionLocStart() : EndLoc;
+ return ExpansionLocEnd.isInvalid() ? getExpansionLocStart()
+ : ExpansionLocEnd;
}
bool isExpansionTokenRange() const { return ExpansionIsTokenRange; }
bool isMacroArgExpansion() const {
// Note that this needs to return false for default constructed objects.
- return getExpansionLocStart().isValid() &&
- SourceLocation::getFromRawEncoding(ExpansionLocEnd).isInvalid();
+ return getExpansionLocStart().isValid() && ExpansionLocEnd.isInvalid();
}
bool isMacroBodyExpansion() const {
- return getExpansionLocStart().isValid() &&
- SourceLocation::getFromRawEncoding(ExpansionLocEnd).isValid();
+ return getExpansionLocStart().isValid() && ExpansionLocEnd.isValid();
}
bool isFunctionMacroExpansion() const {
SourceLocation End,
bool ExpansionIsTokenRange = true) {
ExpansionInfo X;
- X.SpellingLoc = SpellingLoc.getRawEncoding();
- X.ExpansionLocStart = Start.getRawEncoding();
- X.ExpansionLocEnd = End.getRawEncoding();
+ X.SpellingLoc = SpellingLoc;
+ X.ExpansionLocStart = Start;
+ X.ExpansionLocEnd = End;
X.ExpansionIsTokenRange = ExpansionIsTokenRange;
return X;
}
SLocEntry E;
E.Offset = Offset;
E.IsExpansion = true;
- E.Expansion = Expansion;
+ new (&E.Expansion) ExpansionInfo(Expansion);
return E;
}
};
/// Different operators have different numbers of tokens in their name,
/// up to three. Any remaining source locations in this array will be
/// set to an invalid value for operators with fewer than three tokens.
- unsigned SymbolLocations[3];
+ SourceLocation SymbolLocations[3];
};
/// Anonymous union that holds extra data associated with the
/// Determine what kind of name we have.
UnqualifiedIdKind getKind() const { return Kind; }
- void setKind(UnqualifiedIdKind kind) { Kind = kind; }
/// Specify that this unqualified-id was parsed as an identifier.
///
StartLocation = EndLocation = TemplateLoc;
}
+ /// Specify that this unqualified-id is an implicit 'self'
+ /// parameter.
+ ///
+ /// \param Id the identifier.
+ void setImplicitSelfParam(const IdentifierInfo *Id) {
+ Kind = UnqualifiedIdKind::IK_ImplicitSelfParam;
+ Identifier = const_cast<IdentifierInfo *>(Id);
+ StartLocation = EndLocation = SourceLocation();
+ }
+
/// Return the source range that covers this unqualified-id.
SourceRange getSourceRange() const LLVM_READONLY {
return SourceRange(StartLocation, EndLocation);
///
/// This is intended to be a small value object.
struct DeclaratorChunk {
+ DeclaratorChunk() {};
+
enum {
Pointer, Reference, Array, Function, BlockPointer, MemberPointer, Paren, Pipe
} Kind;
unsigned TypeQuals : 5;
/// The location of the const-qualifier, if any.
- unsigned ConstQualLoc;
+ SourceLocation ConstQualLoc;
/// The location of the volatile-qualifier, if any.
- unsigned VolatileQualLoc;
+ SourceLocation VolatileQualLoc;
/// The location of the restrict-qualifier, if any.
- unsigned RestrictQualLoc;
+ SourceLocation RestrictQualLoc;
/// The location of the _Atomic-qualifier, if any.
- unsigned AtomicQualLoc;
+ SourceLocation AtomicQualLoc;
/// The location of the __unaligned-qualifier, if any.
- unsigned UnalignedQualLoc;
+ SourceLocation UnalignedQualLoc;
void destroy() {
}
unsigned HasTrailingReturnType : 1;
/// The location of the left parenthesis in the source.
- unsigned LParenLoc;
+ SourceLocation LParenLoc;
/// When isVariadic is true, the location of the ellipsis in the source.
- unsigned EllipsisLoc;
+ SourceLocation EllipsisLoc;
/// The location of the right parenthesis in the source.
- unsigned RParenLoc;
+ SourceLocation RParenLoc;
/// NumParams - This is the number of formal parameters specified by the
/// declarator.
/// The location of the ref-qualifier, if any.
///
/// If this is an invalid location, there is no ref-qualifier.
- unsigned RefQualifierLoc;
+ SourceLocation RefQualifierLoc;
/// The location of the 'mutable' qualifer in a lambda-declarator, if
/// any.
- unsigned MutableLoc;
+ SourceLocation MutableLoc;
/// The beginning location of the exception specification, if any.
- unsigned ExceptionSpecLocBeg;
+ SourceLocation ExceptionSpecLocBeg;
/// The end location of the exception specification, if any.
- unsigned ExceptionSpecLocEnd;
+ SourceLocation ExceptionSpecLocEnd;
/// Params - This is a pointer to a new[]'d array of ParamInfo objects that
/// describe the parameters specified by this function declarator. null if
/// If HasTrailingReturnType is true, this is the location of the trailing
/// return type.
- unsigned TrailingReturnTypeLoc;
+ SourceLocation TrailingReturnTypeLoc;
/// Reset the parameter list to having zero parameters.
///
/// by the parameter type definitions.
bool isKNRPrototype() const { return !hasPrototype && NumParams != 0; }
- SourceLocation getLParenLoc() const {
- return SourceLocation::getFromRawEncoding(LParenLoc);
- }
+ SourceLocation getLParenLoc() const { return LParenLoc; }
- SourceLocation getEllipsisLoc() const {
- return SourceLocation::getFromRawEncoding(EllipsisLoc);
- }
+ SourceLocation getEllipsisLoc() const { return EllipsisLoc; }
- SourceLocation getRParenLoc() const {
- return SourceLocation::getFromRawEncoding(RParenLoc);
- }
+ SourceLocation getRParenLoc() const { return RParenLoc; }
SourceLocation getExceptionSpecLocBeg() const {
- return SourceLocation::getFromRawEncoding(ExceptionSpecLocBeg);
+ return ExceptionSpecLocBeg;
}
SourceLocation getExceptionSpecLocEnd() const {
- return SourceLocation::getFromRawEncoding(ExceptionSpecLocEnd);
+ return ExceptionSpecLocEnd;
}
SourceRange getExceptionSpecRange() const {
}
/// Retrieve the location of the ref-qualifier, if any.
- SourceLocation getRefQualifierLoc() const {
- return SourceLocation::getFromRawEncoding(RefQualifierLoc);
- }
+ SourceLocation getRefQualifierLoc() const { return RefQualifierLoc; }
/// Retrieve the location of the 'const' qualifier.
SourceLocation getConstQualifierLoc() const {
}
/// Retrieve the location of the 'mutable' qualifier, if any.
- SourceLocation getMutableLoc() const {
- return SourceLocation::getFromRawEncoding(MutableLoc);
- }
+ SourceLocation getMutableLoc() const { return MutableLoc; }
/// Determine whether this function declaration contains a
/// ref-qualifier.
/// Get the trailing-return-type location for this function declarator.
SourceLocation getTrailingReturnTypeLoc() const {
assert(HasTrailingReturnType);
- return SourceLocation::getFromRawEncoding(TrailingReturnTypeLoc);
+ return TrailingReturnTypeLoc;
}
};
/// The type qualifiers: const/volatile/restrict/__unaligned/_Atomic.
unsigned TypeQuals : 5;
/// Location of the '*' token.
- unsigned StarLoc;
+ SourceLocation StarLoc;
// CXXScopeSpec has a constructor, so it can't be a direct member.
// So we need some pointer-aligned storage and a bit of trickery.
alignas(CXXScopeSpec) char ScopeMem[sizeof(CXXScopeSpec)];
DeclaratorChunk I;
I.Kind = Pointer;
I.Loc = Loc;
+ new (&I.Ptr) PointerTypeInfo;
I.Ptr.TypeQuals = TypeQuals;
- I.Ptr.ConstQualLoc = ConstQualLoc.getRawEncoding();
- I.Ptr.VolatileQualLoc = VolatileQualLoc.getRawEncoding();
- I.Ptr.RestrictQualLoc = RestrictQualLoc.getRawEncoding();
- I.Ptr.AtomicQualLoc = AtomicQualLoc.getRawEncoding();
- I.Ptr.UnalignedQualLoc = UnalignedQualLoc.getRawEncoding();
+ I.Ptr.ConstQualLoc = ConstQualLoc;
+ I.Ptr.VolatileQualLoc = VolatileQualLoc;
+ I.Ptr.RestrictQualLoc = RestrictQualLoc;
+ I.Ptr.AtomicQualLoc = AtomicQualLoc;
+ I.Ptr.UnalignedQualLoc = UnalignedQualLoc;
return I;
}
I.Kind = MemberPointer;
I.Loc = SS.getBeginLoc();
I.EndLoc = EndLoc;
- I.Mem.StarLoc = StarLoc.getRawEncoding();
+ new (&I.Mem) MemberPointerTypeInfo;
+ I.Mem.StarLoc = StarLoc;
I.Mem.TypeQuals = TypeQuals;
new (I.Mem.ScopeMem) CXXScopeSpec(SS);
return I;
FieldDesignator, ArrayDesignator, ArrayRangeDesignator
};
private:
+ Designator() {};
+
DesignatorKind Kind;
struct FieldDesignatorInfo {
const IdentifierInfo *II;
- unsigned DotLoc;
- unsigned NameLoc;
+ SourceLocation DotLoc;
+ SourceLocation NameLoc;
};
struct ArrayDesignatorInfo {
Expr *Index;
- unsigned LBracketLoc;
- mutable unsigned RBracketLoc;
+ SourceLocation LBracketLoc;
+ mutable SourceLocation RBracketLoc;
};
struct ArrayRangeDesignatorInfo {
Expr *Start, *End;
- unsigned LBracketLoc, EllipsisLoc;
- mutable unsigned RBracketLoc;
+ SourceLocation LBracketLoc, EllipsisLoc;
+ mutable SourceLocation RBracketLoc;
};
union {
SourceLocation getDotLoc() const {
assert(isFieldDesignator() && "Invalid accessor");
- return SourceLocation::getFromRawEncoding(FieldInfo.DotLoc);
+ return FieldInfo.DotLoc;
}
SourceLocation getFieldLoc() const {
assert(isFieldDesignator() && "Invalid accessor");
- return SourceLocation::getFromRawEncoding(FieldInfo.NameLoc);
+ return FieldInfo.NameLoc;
}
Expr *getArrayIndex() const {
assert((isArrayDesignator() || isArrayRangeDesignator()) &&
"Invalid accessor");
if (isArrayDesignator())
- return SourceLocation::getFromRawEncoding(ArrayInfo.LBracketLoc);
+ return ArrayInfo.LBracketLoc;
else
- return SourceLocation::getFromRawEncoding(ArrayRangeInfo.LBracketLoc);
+ return ArrayRangeInfo.LBracketLoc;
}
SourceLocation getRBracketLoc() const {
assert((isArrayDesignator() || isArrayRangeDesignator()) &&
"Invalid accessor");
if (isArrayDesignator())
- return SourceLocation::getFromRawEncoding(ArrayInfo.RBracketLoc);
+ return ArrayInfo.RBracketLoc;
else
- return SourceLocation::getFromRawEncoding(ArrayRangeInfo.RBracketLoc);
+ return ArrayRangeInfo.RBracketLoc;
}
SourceLocation getEllipsisLoc() const {
assert(isArrayRangeDesignator() && "Invalid accessor");
- return SourceLocation::getFromRawEncoding(ArrayRangeInfo.EllipsisLoc);
+ return ArrayRangeInfo.EllipsisLoc;
}
static Designator getField(const IdentifierInfo *II, SourceLocation DotLoc,
SourceLocation NameLoc) {
Designator D;
D.Kind = FieldDesignator;
+ new (&D.FieldInfo) FieldDesignatorInfo;
D.FieldInfo.II = II;
- D.FieldInfo.DotLoc = DotLoc.getRawEncoding();
- D.FieldInfo.NameLoc = NameLoc.getRawEncoding();
+ D.FieldInfo.DotLoc = DotLoc;
+ D.FieldInfo.NameLoc = NameLoc;
return D;
}
SourceLocation LBracketLoc) {
Designator D;
D.Kind = ArrayDesignator;
+ new (&D.ArrayInfo) ArrayDesignatorInfo;
D.ArrayInfo.Index = Index;
- D.ArrayInfo.LBracketLoc = LBracketLoc.getRawEncoding();
- D.ArrayInfo.RBracketLoc = 0;
+ D.ArrayInfo.LBracketLoc = LBracketLoc;
+ D.ArrayInfo.RBracketLoc = SourceLocation();
return D;
}
SourceLocation EllipsisLoc) {
Designator D;
D.Kind = ArrayRangeDesignator;
+ new (&D.ArrayRangeInfo) ArrayRangeDesignatorInfo;
D.ArrayRangeInfo.Start = Start;
D.ArrayRangeInfo.End = End;
- D.ArrayRangeInfo.LBracketLoc = LBracketLoc.getRawEncoding();
- D.ArrayRangeInfo.EllipsisLoc = EllipsisLoc.getRawEncoding();
- D.ArrayRangeInfo.RBracketLoc = 0;
+ D.ArrayRangeInfo.LBracketLoc = LBracketLoc;
+ D.ArrayRangeInfo.EllipsisLoc = EllipsisLoc;
+ D.ArrayRangeInfo.RBracketLoc = SourceLocation();
return D;
}
assert((isArrayDesignator() || isArrayRangeDesignator()) &&
"Invalid accessor");
if (isArrayDesignator())
- ArrayInfo.RBracketLoc = RBracketLoc.getRawEncoding();
+ ArrayInfo.RBracketLoc = RBracketLoc;
else
- ArrayRangeInfo.RBracketLoc = RBracketLoc.getRawEncoding();
+ ArrayRangeInfo.RBracketLoc = RBracketLoc;
}
/// ClearExprs - Null out any expression references, which prevents
/// location of the 'return', 'throw', or 'new' keyword,
/// respectively. When Kind == EK_Temporary, the location where
/// the temporary is being created.
- unsigned Location;
+ SourceLocation Location;
/// Whether the entity being initialized may end up using the
/// named return value optimization (NRVO).
IdentifierInfo *VarID;
/// The source location at which the capture occurs.
- unsigned Location;
+ SourceLocation Location;
};
union {
struct C Capture;
};
- InitializedEntity() = default;
+ InitializedEntity() {};
/// Create the initialization entity for a variable.
InitializedEntity(VarDecl *Var, EntityKind EK = EK_Variable)
InitializedEntity(EntityKind Kind, SourceLocation Loc, QualType Type,
bool NRVO = false)
: Kind(Kind), Type(Type) {
- LocAndNRVO.Location = Loc.getRawEncoding();
+ new (&LocAndNRVO) LN;
+ LocAndNRVO.Location = Loc;
LocAndNRVO.NRVO = NRVO;
}
/// Create the initialization entity for a lambda capture.
InitializedEntity(IdentifierInfo *VarID, QualType FieldType, SourceLocation Loc)
: Kind(EK_LambdaCapture), Type(FieldType) {
+ new (&Capture) C;
Capture.VarID = VarID;
- Capture.Location = Loc.getRawEncoding();
+ Capture.Location = Loc;
}
public:
/// the result of a function call.
SourceLocation getReturnLoc() const {
assert(getKind() == EK_Result && "No 'return' location!");
- return SourceLocation::getFromRawEncoding(LocAndNRVO.Location);
+ return LocAndNRVO.Location;
}
/// Determine the location of the 'throw' keyword when initializing
/// an exception object.
SourceLocation getThrowLoc() const {
assert(getKind() == EK_Exception && "No 'throw' location!");
- return SourceLocation::getFromRawEncoding(LocAndNRVO.Location);
+ return LocAndNRVO.Location;
}
/// If this is an array, vector, or complex number element, get the
/// field from a captured variable in a lambda.
SourceLocation getCaptureLoc() const {
assert(getKind() == EK_LambdaCapture && "Not a lambda capture!");
- return SourceLocation::getFromRawEncoding(Capture.Location);
+ return Capture.Location;
}
void setParameterCFAudited() {
SourceLocation StartLoc;
auto *DIE = const_cast<DesignatedInitExpr *>(this);
Designator &First = *DIE->getDesignator(0);
- if (First.isFieldDesignator()) {
- if (GNUSyntax)
- StartLoc = SourceLocation::getFromRawEncoding(First.Field.FieldLoc);
- else
- StartLoc = SourceLocation::getFromRawEncoding(First.Field.DotLoc);
- } else
- StartLoc =
- SourceLocation::getFromRawEncoding(First.ArrayOrRange.LBracketLoc);
+ if (First.isFieldDesignator())
+ StartLoc = GNUSyntax ? First.Field.FieldLoc : First.Field.DotLoc;
+ else
+ StartLoc = First.ArrayOrRange.LBracketLoc;
return StartLoc;
}
TemplateTemplateArgLocInfo *Template = new (Ctx) TemplateTemplateArgLocInfo;
Template->Qualifier = QualifierLoc.getNestedNameSpecifier();
Template->QualifierLocData = QualifierLoc.getOpaqueData();
- Template->TemplateNameLoc = TemplateNameLoc.getRawEncoding();
- Template->EllipsisLoc = EllipsisLoc.getRawEncoding();
+ Template->TemplateNameLoc = TemplateNameLoc;
+ Template->EllipsisLoc = EllipsisLoc;
Pointer = Template;
}
const char *Name = (RefQualifierIsLValueRef ? "& " : "&& ");
FixItHint Insertion = FixItHint::CreateInsertion(VS.getFirstLocation(), Name);
Function.RefQualifierIsLValueRef = RefQualifierIsLValueRef;
- Function.RefQualifierLoc = RefQualifierLoc.getRawEncoding();
+ Function.RefQualifierLoc = RefQualifierLoc;
Diag(RefQualifierLoc, diag::err_declspec_after_virtspec)
<< (RefQualifierIsLValueRef ? "&" : "&&")
auto &FunctionChunk = D.getFunctionTypeInfo();
FunctionChunk.HasTrailingReturnType = TrailingReturnType.isUsable();
FunctionChunk.TrailingReturnType = TrailingReturnType.get();
- FunctionChunk.TrailingReturnTypeLoc = Range.getBegin().getRawEncoding();
+ FunctionChunk.TrailingReturnTypeLoc = Range.getBegin();
} else
SkipUntil({tok::equal, tok::l_brace, tok::arrow, tok::kw_try, tok::comma},
StopAtSemi | StopBeforeMatch);
I.Kind = Function;
I.Loc = LocalRangeBegin;
I.EndLoc = LocalRangeEnd;
+ new (&I.Fun) FunctionTypeInfo;
I.Fun.hasPrototype = hasProto;
I.Fun.isVariadic = EllipsisLoc.isValid();
I.Fun.isAmbiguous = isAmbiguous;
- I.Fun.LParenLoc = LParenLoc.getRawEncoding();
- I.Fun.EllipsisLoc = EllipsisLoc.getRawEncoding();
- I.Fun.RParenLoc = RParenLoc.getRawEncoding();
+ I.Fun.LParenLoc = LParenLoc;
+ I.Fun.EllipsisLoc = EllipsisLoc;
+ I.Fun.RParenLoc = RParenLoc;
I.Fun.DeleteParams = false;
I.Fun.NumParams = NumParams;
I.Fun.Params = nullptr;
I.Fun.RefQualifierIsLValueRef = RefQualifierIsLvalueRef;
- I.Fun.RefQualifierLoc = RefQualifierLoc.getRawEncoding();
- I.Fun.MutableLoc = MutableLoc.getRawEncoding();
+ I.Fun.RefQualifierLoc = RefQualifierLoc;
+ I.Fun.MutableLoc = MutableLoc;
I.Fun.ExceptionSpecType = ESpecType;
- I.Fun.ExceptionSpecLocBeg = ESpecRange.getBegin().getRawEncoding();
- I.Fun.ExceptionSpecLocEnd = ESpecRange.getEnd().getRawEncoding();
+ I.Fun.ExceptionSpecLocBeg = ESpecRange.getBegin();
+ I.Fun.ExceptionSpecLocEnd = ESpecRange.getEnd();
I.Fun.NumExceptionsOrDecls = 0;
I.Fun.Exceptions = nullptr;
I.Fun.NoexceptExpr = nullptr;
I.Fun.HasTrailingReturnType = TrailingReturnType.isUsable() ||
TrailingReturnType.isInvalid();
I.Fun.TrailingReturnType = TrailingReturnType.get();
- I.Fun.TrailingReturnTypeLoc = TrailingReturnTypeLoc.getRawEncoding();
+ I.Fun.TrailingReturnTypeLoc = TrailingReturnTypeLoc;
I.Fun.MethodQualifiers = nullptr;
I.Fun.QualAttrFactory = nullptr;
Kind = UnqualifiedIdKind::IK_OperatorFunctionId;
StartLocation = OperatorLoc;
EndLocation = OperatorLoc;
+ new (&OperatorFunctionId) struct OFI;
OperatorFunctionId.Operator = Op;
for (unsigned I = 0; I != 3; ++I) {
- OperatorFunctionId.SymbolLocations[I] = SymbolLocations[I].getRawEncoding();
+ OperatorFunctionId.SymbolLocations[I] = SymbolLocations[I];
if (SymbolLocations[I].isValid())
EndLocation = SymbolLocations[I];
case UnqualifiedIdKind::IK_OperatorFunctionId:
NameInfo.setName(Context.DeclarationNames.getCXXOperatorName(
Name.OperatorFunctionId.Operator));
- NameInfo.getInfo().CXXOperatorName.BeginOpNameLoc
- = Name.OperatorFunctionId.SymbolLocations[0];
+ NameInfo.getInfo().CXXOperatorName.BeginOpNameLoc =
+ Name.OperatorFunctionId.SymbolLocations[0].getRawEncoding();
NameInfo.getInfo().CXXOperatorName.EndOpNameLoc
= Name.EndLocation.getRawEncoding();
return NameInfo;
// turn this into Self->ivar, just return a BareIVarExpr or something.
IdentifierInfo &II = Context.Idents.get("self");
UnqualifiedId SelfName;
- SelfName.setIdentifier(&II, SourceLocation());
- SelfName.setKind(UnqualifiedIdKind::IK_ImplicitSelfParam);
+ SelfName.setImplicitSelfParam(&II);
CXXScopeSpec SelfScopeSpec;
SourceLocation TemplateKWLoc;
ExprResult SelfExpr =
diag::warn_qual_return_type,
PTI.TypeQuals,
SourceLocation(),
- SourceLocation::getFromRawEncoding(PTI.ConstQualLoc),
- SourceLocation::getFromRawEncoding(PTI.VolatileQualLoc),
- SourceLocation::getFromRawEncoding(PTI.RestrictQualLoc),
- SourceLocation::getFromRawEncoding(PTI.AtomicQualLoc),
- SourceLocation::getFromRawEncoding(PTI.UnalignedQualLoc));
+ PTI.ConstQualLoc,
+ PTI.VolatileQualLoc,
+ PTI.RestrictQualLoc,
+ PTI.AtomicQualLoc,
+ PTI.UnalignedQualLoc);
return;
}
}
// Finally fill in MemberPointerLocInfo fields.
- TL.setStarLoc(SourceLocation::getFromRawEncoding(Chunk.Mem.StarLoc));
+ TL.setStarLoc(Chunk.Mem.StarLoc);
TL.setClassTInfo(ClsTInfo);
}
void VisitLValueReferenceTypeLoc(LValueReferenceTypeLoc TL) {
llvm_unreachable("cannot be _Atomic qualified");
case DeclaratorChunk::Pointer:
- Loc = SourceLocation::getFromRawEncoding(Chunk.Ptr.AtomicQualLoc);
+ Loc = Chunk.Ptr.AtomicQualLoc;
break;
case DeclaratorChunk::BlockPointer: