summaryrefslogtreecommitdiff
path: root/include/clang/AST
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2017-06-10 13:44:22 +0000
committerDimitry Andric <dim@FreeBSD.org>2017-06-10 13:44:22 +0000
commit1b08b196ac845675036ac78f3ac927d0a37f707c (patch)
tree1fbd923674e903831dc097fdb4fdfd64dd6e47b1 /include/clang/AST
parent551c698530debaae81139c7c76a29fb762793362 (diff)
Notes
Diffstat (limited to 'include/clang/AST')
-rw-r--r--include/clang/AST/Decl.h58
-rw-r--r--include/clang/AST/ExternalASTMerger.h2
-rw-r--r--include/clang/AST/RecursiveASTVisitor.h16
3 files changed, 61 insertions, 15 deletions
diff --git a/include/clang/AST/Decl.h b/include/clang/AST/Decl.h
index 4f8042ac92918..9d49bac26a868 100644
--- a/include/clang/AST/Decl.h
+++ b/include/clang/AST/Decl.h
@@ -851,6 +851,7 @@ protected:
class NonParmVarDeclBitfields {
friend class VarDecl;
+ friend class ImplicitParamDecl;
friend class ASTDeclReader;
unsigned : NumVarDeclBits;
@@ -894,6 +895,10 @@ protected:
/// declared in the same block scope. This controls whether we should merge
/// the type of this declaration with its previous declaration.
unsigned PreviousDeclInSameBlockScope : 1;
+
+ /// Defines kind of the ImplicitParamDecl: 'this', 'self', 'vtt', '_cmd' or
+ /// something else.
+ unsigned ImplicitParamKind : 3;
};
union {
@@ -1376,20 +1381,50 @@ public:
class ImplicitParamDecl : public VarDecl {
void anchor() override;
+
public:
+ /// Defines the kind of the implicit parameter: is this an implicit parameter
+ /// with pointer to 'this', 'self', '_cmd', virtual table pointers, captured
+ /// context or something else.
+ enum ImplicitParamKind : unsigned {
+ ObjCSelf, /// Parameter for Objective-C 'self' argument
+ ObjCCmd, /// Parameter for Objective-C '_cmd' argument
+ CXXThis, /// Parameter for C++ 'this' argument
+ CXXVTT, /// Parameter for C++ virtual table pointers
+ CapturedContext, /// Parameter for captured context
+ Other, /// Other implicit parameter
+ };
+
+ /// Create implicit parameter.
static ImplicitParamDecl *Create(ASTContext &C, DeclContext *DC,
SourceLocation IdLoc, IdentifierInfo *Id,
- QualType T);
+ QualType T, ImplicitParamKind ParamKind);
+ static ImplicitParamDecl *Create(ASTContext &C, QualType T,
+ ImplicitParamKind ParamKind);
static ImplicitParamDecl *CreateDeserialized(ASTContext &C, unsigned ID);
ImplicitParamDecl(ASTContext &C, DeclContext *DC, SourceLocation IdLoc,
- IdentifierInfo *Id, QualType Type)
- : VarDecl(ImplicitParam, C, DC, IdLoc, IdLoc, Id, Type,
- /*tinfo*/ nullptr, SC_None) {
+ IdentifierInfo *Id, QualType Type,
+ ImplicitParamKind ParamKind)
+ : VarDecl(ImplicitParam, C, DC, IdLoc, IdLoc, Id, Type,
+ /*TInfo=*/nullptr, SC_None) {
+ NonParmVarDeclBits.ImplicitParamKind = ParamKind;
+ setImplicit();
+ }
+
+ ImplicitParamDecl(ASTContext &C, QualType Type, ImplicitParamKind ParamKind)
+ : VarDecl(ImplicitParam, C, /*DC=*/nullptr, SourceLocation(),
+ SourceLocation(), /*Id=*/nullptr, Type,
+ /*TInfo=*/nullptr, SC_None) {
+ NonParmVarDeclBits.ImplicitParamKind = ParamKind;
setImplicit();
}
+ /// Returns the implicit parameter kind.
+ ImplicitParamKind getParameterKind() const {
+ return static_cast<ImplicitParamKind>(NonParmVarDeclBits.ImplicitParamKind);
+ }
// Implement isa/cast/dyncast/etc.
static bool classof(const Decl *D) { return classofKind(D->getKind()); }
static bool classofKind(Kind K) { return K == ImplicitParam; }
@@ -1829,14 +1864,15 @@ public:
return getBody(Definition);
}
- /// isThisDeclarationADefinition - Returns whether this specific
- /// declaration of the function is also a definition. This does not
- /// determine whether the function has been defined (e.g., in a
- /// previous definition); for that information, use isDefined. Note
- /// that this returns false for a defaulted function unless that function
- /// has been implicitly defined (possibly as deleted).
+ /// Returns whether this specific declaration of the function is also a
+ /// definition that does not contain uninstantiated body.
+ ///
+ /// This does not determine whether the function has been defined (e.g., in a
+ /// previous definition); for that information, use isDefined.
+ ///
bool isThisDeclarationADefinition() const {
- return IsDeleted || Body || IsLateTemplateParsed;
+ return IsDeleted || IsDefaulted || Body || IsLateTemplateParsed ||
+ hasDefiningAttr();
}
/// doesThisDeclarationHaveABody - Returns whether this specific
diff --git a/include/clang/AST/ExternalASTMerger.h b/include/clang/AST/ExternalASTMerger.h
index 55459df1fe6ba..92d7b39c48d2f 100644
--- a/include/clang/AST/ExternalASTMerger.h
+++ b/include/clang/AST/ExternalASTMerger.h
@@ -45,6 +45,8 @@ public:
llvm::function_ref<bool(Decl::Kind)> IsKindWeWant,
SmallVectorImpl<Decl *> &Result) override;
+ using ExternalASTSource::CompleteType;
+
void CompleteType(TagDecl *Tag) override;
};
diff --git a/include/clang/AST/RecursiveASTVisitor.h b/include/clang/AST/RecursiveASTVisitor.h
index cd2a39449825b..ad3f40d0d3f64 100644
--- a/include/clang/AST/RecursiveASTVisitor.h
+++ b/include/clang/AST/RecursiveASTVisitor.h
@@ -1021,8 +1021,12 @@ DEF_TRAVERSE_TYPE(DeducedTemplateSpecializationType, {
DEF_TRAVERSE_TYPE(RecordType, {})
DEF_TRAVERSE_TYPE(EnumType, {})
DEF_TRAVERSE_TYPE(TemplateTypeParmType, {})
-DEF_TRAVERSE_TYPE(SubstTemplateTypeParmType, {})
-DEF_TRAVERSE_TYPE(SubstTemplateTypeParmPackType, {})
+DEF_TRAVERSE_TYPE(SubstTemplateTypeParmType, {
+ TRY_TO(TraverseType(T->getReplacementType()));
+})
+DEF_TRAVERSE_TYPE(SubstTemplateTypeParmPackType, {
+ TRY_TO(TraverseTemplateArgument(T->getArgumentPack()));
+})
DEF_TRAVERSE_TYPE(TemplateSpecializationType, {
TRY_TO(TraverseTemplateName(T->getTemplateName()));
@@ -1249,8 +1253,12 @@ DEF_TRAVERSE_TYPELOC(DeducedTemplateSpecializationType, {
DEF_TRAVERSE_TYPELOC(RecordType, {})
DEF_TRAVERSE_TYPELOC(EnumType, {})
DEF_TRAVERSE_TYPELOC(TemplateTypeParmType, {})
-DEF_TRAVERSE_TYPELOC(SubstTemplateTypeParmType, {})
-DEF_TRAVERSE_TYPELOC(SubstTemplateTypeParmPackType, {})
+DEF_TRAVERSE_TYPELOC(SubstTemplateTypeParmType, {
+ TRY_TO(TraverseType(TL.getTypePtr()->getReplacementType()));
+})
+DEF_TRAVERSE_TYPELOC(SubstTemplateTypeParmPackType, {
+ TRY_TO(TraverseTemplateArgument(TL.getTypePtr()->getArgumentPack()));
+})
// FIXME: use the loc for the template name?
DEF_TRAVERSE_TYPELOC(TemplateSpecializationType, {