aboutsummaryrefslogtreecommitdiff
path: root/include/clang/AST/DeclCXX.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/clang/AST/DeclCXX.h')
-rw-r--r--include/clang/AST/DeclCXX.h34
1 files changed, 31 insertions, 3 deletions
diff --git a/include/clang/AST/DeclCXX.h b/include/clang/AST/DeclCXX.h
index 88f473eb48..f5026f5c4b 100644
--- a/include/clang/AST/DeclCXX.h
+++ b/include/clang/AST/DeclCXX.h
@@ -1501,6 +1501,9 @@ class CXXConstructorDecl : public CXXMethodDecl {
/// @c !Implicit && ImplicitlyDefined.
bool ImplicitlyDefined : 1;
+ /// IsDefaulted - Whether this constructor was explicitly defaulted
+ bool ExplicitlyDefaulted : 1;
+
/// Support for base and member initializers.
/// CtorInitializers - The arguments used to initialize the base
/// or member.
@@ -1511,11 +1514,13 @@ class CXXConstructorDecl : public CXXMethodDecl {
const DeclarationNameInfo &NameInfo,
QualType T, TypeSourceInfo *TInfo,
bool isExplicitSpecified, bool isInline,
- bool isImplicitlyDeclared)
+ bool isImplicitlyDeclared, bool isExplicitlyDefaulted)
: CXXMethodDecl(CXXConstructor, RD, StartLoc, NameInfo, T, TInfo, false,
SC_None, isInline, SourceLocation()),
IsExplicitSpecified(isExplicitSpecified), ImplicitlyDefined(false),
- CtorInitializers(0), NumCtorInitializers(0) {
+ ExplicitlyDefaulted(isExplicitlyDefaulted),
+ CtorInitializers(0), NumCtorInitializers(0)
+ {
setImplicit(isImplicitlyDeclared);
}
@@ -1526,7 +1531,8 @@ public:
const DeclarationNameInfo &NameInfo,
QualType T, TypeSourceInfo *TInfo,
bool isExplicit,
- bool isInline, bool isImplicitlyDeclared);
+ bool isInline, bool isImplicitlyDeclared,
+ bool isExplicitlyDefaulted);
/// isExplicitSpecified - Whether this constructor declaration has the
/// 'explicit' keyword specified.
@@ -1558,6 +1564,28 @@ public:
ImplicitlyDefined = ID;
}
+ /// isExplicitlyDefaulted - Whether this constructor was explicitly defaulted.
+ bool isExplicitlyDefaulted() const {
+ return ExplicitlyDefaulted;
+ }
+ /// setExplicitlyDefaulted - Set whether this contructor was explicitly
+ /// defaulted or not.
+ void setExplicitlyDefaulted(bool B) {
+ ExplicitlyDefaulted = B;
+ }
+
+ /// isDefaulted - True if this was either explicitly defaulted or is implicit
+ bool isDefaulted() const {
+ return ExplicitlyDefaulted || isImplicit();
+ }
+
+ /// isUserProvided - True if this function was neither defaulted nor deleted
+ /// on its first declaration.
+ bool isUserProvided() const {
+ const CXXConstructorDecl *Canonical = getCanonicalDecl();
+ return !Canonical->isDefaulted() && !Canonical->isDeleted();
+ }
+
/// init_iterator - Iterates through the member/base initializer list.
typedef CXXCtorInitializer **init_iterator;