|
@@ -1,4 +1,4 @@
|
|
|
-//===--- TypeLoc.h - Type Source Info Wrapper -------------------*- C++ -*-===//
|
|
|
+//===- TypeLoc.h - Type Source Info Wrapper ---------------------*- C++ -*-===//
|
|
|
//
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
//
|
|
@@ -6,26 +6,42 @@
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
//
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
-///
|
|
|
+//
|
|
|
/// \file
|
|
|
/// \brief Defines the clang::TypeLoc interface and its subclasses.
|
|
|
-///
|
|
|
+//
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
#ifndef LLVM_CLANG_AST_TYPELOC_H
|
|
|
#define LLVM_CLANG_AST_TYPELOC_H
|
|
|
|
|
|
#include "clang/AST/Decl.h"
|
|
|
+#include "clang/AST/NestedNameSpecifier.h"
|
|
|
#include "clang/AST/TemplateBase.h"
|
|
|
#include "clang/AST/Type.h"
|
|
|
+#include "clang/Basic/LLVM.h"
|
|
|
+#include "clang/Basic/SourceLocation.h"
|
|
|
#include "clang/Basic/Specifiers.h"
|
|
|
+#include "llvm/ADT/ArrayRef.h"
|
|
|
+#include "llvm/Support/Casting.h"
|
|
|
#include "llvm/Support/Compiler.h"
|
|
|
+#include "llvm/Support/MathExtras.h"
|
|
|
+#include <algorithm>
|
|
|
+#include <cassert>
|
|
|
+#include <cstdint>
|
|
|
+#include <cstring>
|
|
|
|
|
|
namespace clang {
|
|
|
- class ASTContext;
|
|
|
- class ParmVarDecl;
|
|
|
- class TypeSourceInfo;
|
|
|
- class UnqualTypeLoc;
|
|
|
+
|
|
|
+class ASTContext;
|
|
|
+class CXXRecordDecl;
|
|
|
+class Expr;
|
|
|
+class ObjCInterfaceDecl;
|
|
|
+class ObjCProtocolDecl;
|
|
|
+class ObjCTypeParamDecl;
|
|
|
+class TemplateTypeParmDecl;
|
|
|
+class UnqualTypeLoc;
|
|
|
+class UnresolvedUsingTypenameDecl;
|
|
|
|
|
|
// Predeclare all the type nodes.
|
|
|
#define ABSTRACT_TYPELOC(Class, Base)
|
|
@@ -41,10 +57,16 @@ class TypeLoc {
|
|
|
protected:
|
|
|
// The correctness of this relies on the property that, for Type *Ty,
|
|
|
// QualType(Ty, 0).getAsOpaquePtr() == (void*) Ty
|
|
|
- const void *Ty;
|
|
|
- void *Data;
|
|
|
+ const void *Ty = nullptr;
|
|
|
+ void *Data = nullptr;
|
|
|
|
|
|
public:
|
|
|
+ TypeLoc() = default;
|
|
|
+ TypeLoc(QualType ty, void *opaqueData)
|
|
|
+ : Ty(ty.getAsOpaquePtr()), Data(opaqueData) {}
|
|
|
+ TypeLoc(const Type *ty, void *opaqueData)
|
|
|
+ : Ty(ty), Data(opaqueData) {}
|
|
|
+
|
|
|
/// \brief Convert to the specified TypeLoc type, asserting that this TypeLoc
|
|
|
/// is of the desired type.
|
|
|
///
|
|
@@ -88,12 +110,6 @@ public:
|
|
|
Qualified
|
|
|
};
|
|
|
|
|
|
- TypeLoc() : Ty(nullptr), Data(nullptr) { }
|
|
|
- TypeLoc(QualType ty, void *opaqueData)
|
|
|
- : Ty(ty.getAsOpaquePtr()), Data(opaqueData) { }
|
|
|
- TypeLoc(const Type *ty, void *opaqueData)
|
|
|
- : Ty(ty), Data(opaqueData) { }
|
|
|
-
|
|
|
TypeLocClass getTypeLocClass() const {
|
|
|
if (getType().hasLocalQualifiers()) return Qualified;
|
|
|
return (TypeLocClass) getType()->getTypeClass();
|
|
@@ -134,6 +150,7 @@ public:
|
|
|
SourceRange getSourceRange() const LLVM_READONLY {
|
|
|
return SourceRange(getBeginLoc(), getEndLoc());
|
|
|
}
|
|
|
+
|
|
|
SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
|
|
|
SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
|
|
|
|
|
@@ -228,7 +245,7 @@ inline TypeLoc TypeSourceInfo::getTypeLoc() const {
|
|
|
/// no direct qualifiers.
|
|
|
class UnqualTypeLoc : public TypeLoc {
|
|
|
public:
|
|
|
- UnqualTypeLoc() {}
|
|
|
+ UnqualTypeLoc() = default;
|
|
|
UnqualTypeLoc(const Type *Ty, void *Data) : TypeLoc(Ty, Data) {}
|
|
|
|
|
|
const Type *getTypePtr() const {
|
|
@@ -241,6 +258,7 @@ public:
|
|
|
|
|
|
private:
|
|
|
friend class TypeLoc;
|
|
|
+
|
|
|
static bool isKind(const TypeLoc &TL) {
|
|
|
return !TL.getType().hasLocalQualifiers();
|
|
|
}
|
|
@@ -253,9 +271,7 @@ private:
|
|
|
/// type qualifiers.
|
|
|
class QualifiedTypeLoc : public TypeLoc {
|
|
|
public:
|
|
|
- SourceRange getLocalSourceRange() const {
|
|
|
- return SourceRange();
|
|
|
- }
|
|
|
+ SourceRange getLocalSourceRange() const { return {}; }
|
|
|
|
|
|
UnqualTypeLoc getUnqualifiedLoc() const {
|
|
|
unsigned align =
|
|
@@ -296,6 +312,7 @@ public:
|
|
|
|
|
|
private:
|
|
|
friend class TypeLoc;
|
|
|
+
|
|
|
static bool isKind(const TypeLoc &TL) {
|
|
|
return TL.getType().hasLocalQualifiers();
|
|
|
}
|
|
@@ -337,12 +354,12 @@ inline UnqualTypeLoc TypeLoc::getUnqualifiedLoc() const {
|
|
|
/// InheritingConcreteTypeLoc instead.
|
|
|
template <class Base, class Derived, class TypeClass, class LocalData>
|
|
|
class ConcreteTypeLoc : public Base {
|
|
|
+ friend class TypeLoc;
|
|
|
|
|
|
const Derived *asDerived() const {
|
|
|
return static_cast<const Derived*>(this);
|
|
|
}
|
|
|
|
|
|
- friend class TypeLoc;
|
|
|
static bool isKind(const TypeLoc &TL) {
|
|
|
return !TL.getType().hasLocalQualifiers() &&
|
|
|
Derived::classofType(TL.getTypePtr());
|
|
@@ -357,6 +374,7 @@ public:
|
|
|
return std::max(unsigned(alignof(LocalData)),
|
|
|
asDerived()->getExtraLocalDataAlignment());
|
|
|
}
|
|
|
+
|
|
|
unsigned getLocalDataSize() const {
|
|
|
unsigned size = sizeof(LocalData);
|
|
|
unsigned extraAlign = asDerived()->getExtraLocalDataAlignment();
|
|
@@ -449,9 +467,7 @@ private:
|
|
|
return TypeLoc::getLocalAlignmentForType(T);
|
|
|
}
|
|
|
|
|
|
- TypeLoc getNextTypeLoc(HasNoInnerType _) const {
|
|
|
- return TypeLoc();
|
|
|
- }
|
|
|
+ TypeLoc getNextTypeLoc(HasNoInnerType _) const { return {}; }
|
|
|
|
|
|
TypeLoc getNextTypeLoc(QualType T) const {
|
|
|
return TypeLoc(T, getNonLocalData());
|
|
@@ -464,6 +480,7 @@ private:
|
|
|
template <class Base, class Derived, class TypeClass>
|
|
|
class InheritingConcreteTypeLoc : public Base {
|
|
|
friend class TypeLoc;
|
|
|
+
|
|
|
static bool classofType(const Type *Ty) {
|
|
|
return TypeClass::classof(Ty);
|
|
|
}
|
|
@@ -482,7 +499,6 @@ public:
|
|
|
}
|
|
|
};
|
|
|
|
|
|
-
|
|
|
struct TypeSpecLocInfo {
|
|
|
SourceLocation NameLoc;
|
|
|
};
|
|
@@ -502,22 +518,25 @@ public:
|
|
|
SourceLocation getNameLoc() const {
|
|
|
return this->getLocalData()->NameLoc;
|
|
|
}
|
|
|
+
|
|
|
void setNameLoc(SourceLocation Loc) {
|
|
|
this->getLocalData()->NameLoc = Loc;
|
|
|
}
|
|
|
+
|
|
|
SourceRange getLocalSourceRange() const {
|
|
|
return SourceRange(getNameLoc(), getNameLoc());
|
|
|
}
|
|
|
+
|
|
|
void initializeLocal(ASTContext &Context, SourceLocation Loc) {
|
|
|
setNameLoc(Loc);
|
|
|
}
|
|
|
|
|
|
private:
|
|
|
friend class TypeLoc;
|
|
|
+
|
|
|
static bool isKind(const TypeLoc &TL);
|
|
|
};
|
|
|
|
|
|
-
|
|
|
struct BuiltinLocInfo {
|
|
|
SourceRange BuiltinRange;
|
|
|
};
|
|
@@ -531,9 +550,11 @@ public:
|
|
|
SourceLocation getBuiltinLoc() const {
|
|
|
return getLocalData()->BuiltinRange.getBegin();
|
|
|
}
|
|
|
+
|
|
|
void setBuiltinLoc(SourceLocation Loc) {
|
|
|
getLocalData()->BuiltinRange = Loc;
|
|
|
}
|
|
|
+
|
|
|
void expandBuiltinRange(SourceRange Range) {
|
|
|
SourceRange &BuiltinRange = getLocalData()->BuiltinRange;
|
|
|
if (!BuiltinRange.getBegin().isValid()) {
|
|
@@ -579,9 +600,11 @@ public:
|
|
|
else
|
|
|
return TSS_unspecified;
|
|
|
}
|
|
|
+
|
|
|
bool hasWrittenSignSpec() const {
|
|
|
return getWrittenSignSpec() != TSS_unspecified;
|
|
|
}
|
|
|
+
|
|
|
void setWrittenSignSpec(TypeSpecifierSign written) {
|
|
|
if (needsExtraLocalData())
|
|
|
getWrittenBuiltinSpecs().Sign = written;
|
|
@@ -593,18 +616,22 @@ public:
|
|
|
else
|
|
|
return TSW_unspecified;
|
|
|
}
|
|
|
+
|
|
|
bool hasWrittenWidthSpec() const {
|
|
|
return getWrittenWidthSpec() != TSW_unspecified;
|
|
|
}
|
|
|
+
|
|
|
void setWrittenWidthSpec(TypeSpecifierWidth written) {
|
|
|
if (needsExtraLocalData())
|
|
|
getWrittenBuiltinSpecs().Width = written;
|
|
|
}
|
|
|
|
|
|
TypeSpecifierType getWrittenTypeSpec() const;
|
|
|
+
|
|
|
bool hasWrittenTypeSpec() const {
|
|
|
return getWrittenTypeSpec() != TST_unspecified;
|
|
|
}
|
|
|
+
|
|
|
void setWrittenTypeSpec(TypeSpecifierType written) {
|
|
|
if (needsExtraLocalData())
|
|
|
getWrittenBuiltinSpecs().Type = written;
|
|
@@ -616,6 +643,7 @@ public:
|
|
|
else
|
|
|
return false;
|
|
|
}
|
|
|
+
|
|
|
void setModeAttr(bool written) {
|
|
|
if (needsExtraLocalData())
|
|
|
getWrittenBuiltinSpecs().ModeAttr = written;
|
|
@@ -633,7 +661,6 @@ public:
|
|
|
}
|
|
|
};
|
|
|
|
|
|
-
|
|
|
/// \brief Wrapper for source info for typedefs.
|
|
|
class TypedefTypeLoc : public InheritingConcreteTypeLoc<TypeSpecTypeLoc,
|
|
|
TypedefTypeLoc,
|
|
@@ -742,6 +769,7 @@ public:
|
|
|
*((SourceLocation*)this->getExtraLocalData()) :
|
|
|
SourceLocation();
|
|
|
}
|
|
|
+
|
|
|
void setProtocolLAngleLoc(SourceLocation Loc) {
|
|
|
*((SourceLocation*)this->getExtraLocalData()) = Loc;
|
|
|
}
|
|
@@ -751,6 +779,7 @@ public:
|
|
|
*((SourceLocation*)this->getExtraLocalData() + 1) :
|
|
|
SourceLocation();
|
|
|
}
|
|
|
+
|
|
|
void setProtocolRAngleLoc(SourceLocation Loc) {
|
|
|
*((SourceLocation*)this->getExtraLocalData() + 1) = Loc;
|
|
|
}
|
|
@@ -763,6 +792,7 @@ public:
|
|
|
assert(i < getNumProtocols() && "Index is out of bounds!");
|
|
|
return getProtocolLocArray()[i];
|
|
|
}
|
|
|
+
|
|
|
void setProtocolLoc(unsigned i, SourceLocation Loc) {
|
|
|
assert(i < getNumProtocols() && "Index is out of bounds!");
|
|
|
getProtocolLocArray()[i] = Loc;
|
|
@@ -785,9 +815,11 @@ public:
|
|
|
// as well.
|
|
|
return (this->getNumProtocols() + 2) * sizeof(SourceLocation) ;
|
|
|
}
|
|
|
+
|
|
|
unsigned getExtraLocalDataAlignment() const {
|
|
|
return alignof(SourceLocation);
|
|
|
}
|
|
|
+
|
|
|
SourceRange getLocalSourceRange() const {
|
|
|
SourceLocation start = getNameLoc();
|
|
|
SourceLocation end = getProtocolRAngleLoc();
|
|
@@ -938,7 +970,6 @@ public:
|
|
|
}
|
|
|
};
|
|
|
|
|
|
-
|
|
|
struct ObjCObjectTypeLocInfo {
|
|
|
SourceLocation TypeArgsLAngleLoc;
|
|
|
SourceLocation TypeArgsRAngleLoc;
|
|
@@ -971,6 +1002,7 @@ public:
|
|
|
SourceLocation getTypeArgsLAngleLoc() const {
|
|
|
return this->getLocalData()->TypeArgsLAngleLoc;
|
|
|
}
|
|
|
+
|
|
|
void setTypeArgsLAngleLoc(SourceLocation Loc) {
|
|
|
this->getLocalData()->TypeArgsLAngleLoc = Loc;
|
|
|
}
|
|
@@ -978,6 +1010,7 @@ public:
|
|
|
SourceLocation getTypeArgsRAngleLoc() const {
|
|
|
return this->getLocalData()->TypeArgsRAngleLoc;
|
|
|
}
|
|
|
+
|
|
|
void setTypeArgsRAngleLoc(SourceLocation Loc) {
|
|
|
this->getLocalData()->TypeArgsRAngleLoc = Loc;
|
|
|
}
|
|
@@ -999,6 +1032,7 @@ public:
|
|
|
SourceLocation getProtocolLAngleLoc() const {
|
|
|
return this->getLocalData()->ProtocolLAngleLoc;
|
|
|
}
|
|
|
+
|
|
|
void setProtocolLAngleLoc(SourceLocation Loc) {
|
|
|
this->getLocalData()->ProtocolLAngleLoc = Loc;
|
|
|
}
|
|
@@ -1006,6 +1040,7 @@ public:
|
|
|
SourceLocation getProtocolRAngleLoc() const {
|
|
|
return this->getLocalData()->ProtocolRAngleLoc;
|
|
|
}
|
|
|
+
|
|
|
void setProtocolRAngleLoc(SourceLocation Loc) {
|
|
|
this->getLocalData()->ProtocolRAngleLoc = Loc;
|
|
|
}
|
|
@@ -1018,6 +1053,7 @@ public:
|
|
|
assert(i < getNumProtocols() && "Index is out of bounds!");
|
|
|
return getProtocolLocArray()[i];
|
|
|
}
|
|
|
+
|
|
|
void setProtocolLoc(unsigned i, SourceLocation Loc) {
|
|
|
assert(i < getNumProtocols() && "Index is out of bounds!");
|
|
|
getProtocolLocArray()[i] = Loc;
|
|
@@ -1073,7 +1109,6 @@ public:
|
|
|
}
|
|
|
};
|
|
|
|
|
|
-
|
|
|
struct ObjCInterfaceLocInfo {
|
|
|
SourceLocation NameLoc;
|
|
|
SourceLocation NameEndLoc;
|
|
@@ -1127,12 +1162,15 @@ public:
|
|
|
SourceLocation getLParenLoc() const {
|
|
|
return this->getLocalData()->LParenLoc;
|
|
|
}
|
|
|
+
|
|
|
SourceLocation getRParenLoc() const {
|
|
|
return this->getLocalData()->RParenLoc;
|
|
|
}
|
|
|
+
|
|
|
void setLParenLoc(SourceLocation Loc) {
|
|
|
this->getLocalData()->LParenLoc = Loc;
|
|
|
}
|
|
|
+
|
|
|
void setRParenLoc(SourceLocation Loc) {
|
|
|
this->getLocalData()->RParenLoc = Loc;
|
|
|
}
|
|
@@ -1161,8 +1199,7 @@ inline TypeLoc TypeLoc::IgnoreParens() const {
|
|
|
return *this;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-struct AdjustedLocInfo { }; // Nothing.
|
|
|
+struct AdjustedLocInfo {}; // Nothing.
|
|
|
|
|
|
class AdjustedTypeLoc : public ConcreteTypeLoc<UnqualTypeLoc, AdjustedTypeLoc,
|
|
|
AdjustedType, AdjustedLocInfo> {
|
|
@@ -1181,9 +1218,7 @@ public:
|
|
|
return getTypePtr()->getOriginalType();
|
|
|
}
|
|
|
|
|
|
- SourceRange getLocalSourceRange() const {
|
|
|
- return SourceRange();
|
|
|
- }
|
|
|
+ SourceRange getLocalSourceRange() const { return {}; }
|
|
|
|
|
|
unsigned getLocalDataSize() const {
|
|
|
// sizeof(AdjustedLocInfo) is 1, but we don't need its address to be unique
|
|
@@ -1210,6 +1245,7 @@ public:
|
|
|
SourceLocation getSigilLoc() const {
|
|
|
return this->getLocalData()->StarLoc;
|
|
|
}
|
|
|
+
|
|
|
void setSigilLoc(SourceLocation Loc) {
|
|
|
this->getLocalData()->StarLoc = Loc;
|
|
|
}
|
|
@@ -1231,7 +1267,6 @@ public:
|
|
|
}
|
|
|
};
|
|
|
|
|
|
-
|
|
|
/// \brief Wrapper for source info for pointers.
|
|
|
class PointerTypeLoc : public PointerLikeTypeLoc<PointerTypeLoc,
|
|
|
PointerType> {
|
|
@@ -1239,12 +1274,12 @@ public:
|
|
|
SourceLocation getStarLoc() const {
|
|
|
return getSigilLoc();
|
|
|
}
|
|
|
+
|
|
|
void setStarLoc(SourceLocation Loc) {
|
|
|
setSigilLoc(Loc);
|
|
|
}
|
|
|
};
|
|
|
|
|
|
-
|
|
|
/// \brief Wrapper for source info for block pointers.
|
|
|
class BlockPointerTypeLoc : public PointerLikeTypeLoc<BlockPointerTypeLoc,
|
|
|
BlockPointerType> {
|
|
@@ -1252,6 +1287,7 @@ public:
|
|
|
SourceLocation getCaretLoc() const {
|
|
|
return getSigilLoc();
|
|
|
}
|
|
|
+
|
|
|
void setCaretLoc(SourceLocation Loc) {
|
|
|
setSigilLoc(Loc);
|
|
|
}
|
|
@@ -1269,6 +1305,7 @@ public:
|
|
|
SourceLocation getStarLoc() const {
|
|
|
return getSigilLoc();
|
|
|
}
|
|
|
+
|
|
|
void setStarLoc(SourceLocation Loc) {
|
|
|
setSigilLoc(Loc);
|
|
|
}
|
|
@@ -1276,9 +1313,11 @@ public:
|
|
|
const Type *getClass() const {
|
|
|
return getTypePtr()->getClass();
|
|
|
}
|
|
|
+
|
|
|
TypeSourceInfo *getClassTInfo() const {
|
|
|
return getLocalData()->ClassTInfo;
|
|
|
}
|
|
|
+
|
|
|
void setClassTInfo(TypeSourceInfo* TI) {
|
|
|
getLocalData()->ClassTInfo = TI;
|
|
|
}
|
|
@@ -1310,7 +1349,6 @@ public:
|
|
|
}
|
|
|
};
|
|
|
|
|
|
-
|
|
|
class ReferenceTypeLoc : public PointerLikeTypeLoc<ReferenceTypeLoc,
|
|
|
ReferenceType> {
|
|
|
public:
|
|
@@ -1327,6 +1365,7 @@ public:
|
|
|
SourceLocation getAmpLoc() const {
|
|
|
return getSigilLoc();
|
|
|
}
|
|
|
+
|
|
|
void setAmpLoc(SourceLocation Loc) {
|
|
|
setSigilLoc(Loc);
|
|
|
}
|
|
@@ -1340,12 +1379,12 @@ public:
|
|
|
SourceLocation getAmpAmpLoc() const {
|
|
|
return getSigilLoc();
|
|
|
}
|
|
|
+
|
|
|
void setAmpAmpLoc(SourceLocation Loc) {
|
|
|
setSigilLoc(Loc);
|
|
|
}
|
|
|
};
|
|
|
|
|
|
-
|
|
|
struct FunctionLocInfo {
|
|
|
SourceLocation LocalRangeBegin;
|
|
|
SourceLocation LParenLoc;
|
|
@@ -1371,10 +1410,12 @@ class FunctionTypeLoc : public ConcreteTypeLoc<UnqualTypeLoc,
|
|
|
// exception specification information.
|
|
|
return (SourceRange *)(getParmArray() + getNumParams());
|
|
|
}
|
|
|
+
|
|
|
public:
|
|
|
SourceLocation getLocalRangeBegin() const {
|
|
|
return getLocalData()->LocalRangeBegin;
|
|
|
}
|
|
|
+
|
|
|
void setLocalRangeBegin(SourceLocation L) {
|
|
|
getLocalData()->LocalRangeBegin = L;
|
|
|
}
|
|
@@ -1382,6 +1423,7 @@ public:
|
|
|
SourceLocation getLocalRangeEnd() const {
|
|
|
return getLocalData()->LocalRangeEnd;
|
|
|
}
|
|
|
+
|
|
|
void setLocalRangeEnd(SourceLocation L) {
|
|
|
getLocalData()->LocalRangeEnd = L;
|
|
|
}
|
|
@@ -1389,6 +1431,7 @@ public:
|
|
|
SourceLocation getLParenLoc() const {
|
|
|
return this->getLocalData()->LParenLoc;
|
|
|
}
|
|
|
+
|
|
|
void setLParenLoc(SourceLocation Loc) {
|
|
|
this->getLocalData()->LParenLoc = Loc;
|
|
|
}
|
|
@@ -1396,6 +1439,7 @@ public:
|
|
|
SourceLocation getRParenLoc() const {
|
|
|
return this->getLocalData()->RParenLoc;
|
|
|
}
|
|
|
+
|
|
|
void setRParenLoc(SourceLocation Loc) {
|
|
|
this->getLocalData()->RParenLoc = Loc;
|
|
|
}
|
|
@@ -1407,8 +1451,9 @@ public:
|
|
|
SourceRange getExceptionSpecRange() const {
|
|
|
if (hasExceptionSpec())
|
|
|
return *getExceptionSpecRangePtr();
|
|
|
- return SourceRange();
|
|
|
+ return {};
|
|
|
}
|
|
|
+
|
|
|
void setExceptionSpecRange(SourceRange R) {
|
|
|
if (hasExceptionSpec())
|
|
|
*getExceptionSpecRangePtr() = R;
|
|
@@ -1428,6 +1473,7 @@ public:
|
|
|
return 0;
|
|
|
return cast<FunctionProtoType>(getTypePtr())->getNumParams();
|
|
|
}
|
|
|
+
|
|
|
ParmVarDecl *getParam(unsigned i) const { return getParmArray()[i]; }
|
|
|
void setParam(unsigned i, ParmVarDecl *VD) { getParmArray()[i] = VD; }
|
|
|
|
|
@@ -1474,7 +1520,6 @@ class FunctionNoProtoTypeLoc :
|
|
|
FunctionNoProtoType> {
|
|
|
};
|
|
|
|
|
|
-
|
|
|
struct ArrayLocInfo {
|
|
|
SourceLocation LBracketLoc, RBracketLoc;
|
|
|
Expr *Size;
|
|
@@ -1489,6 +1534,7 @@ public:
|
|
|
SourceLocation getLBracketLoc() const {
|
|
|
return getLocalData()->LBracketLoc;
|
|
|
}
|
|
|
+
|
|
|
void setLBracketLoc(SourceLocation Loc) {
|
|
|
getLocalData()->LBracketLoc = Loc;
|
|
|
}
|
|
@@ -1496,6 +1542,7 @@ public:
|
|
|
SourceLocation getRBracketLoc() const {
|
|
|
return getLocalData()->RBracketLoc;
|
|
|
}
|
|
|
+
|
|
|
void setRBracketLoc(SourceLocation Loc) {
|
|
|
getLocalData()->RBracketLoc = Loc;
|
|
|
}
|
|
@@ -1507,6 +1554,7 @@ public:
|
|
|
Expr *getSizeExpr() const {
|
|
|
return getLocalData()->Size;
|
|
|
}
|
|
|
+
|
|
|
void setSizeExpr(Expr *Size) {
|
|
|
getLocalData()->Size = Size;
|
|
|
}
|
|
@@ -1557,7 +1605,6 @@ class VariableArrayTypeLoc :
|
|
|
VariableArrayType> {
|
|
|
};
|
|
|
|
|
|
-
|
|
|
// Location information for a TemplateName. Rudimentary for now.
|
|
|
struct TemplateNameLocInfo {
|
|
|
SourceLocation NameLoc;
|
|
@@ -1578,6 +1625,7 @@ public:
|
|
|
SourceLocation getTemplateKeywordLoc() const {
|
|
|
return getLocalData()->TemplateKWLoc;
|
|
|
}
|
|
|
+
|
|
|
void setTemplateKeywordLoc(SourceLocation Loc) {
|
|
|
getLocalData()->TemplateKWLoc = Loc;
|
|
|
}
|
|
@@ -1585,6 +1633,7 @@ public:
|
|
|
SourceLocation getLAngleLoc() const {
|
|
|
return getLocalData()->LAngleLoc;
|
|
|
}
|
|
|
+
|
|
|
void setLAngleLoc(SourceLocation Loc) {
|
|
|
getLocalData()->LAngleLoc = Loc;
|
|
|
}
|
|
@@ -1592,6 +1641,7 @@ public:
|
|
|
SourceLocation getRAngleLoc() const {
|
|
|
return getLocalData()->RAngleLoc;
|
|
|
}
|
|
|
+
|
|
|
void setRAngleLoc(SourceLocation Loc) {
|
|
|
getLocalData()->RAngleLoc = Loc;
|
|
|
}
|
|
@@ -1599,9 +1649,11 @@ public:
|
|
|
unsigned getNumArgs() const {
|
|
|
return getTypePtr()->getNumArgs();
|
|
|
}
|
|
|
+
|
|
|
void setArgLocInfo(unsigned i, TemplateArgumentLocInfo AI) {
|
|
|
getArgInfos()[i] = AI;
|
|
|
}
|
|
|
+
|
|
|
TemplateArgumentLocInfo getArgLocInfo(unsigned i) const {
|
|
|
return getArgInfos()[i];
|
|
|
}
|
|
@@ -1613,6 +1665,7 @@ public:
|
|
|
SourceLocation getTemplateNameLoc() const {
|
|
|
return getLocalData()->NameLoc;
|
|
|
}
|
|
|
+
|
|
|
void setTemplateNameLoc(SourceLocation Loc) {
|
|
|
getLocalData()->NameLoc = Loc;
|
|
|
}
|
|
@@ -1675,9 +1728,7 @@ class DependentAddressSpaceTypeLoc
|
|
|
DependentAddressSpaceTypeLoc,
|
|
|
DependentAddressSpaceType,
|
|
|
DependentAddressSpaceLocInfo> {
|
|
|
-
|
|
|
- public:
|
|
|
-
|
|
|
+public:
|
|
|
/// The location of the attribute name, i.e.
|
|
|
/// int * __attribute__((address_space(11)))
|
|
|
/// ^~~~~~~~~~~~~
|
|
@@ -1787,6 +1838,7 @@ public:
|
|
|
SourceLocation getTypeofLoc() const {
|
|
|
return this->getLocalData()->TypeofLoc;
|
|
|
}
|
|
|
+
|
|
|
void setTypeofLoc(SourceLocation Loc) {
|
|
|
this->getLocalData()->TypeofLoc = Loc;
|
|
|
}
|
|
@@ -1794,6 +1846,7 @@ public:
|
|
|
SourceLocation getLParenLoc() const {
|
|
|
return this->getLocalData()->LParenLoc;
|
|
|
}
|
|
|
+
|
|
|
void setLParenLoc(SourceLocation Loc) {
|
|
|
this->getLocalData()->LParenLoc = Loc;
|
|
|
}
|
|
@@ -1801,6 +1854,7 @@ public:
|
|
|
SourceLocation getRParenLoc() const {
|
|
|
return this->getLocalData()->RParenLoc;
|
|
|
}
|
|
|
+
|
|
|
void setRParenLoc(SourceLocation Loc) {
|
|
|
this->getLocalData()->RParenLoc = Loc;
|
|
|
}
|
|
@@ -1808,6 +1862,7 @@ public:
|
|
|
SourceRange getParensRange() const {
|
|
|
return SourceRange(getLParenLoc(), getRParenLoc());
|
|
|
}
|
|
|
+
|
|
|
void setParensRange(SourceRange range) {
|
|
|
setLParenLoc(range.getBegin());
|
|
|
setRParenLoc(range.getEnd());
|
|
@@ -1831,6 +1886,7 @@ public:
|
|
|
Expr* getUnderlyingExpr() const {
|
|
|
return getTypePtr()->getUnderlyingExpr();
|
|
|
}
|
|
|
+
|
|
|
// Reimplemented to account for GNU/C++ extension
|
|
|
// typeof unary-expression
|
|
|
// where there are no parentheses.
|
|
@@ -1843,9 +1899,11 @@ public:
|
|
|
QualType getUnderlyingType() const {
|
|
|
return this->getTypePtr()->getUnderlyingType();
|
|
|
}
|
|
|
+
|
|
|
TypeSourceInfo* getUnderlyingTInfo() const {
|
|
|
return this->getLocalData()->UnderlyingTInfo;
|
|
|
}
|
|
|
+
|
|
|
void setUnderlyingTInfo(TypeSourceInfo* TI) const {
|
|
|
this->getLocalData()->UnderlyingTInfo = TI;
|
|
|
}
|
|
@@ -1885,6 +1943,7 @@ public:
|
|
|
TypeSourceInfo* getUnderlyingTInfo() const {
|
|
|
return getLocalData()->UnderlyingTInfo;
|
|
|
}
|
|
|
+
|
|
|
void setUnderlyingTInfo(TypeSourceInfo *TInfo) {
|
|
|
getLocalData()->UnderlyingTInfo = TInfo;
|
|
|
}
|
|
@@ -1896,6 +1955,7 @@ public:
|
|
|
SourceRange getParensRange() const {
|
|
|
return SourceRange(getLParenLoc(), getRParenLoc());
|
|
|
}
|
|
|
+
|
|
|
void setParensRange(SourceRange Range) {
|
|
|
setLParenLoc(Range.getBegin());
|
|
|
setRParenLoc(Range.getEnd());
|
|
@@ -1924,6 +1984,7 @@ public:
|
|
|
SourceLocation getTemplateNameLoc() const {
|
|
|
return getNameLoc();
|
|
|
}
|
|
|
+
|
|
|
void setTemplateNameLoc(SourceLocation Loc) {
|
|
|
setNameLoc(Loc);
|
|
|
}
|
|
@@ -1931,6 +1992,7 @@ public:
|
|
|
|
|
|
struct ElaboratedLocInfo {
|
|
|
SourceLocation ElaboratedKWLoc;
|
|
|
+
|
|
|
/// \brief Data associated with the nested-name-specifier location.
|
|
|
void *QualifierData;
|
|
|
};
|
|
@@ -1943,6 +2005,7 @@ public:
|
|
|
SourceLocation getElaboratedKeywordLoc() const {
|
|
|
return this->getLocalData()->ElaboratedKWLoc;
|
|
|
}
|
|
|
+
|
|
|
void setElaboratedKeywordLoc(SourceLocation Loc) {
|
|
|
this->getLocalData()->ElaboratedKWLoc = Loc;
|
|
|
}
|
|
@@ -2001,6 +2064,7 @@ public:
|
|
|
SourceLocation getElaboratedKeywordLoc() const {
|
|
|
return this->getLocalData()->ElaboratedKWLoc;
|
|
|
}
|
|
|
+
|
|
|
void setElaboratedKeywordLoc(SourceLocation Loc) {
|
|
|
this->getLocalData()->ElaboratedKWLoc = Loc;
|
|
|
}
|
|
@@ -2020,6 +2084,7 @@ public:
|
|
|
SourceLocation getNameLoc() const {
|
|
|
return this->getLocalData()->NameLoc;
|
|
|
}
|
|
|
+
|
|
|
void setNameLoc(SourceLocation Loc) {
|
|
|
this->getLocalData()->NameLoc = Loc;
|
|
|
}
|
|
@@ -2056,6 +2121,7 @@ public:
|
|
|
SourceLocation getElaboratedKeywordLoc() const {
|
|
|
return this->getLocalData()->ElaboratedKWLoc;
|
|
|
}
|
|
|
+
|
|
|
void setElaboratedKeywordLoc(SourceLocation Loc) {
|
|
|
this->getLocalData()->ElaboratedKWLoc = Loc;
|
|
|
}
|
|
@@ -2087,6 +2153,7 @@ public:
|
|
|
SourceLocation getTemplateKeywordLoc() const {
|
|
|
return getLocalData()->TemplateKWLoc;
|
|
|
}
|
|
|
+
|
|
|
void setTemplateKeywordLoc(SourceLocation Loc) {
|
|
|
getLocalData()->TemplateKWLoc = Loc;
|
|
|
}
|
|
@@ -2094,6 +2161,7 @@ public:
|
|
|
SourceLocation getTemplateNameLoc() const {
|
|
|
return this->getLocalData()->NameLoc;
|
|
|
}
|
|
|
+
|
|
|
void setTemplateNameLoc(SourceLocation Loc) {
|
|
|
this->getLocalData()->NameLoc = Loc;
|
|
|
}
|
|
@@ -2101,6 +2169,7 @@ public:
|
|
|
SourceLocation getLAngleLoc() const {
|
|
|
return this->getLocalData()->LAngleLoc;
|
|
|
}
|
|
|
+
|
|
|
void setLAngleLoc(SourceLocation Loc) {
|
|
|
this->getLocalData()->LAngleLoc = Loc;
|
|
|
}
|
|
@@ -2108,6 +2177,7 @@ public:
|
|
|
SourceLocation getRAngleLoc() const {
|
|
|
return this->getLocalData()->RAngleLoc;
|
|
|
}
|
|
|
+
|
|
|
void setRAngleLoc(SourceLocation Loc) {
|
|
|
this->getLocalData()->RAngleLoc = Loc;
|
|
|
}
|
|
@@ -2119,6 +2189,7 @@ public:
|
|
|
void setArgLocInfo(unsigned i, TemplateArgumentLocInfo AI) {
|
|
|
getArgInfos()[i] = AI;
|
|
|
}
|
|
|
+
|
|
|
TemplateArgumentLocInfo getArgLocInfo(unsigned i) const {
|
|
|
return getArgInfos()[i];
|
|
|
}
|
|
@@ -2160,7 +2231,6 @@ private:
|
|
|
}
|
|
|
};
|
|
|
|
|
|
-
|
|
|
struct PackExpansionTypeLocInfo {
|
|
|
SourceLocation EllipsisLoc;
|
|
|
};
|
|
@@ -2212,6 +2282,7 @@ public:
|
|
|
SourceLocation getKWLoc() const {
|
|
|
return this->getLocalData()->KWLoc;
|
|
|
}
|
|
|
+
|
|
|
void setKWLoc(SourceLocation Loc) {
|
|
|
this->getLocalData()->KWLoc = Loc;
|
|
|
}
|
|
@@ -2219,6 +2290,7 @@ public:
|
|
|
SourceLocation getLParenLoc() const {
|
|
|
return this->getLocalData()->LParenLoc;
|
|
|
}
|
|
|
+
|
|
|
void setLParenLoc(SourceLocation Loc) {
|
|
|
this->getLocalData()->LParenLoc = Loc;
|
|
|
}
|
|
@@ -2226,6 +2298,7 @@ public:
|
|
|
SourceLocation getRParenLoc() const {
|
|
|
return this->getLocalData()->RParenLoc;
|
|
|
}
|
|
|
+
|
|
|
void setRParenLoc(SourceLocation Loc) {
|
|
|
this->getLocalData()->RParenLoc = Loc;
|
|
|
}
|
|
@@ -2233,6 +2306,7 @@ public:
|
|
|
SourceRange getParensRange() const {
|
|
|
return SourceRange(getLParenLoc(), getRParenLoc());
|
|
|
}
|
|
|
+
|
|
|
void setParensRange(SourceRange Range) {
|
|
|
setLParenLoc(Range.getBegin());
|
|
|
setRParenLoc(Range.getEnd());
|
|
@@ -2287,6 +2361,7 @@ inline T TypeLoc::getAsAdjusted() const {
|
|
|
}
|
|
|
return Cur.getAs<T>();
|
|
|
}
|
|
|
-}
|
|
|
|
|
|
-#endif
|
|
|
+} // namespace clang
|
|
|
+
|
|
|
+#endif // LLVM_CLANG_AST_TYPELOC_H
|