class UnresolvedSetImpl;
class VarTemplateDecl;
-/// A container of type source information.
-///
-/// A client can read the relevant info using TypeLoc wrappers, e.g:
-/// @code
-/// TypeLoc TL = TypeSourceInfo->getTypeLoc();
-/// TL.getBeginLoc().print(OS, SrcMgr);
-/// @endcode
-class alignas(8) TypeSourceInfo {
- // Contains a memory block after the class, used for type source information,
- // allocated by ASTContext.
- friend class ASTContext;
-
- QualType Ty;
-
- TypeSourceInfo(QualType ty) : Ty(ty) {}
-
-public:
- /// Return the type wrapped by this type source info.
- QualType getType() const { return Ty; }
-
- /// Return the TypeLoc wrapper for the type source info.
- TypeLoc getTypeLoc() const; // implemented in TypeLoc.h
-
- /// Override the type stored in this TypeSourceInfo. Use with caution!
- void overrideType(QualType T) { Ty = T; }
-};
-
/// The top declaration context.
class TranslationUnitDecl : public Decl, public DeclContext {
ASTContext &Ctx;
QualType apply(const ASTContext &Context, const Type* T) const;
};
+/// A container of type source information.
+///
+/// A client can read the relevant info using TypeLoc wrappers, e.g:
+/// @code
+/// TypeLoc TL = TypeSourceInfo->getTypeLoc();
+/// TL.getBeginLoc().print(OS, SrcMgr);
+/// @endcode
+class alignas(8) TypeSourceInfo {
+ // Contains a memory block after the class, used for type source information,
+ // allocated by ASTContext.
+ friend class ASTContext;
+
+ QualType Ty;
+
+ TypeSourceInfo(QualType ty) : Ty(ty) {}
+
+public:
+ /// Return the type wrapped by this type source info.
+ QualType getType() const { return Ty; }
+
+ /// Return the TypeLoc wrapper for the type source info.
+ TypeLoc getTypeLoc() const; // implemented in TypeLoc.h
+
+ /// Override the type stored in this TypeSourceInfo. Use with caution!
+ void overrideType(QualType T) { Ty = T; }
+};
+
// Inline function definitions.
inline SplitQualType SplitQualType::getSingleStepDesugaredType() const {
#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"
class ObjCInterfaceDecl;
class ObjCProtocolDecl;
class ObjCTypeParamDecl;
+class ParmVarDecl;
class TemplateTypeParmDecl;
class UnqualTypeLoc;
class UnresolvedUsingTypenameDecl;
TagDecl *getDecl() const { return getTypePtr()->getDecl(); }
/// True if the tag was defined in this type specifier.
- bool isDefinition() const {
- TagDecl *D = getDecl();
- return D->isCompleteDefinition() &&
- (D->getIdentifier() == nullptr || D->getLocation() == getNameLoc());
- }
+ bool isDefinition() const;
};
/// Wrapper for source info for record types.
return TSTChecker().Visit(TL);
}
+bool TagTypeLoc::isDefinition() const {
+ TagDecl *D = getDecl();
+ return D->isCompleteDefinition() &&
+ (D->getIdentifier() == nullptr || D->getLocation() == getNameLoc());
+}
+
// Reimplemented to account for GNU/C++ extension
// typeof unary-expression
// where there are no parentheses.