summaryrefslogtreecommitdiffstats
path: root/include/clang/AST
diff options
context:
space:
mode:
authordim <dim@FreeBSD.org>2015-07-05 14:23:59 +0000
committerdim <dim@FreeBSD.org>2015-07-05 14:23:59 +0000
commite7bcad327814a78ecb8d5f5545d2e3df84c67a5c (patch)
treeac719b5984165053bf83d71142e4d96b609b9784 /include/clang/AST
parent9dd834653b811ad20382e98a87dff824980c9916 (diff)
downloadFreeBSD-src-e7bcad327814a78ecb8d5f5545d2e3df84c67a5c.zip
FreeBSD-src-e7bcad327814a78ecb8d5f5545d2e3df84c67a5c.tar.gz
Vendor import of clang trunk r241361:
https://llvm.org/svn/llvm-project/cfe/trunk@241361
Diffstat (limited to 'include/clang/AST')
-rw-r--r--include/clang/AST/ASTContext.h14
-rw-r--r--include/clang/AST/ASTMutationListener.h10
-rw-r--r--include/clang/AST/DataRecursiveASTVisitor.h20
-rw-r--r--include/clang/AST/EvaluatedExprVisitor.h6
-rw-r--r--include/clang/AST/ExprObjC.h2
-rw-r--r--include/clang/AST/ExternalASTSource.h14
-rw-r--r--include/clang/AST/Mangle.h4
-rw-r--r--include/clang/AST/NSAPI.h3
-rw-r--r--include/clang/AST/OpenMPClause.h88
-rw-r--r--include/clang/AST/RecursiveASTVisitor.h24
-rw-r--r--include/clang/AST/StmtIterator.h10
-rw-r--r--include/clang/AST/StmtOpenMP.h115
-rw-r--r--include/clang/AST/Type.h1
13 files changed, 292 insertions, 19 deletions
diff --git a/include/clang/AST/ASTContext.h b/include/clang/AST/ASTContext.h
index da288c4..682be3d 100644
--- a/include/clang/AST/ASTContext.h
+++ b/include/clang/AST/ASTContext.h
@@ -1664,6 +1664,9 @@ public:
TypeInfo getTypeInfo(const Type *T) const;
TypeInfo getTypeInfo(QualType T) const { return getTypeInfo(T.getTypePtr()); }
+ /// \brief Get default simd alignment of the specified complete type in bits.
+ unsigned getOpenMPDefaultSimdAlign(QualType T) const;
+
/// \brief Return the size of the specified (complete) type \p T, in bits.
uint64_t getTypeSize(QualType T) const { return getTypeInfo(T).Width; }
uint64_t getTypeSize(const Type *T) const { return getTypeInfo(T).Width; }
@@ -1780,6 +1783,17 @@ public:
/// \param method should be the declaration from the class definition
void setNonKeyFunction(const CXXMethodDecl *method);
+ /// Loading virtual member pointers using the virtual inheritance model
+ /// always results in an adjustment using the vbtable even if the index is
+ /// zero.
+ ///
+ /// This is usually OK because the first slot in the vbtable points
+ /// backwards to the top of the MDC. However, the MDC might be reusing a
+ /// vbptr from an nv-base. In this case, the first slot in the vbtable
+ /// points to the start of the nv-base which introduced the vbptr and *not*
+ /// the MDC. Modify the NonVirtualBaseAdjustment to account for this.
+ CharUnits getOffsetOfBaseWithVBPtr(const CXXRecordDecl *RD) const;
+
/// Get the offset of a FieldDecl or IndirectFieldDecl, in bits.
uint64_t getFieldOffset(const ValueDecl *FD) const;
diff --git a/include/clang/AST/ASTMutationListener.h b/include/clang/AST/ASTMutationListener.h
index 4f3acc3..f4026e9 100644
--- a/include/clang/AST/ASTMutationListener.h
+++ b/include/clang/AST/ASTMutationListener.h
@@ -14,6 +14,7 @@
#define LLVM_CLANG_AST_ASTMUTATIONLISTENER_H
namespace clang {
+ class Attr;
class ClassTemplateDecl;
class ClassTemplateSpecializationDecl;
class CXXDestructorDecl;
@@ -29,6 +30,7 @@ namespace clang {
class ObjCInterfaceDecl;
class ObjCPropertyDecl;
class QualType;
+ class RecordDecl;
class TagDecl;
class VarDecl;
class VarTemplateDecl;
@@ -119,6 +121,14 @@ public:
/// \param M The containing module in which the definition was made visible,
/// if any.
virtual void RedefinedHiddenDefinition(const NamedDecl *D, Module *M) {}
+
+ /// \brief An attribute was added to a RecordDecl
+ ///
+ /// \param Attr The attribute that was added to the Record
+ ///
+ /// \param Record The RecordDecl that got a new attribute
+ virtual void AddedAttributeToRecord(const Attr *Attr,
+ const RecordDecl *Record) {}
// NOTE: If new methods are added they should also be added to
// MultiplexASTMutationListener.
diff --git a/include/clang/AST/DataRecursiveASTVisitor.h b/include/clang/AST/DataRecursiveASTVisitor.h
index ef88176..923d98f 100644
--- a/include/clang/AST/DataRecursiveASTVisitor.h
+++ b/include/clang/AST/DataRecursiveASTVisitor.h
@@ -1861,8 +1861,8 @@ DEF_TRAVERSE_DECL(ParmVarDecl, {
TRY_TO(WalkUpFrom##STMT(S)); \
StmtQueueAction StmtQueue(*this); \
{ CODE; } \
- for (Stmt::child_range range = S->children(); range; ++range) { \
- StmtQueue.queue(*range); \
+ for (Stmt *SubStmt : S->children()) { \
+ StmtQueue.queue(SubStmt); \
} \
return true; \
}
@@ -2011,8 +2011,8 @@ bool RecursiveASTVisitor<Derived>::TraverseInitListExpr(InitListExpr *S) {
TRY_TO(WalkUpFromInitListExpr(S));
StmtQueueAction StmtQueue(*this);
// All we need are the default actions. FIXME: use a helper function.
- for (Stmt::child_range range = S->children(); range; ++range) {
- StmtQueue.queue(*range);
+ for (Stmt *SubStmt : S->children()) {
+ StmtQueue.queue(SubStmt);
}
return true;
}
@@ -2358,6 +2358,12 @@ DEF_TRAVERSE_STMT(OMPTaskwaitDirective,
DEF_TRAVERSE_STMT(OMPTaskgroupDirective,
{ TRY_TO(TraverseOMPExecutableDirective(S)); })
+DEF_TRAVERSE_STMT(OMPCancellationPointDirective,
+ { TRY_TO(TraverseOMPExecutableDirective(S)); })
+
+DEF_TRAVERSE_STMT(OMPCancelDirective,
+ { TRY_TO(TraverseOMPExecutableDirective(S)); })
+
DEF_TRAVERSE_STMT(OMPFlushDirective,
{ TRY_TO(TraverseOMPExecutableDirective(S)); })
@@ -2622,6 +2628,12 @@ bool RecursiveASTVisitor<Derived>::VisitOMPFlushClause(OMPFlushClause *C) {
return true;
}
+template <typename Derived>
+bool RecursiveASTVisitor<Derived>::VisitOMPDependClause(OMPDependClause *C) {
+ TRY_TO(VisitOMPClauseList(C));
+ return true;
+}
+
// FIXME: look at the following tricky-seeming exprs to see if we
// need to recurse on anything. These are ones that have methods
// returning decls or qualtypes or nestednamespecifier -- though I'm
diff --git a/include/clang/AST/EvaluatedExprVisitor.h b/include/clang/AST/EvaluatedExprVisitor.h
index 5cae5d9..ad52873 100644
--- a/include/clang/AST/EvaluatedExprVisitor.h
+++ b/include/clang/AST/EvaluatedExprVisitor.h
@@ -98,9 +98,9 @@ public:
/// \brief The basis case walks all of the children of the statement or
/// expression, assuming they are all potentially evaluated.
void VisitStmt(PTR(Stmt) S) {
- for (auto C = S->children(); C; ++C)
- if (*C)
- this->Visit(*C);
+ for (auto *SubStmt : S->children())
+ if (SubStmt)
+ this->Visit(SubStmt);
}
#undef PTR
diff --git a/include/clang/AST/ExprObjC.h b/include/clang/AST/ExprObjC.h
index f296e8f..899e648 100644
--- a/include/clang/AST/ExprObjC.h
+++ b/include/clang/AST/ExprObjC.h
@@ -86,7 +86,7 @@ public:
};
/// ObjCBoxedExpr - used for generalized expression boxing.
-/// as in: @(strdup("hello world")) or @(random())
+/// as in: @(strdup("hello world")), @(random()) or @(view.frame)
/// Also used for boxing non-parenthesized numeric literals;
/// as in: @42 or \@true (c++/objc++) or \@__yes (c/objc).
class ObjCBoxedExpr : public Expr {
diff --git a/include/clang/AST/ExternalASTSource.h b/include/clang/AST/ExternalASTSource.h
index 9a76080..08c2e0c 100644
--- a/include/clang/AST/ExternalASTSource.h
+++ b/include/clang/AST/ExternalASTSource.h
@@ -156,6 +156,20 @@ public:
/// \brief Retrieve the module that corresponds to the given module ID.
virtual Module *getModule(unsigned ID) { return nullptr; }
+ /// \brief Holds everything needed to generate debug info for an
+ /// imported module or precompiled header file.
+ struct ASTSourceDescriptor {
+ std::string ModuleName;
+ std::string Path;
+ std::string ASTFile;
+ uint64_t Signature;
+ };
+
+ /// \brief Return a descriptor for the corresponding module, if one exists.
+ virtual llvm::Optional<ASTSourceDescriptor> getSourceDescriptor(unsigned ID);
+ /// \brief Return a descriptor for the module.
+ virtual ASTSourceDescriptor getSourceDescriptor(const Module &M);
+
/// \brief Finds all declarations lexically contained within the given
/// DeclContext, after applying an optional filter predicate.
///
diff --git a/include/clang/AST/Mangle.h b/include/clang/AST/Mangle.h
index c5a7ea1..735ae11 100644
--- a/include/clang/AST/Mangle.h
+++ b/include/clang/AST/Mangle.h
@@ -204,6 +204,10 @@ public:
virtual void mangleVirtualMemPtrThunk(const CXXMethodDecl *MD,
raw_ostream &) = 0;
+ virtual void mangleCXXVirtualDisplacementMap(const CXXRecordDecl *SrcRD,
+ const CXXRecordDecl *DstRD,
+ raw_ostream &Out) = 0;
+
virtual void mangleCXXThrowInfo(QualType T, bool IsConst, bool IsVolatile,
uint32_t NumEntries, raw_ostream &Out) = 0;
diff --git a/include/clang/AST/NSAPI.h b/include/clang/AST/NSAPI.h
index fc994c1..ce2c7ce 100644
--- a/include/clang/AST/NSAPI.h
+++ b/include/clang/AST/NSAPI.h
@@ -37,8 +37,9 @@ public:
ClassId_NSMutableSet,
ClassId_NSCountedSet,
ClassId_NSMutableOrderedSet,
+ ClassId_NSValue
};
- static const unsigned NumClassIds = 10;
+ static const unsigned NumClassIds = 11;
enum NSStringMethodKind {
NSStr_stringWithString,
diff --git a/include/clang/AST/OpenMPClause.h b/include/clang/AST/OpenMPClause.h
index 386c8dd..fcfa1dd 100644
--- a/include/clang/AST/OpenMPClause.h
+++ b/include/clang/AST/OpenMPClause.h
@@ -2212,6 +2212,94 @@ public:
}
};
+/// \brief This represents implicit clause 'depend' for the '#pragma omp task'
+/// directive.
+///
+/// \code
+/// #pragma omp task depend(in:a,b)
+/// \endcode
+/// In this example directive '#pragma omp task' with clause 'depend' with the
+/// variables 'a' and 'b' with dependency 'in'.
+///
+class OMPDependClause : public OMPVarListClause<OMPDependClause> {
+ friend class OMPClauseReader;
+ /// \brief Dependency type (one of in, out, inout).
+ OpenMPDependClauseKind DepKind;
+ /// \brief Dependency type location.
+ SourceLocation DepLoc;
+ /// \brief Colon location.
+ SourceLocation ColonLoc;
+ /// \brief Build clause with number of variables \a N.
+ ///
+ /// \param StartLoc Starting location of the clause.
+ /// \param LParenLoc Location of '('.
+ /// \param EndLoc Ending location of the clause.
+ /// \param N Number of the variables in the clause.
+ ///
+ OMPDependClause(SourceLocation StartLoc, SourceLocation LParenLoc,
+ SourceLocation EndLoc, unsigned N)
+ : OMPVarListClause<OMPDependClause>(OMPC_depend, StartLoc, LParenLoc,
+ EndLoc, N),
+ DepKind(OMPC_DEPEND_unknown) {}
+
+ /// \brief Build an empty clause.
+ ///
+ /// \param N Number of variables.
+ ///
+ explicit OMPDependClause(unsigned N)
+ : OMPVarListClause<OMPDependClause>(OMPC_depend, SourceLocation(),
+ SourceLocation(), SourceLocation(),
+ N),
+ DepKind(OMPC_DEPEND_unknown) {}
+ /// \brief Set dependency kind.
+ void setDependencyKind(OpenMPDependClauseKind K) { DepKind = K; }
+
+ /// \brief Set dependency kind and its location.
+ void setDependencyLoc(SourceLocation Loc) { DepLoc = Loc; }
+
+ /// \brief Set colon location.
+ void setColonLoc(SourceLocation Loc) { ColonLoc = Loc; }
+
+public:
+ /// \brief Creates clause with a list of variables \a VL.
+ ///
+ /// \param C AST context.
+ /// \param StartLoc Starting location of the clause.
+ /// \param LParenLoc Location of '('.
+ /// \param EndLoc Ending location of the clause.
+ /// \param DepKind Dependency type.
+ /// \param DepLoc Location of the dependency type.
+ /// \param ColonLoc Colon location.
+ /// \param VL List of references to the variables.
+ ///
+ static OMPDependClause *
+ Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc,
+ SourceLocation EndLoc, OpenMPDependClauseKind DepKind,
+ SourceLocation DepLoc, SourceLocation ColonLoc, ArrayRef<Expr *> VL);
+ /// \brief Creates an empty clause with \a N variables.
+ ///
+ /// \param C AST context.
+ /// \param N The number of variables.
+ ///
+ static OMPDependClause *CreateEmpty(const ASTContext &C, unsigned N);
+
+ /// \brief Get dependency type.
+ OpenMPDependClauseKind getDependencyKind() const { return DepKind; }
+ /// \brief Get dependency type location.
+ SourceLocation getDependencyLoc() const { return DepLoc; }
+ /// \brief Get colon location.
+ SourceLocation getColonLoc() const { return ColonLoc; }
+
+ StmtRange children() {
+ return StmtRange(reinterpret_cast<Stmt **>(varlist_begin()),
+ reinterpret_cast<Stmt **>(varlist_end()));
+ }
+
+ static bool classof(const OMPClause *T) {
+ return T->getClauseKind() == OMPC_depend;
+ }
+};
+
} // end namespace clang
#endif
diff --git a/include/clang/AST/RecursiveASTVisitor.h b/include/clang/AST/RecursiveASTVisitor.h
index 95d7730..b118503 100644
--- a/include/clang/AST/RecursiveASTVisitor.h
+++ b/include/clang/AST/RecursiveASTVisitor.h
@@ -1881,8 +1881,8 @@ DEF_TRAVERSE_DECL(ParmVarDecl, {
bool RecursiveASTVisitor<Derived>::Traverse##STMT(STMT *S) { \
TRY_TO(WalkUpFrom##STMT(S)); \
{ CODE; } \
- for (Stmt::child_range range = S->children(); range; ++range) { \
- TRY_TO(TraverseStmt(*range)); \
+ for (Stmt *SubStmt : S->children()) { \
+ TRY_TO(TraverseStmt(SubStmt)); \
} \
return true; \
}
@@ -2038,15 +2038,15 @@ bool RecursiveASTVisitor<Derived>::TraverseInitListExpr(InitListExpr *S) {
if (Syn) {
TRY_TO(WalkUpFromInitListExpr(Syn));
// All we need are the default actions. FIXME: use a helper function.
- for (Stmt::child_range range = Syn->children(); range; ++range) {
- TRY_TO(TraverseStmt(*range));
+ for (Stmt *SubStmt : Syn->children()) {
+ TRY_TO(TraverseStmt(SubStmt));
}
}
InitListExpr *Sem = S->isSemanticForm() ? S : S->getSemanticForm();
if (Sem) {
TRY_TO(WalkUpFromInitListExpr(Sem));
- for (Stmt::child_range range = Sem->children(); range; ++range) {
- TRY_TO(TraverseStmt(*range));
+ for (Stmt *SubStmt : Sem->children()) {
+ TRY_TO(TraverseStmt(SubStmt));
}
}
return true;
@@ -2391,6 +2391,12 @@ DEF_TRAVERSE_STMT(OMPTaskwaitDirective,
DEF_TRAVERSE_STMT(OMPTaskgroupDirective,
{ TRY_TO(TraverseOMPExecutableDirective(S)); })
+DEF_TRAVERSE_STMT(OMPCancellationPointDirective,
+ { TRY_TO(TraverseOMPExecutableDirective(S)); })
+
+DEF_TRAVERSE_STMT(OMPCancelDirective,
+ { TRY_TO(TraverseOMPExecutableDirective(S)); })
+
DEF_TRAVERSE_STMT(OMPFlushDirective,
{ TRY_TO(TraverseOMPExecutableDirective(S)); })
@@ -2655,6 +2661,12 @@ bool RecursiveASTVisitor<Derived>::VisitOMPFlushClause(OMPFlushClause *C) {
return true;
}
+template <typename Derived>
+bool RecursiveASTVisitor<Derived>::VisitOMPDependClause(OMPDependClause *C) {
+ TRY_TO(VisitOMPClauseList(C));
+ return true;
+}
+
// FIXME: look at the following tricky-seeming exprs to see if we
// need to recurse on anything. These are ones that have methods
// returning decls or qualtypes or nestednamespecifier -- though I'm
diff --git a/include/clang/AST/StmtIterator.h b/include/clang/AST/StmtIterator.h
index ec7329a..a5a57af 100644
--- a/include/clang/AST/StmtIterator.h
+++ b/include/clang/AST/StmtIterator.h
@@ -32,8 +32,10 @@ protected:
enum { StmtMode = 0x0, SizeOfTypeVAMode = 0x1, DeclGroupMode = 0x2,
Flags = 0x3 };
- Stmt **stmt;
- Decl **DGI;
+ union {
+ Stmt **stmt;
+ Decl **DGI;
+ };
uintptr_t RawVAPtr;
Decl **DGE;
@@ -64,10 +66,10 @@ protected:
Stmt*& GetDeclExpr() const;
- StmtIteratorBase(Stmt **s) : stmt(s), DGI(nullptr), RawVAPtr(0) {}
+ StmtIteratorBase(Stmt **s) : stmt(s), RawVAPtr(0) {}
StmtIteratorBase(const VariableArrayType *t);
StmtIteratorBase(Decl **dgi, Decl **dge);
- StmtIteratorBase() : stmt(nullptr), DGI(nullptr), RawVAPtr(0) {}
+ StmtIteratorBase() : stmt(nullptr), RawVAPtr(0) {}
};
diff --git a/include/clang/AST/StmtOpenMP.h b/include/clang/AST/StmtOpenMP.h
index 63f295d..b412daa 100644
--- a/include/clang/AST/StmtOpenMP.h
+++ b/include/clang/AST/StmtOpenMP.h
@@ -1856,6 +1856,121 @@ public:
}
};
+/// \brief This represents '#pragma omp cancellation point' directive.
+///
+/// \code
+/// #pragma omp cancellation point for
+/// \endcode
+///
+/// In this example a cancellation point is created for innermost 'for' region.
+class OMPCancellationPointDirective : public OMPExecutableDirective {
+ friend class ASTStmtReader;
+ OpenMPDirectiveKind CancelRegion;
+ /// \brief Build directive with the given start and end location.
+ ///
+ /// \param StartLoc Starting location of the directive kind.
+ /// \param EndLoc Ending location of the directive.
+ ///
+ OMPCancellationPointDirective(SourceLocation StartLoc, SourceLocation EndLoc)
+ : OMPExecutableDirective(this, OMPCancellationPointDirectiveClass,
+ OMPD_cancellation_point, StartLoc, EndLoc, 0, 0),
+ CancelRegion(OMPD_unknown) {}
+
+ /// \brief Build an empty directive.
+ ///
+ explicit OMPCancellationPointDirective()
+ : OMPExecutableDirective(this, OMPCancellationPointDirectiveClass,
+ OMPD_cancellation_point, SourceLocation(),
+ SourceLocation(), 0, 0),
+ CancelRegion(OMPD_unknown) {}
+
+ /// \brief Set cancel region for current cancellation point.
+ /// \param CR Cancellation region.
+ void setCancelRegion(OpenMPDirectiveKind CR) { CancelRegion = CR; }
+
+public:
+ /// \brief Creates directive.
+ ///
+ /// \param C AST context.
+ /// \param StartLoc Starting location of the directive kind.
+ /// \param EndLoc Ending Location of the directive.
+ ///
+ static OMPCancellationPointDirective *
+ Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
+ OpenMPDirectiveKind CancelRegion);
+
+ /// \brief Creates an empty directive.
+ ///
+ /// \param C AST context.
+ ///
+ static OMPCancellationPointDirective *CreateEmpty(const ASTContext &C,
+ EmptyShell);
+
+ /// \brief Get cancellation region for the current cancellation point.
+ OpenMPDirectiveKind getCancelRegion() const { return CancelRegion; }
+
+ static bool classof(const Stmt *T) {
+ return T->getStmtClass() == OMPCancellationPointDirectiveClass;
+ }
+};
+
+/// \brief This represents '#pragma omp cancel' directive.
+///
+/// \code
+/// #pragma omp cancel for
+/// \endcode
+///
+/// In this example a cancel is created for innermost 'for' region.
+class OMPCancelDirective : public OMPExecutableDirective {
+ friend class ASTStmtReader;
+ OpenMPDirectiveKind CancelRegion;
+ /// \brief Build directive with the given start and end location.
+ ///
+ /// \param StartLoc Starting location of the directive kind.
+ /// \param EndLoc Ending location of the directive.
+ ///
+ OMPCancelDirective(SourceLocation StartLoc, SourceLocation EndLoc)
+ : OMPExecutableDirective(this, OMPCancelDirectiveClass, OMPD_cancel,
+ StartLoc, EndLoc, 0, 0),
+ CancelRegion(OMPD_unknown) {}
+
+ /// \brief Build an empty directive.
+ ///
+ explicit OMPCancelDirective()
+ : OMPExecutableDirective(this, OMPCancelDirectiveClass, OMPD_cancel,
+ SourceLocation(), SourceLocation(), 0, 0),
+ CancelRegion(OMPD_unknown) {}
+
+ /// \brief Set cancel region for current cancellation point.
+ /// \param CR Cancellation region.
+ void setCancelRegion(OpenMPDirectiveKind CR) { CancelRegion = CR; }
+
+public:
+ /// \brief Creates directive.
+ ///
+ /// \param C AST context.
+ /// \param StartLoc Starting location of the directive kind.
+ /// \param EndLoc Ending Location of the directive.
+ ///
+ static OMPCancelDirective *Create(const ASTContext &C,
+ SourceLocation StartLoc,
+ SourceLocation EndLoc,
+ OpenMPDirectiveKind CancelRegion);
+
+ /// \brief Creates an empty directive.
+ ///
+ /// \param C AST context.
+ ///
+ static OMPCancelDirective *CreateEmpty(const ASTContext &C, EmptyShell);
+
+ /// \brief Get cancellation region for the current cancellation point.
+ OpenMPDirectiveKind getCancelRegion() const { return CancelRegion; }
+
+ static bool classof(const Stmt *T) {
+ return T->getStmtClass() == OMPCancelDirectiveClass;
+ }
+};
+
} // end namespace clang
#endif
diff --git a/include/clang/AST/Type.h b/include/clang/AST/Type.h
index d903b9d..97f1331 100644
--- a/include/clang/AST/Type.h
+++ b/include/clang/AST/Type.h
@@ -1564,6 +1564,7 @@ public:
bool isRecordType() const;
bool isClassType() const;
bool isStructureType() const;
+ bool isObjCBoxableRecordType() const;
bool isInterfaceType() const;
bool isStructureOrClassType() const;
bool isUnionType() const;
OpenPOWER on IntegriCloud