Skip to content

Commit ed5e0b6

Browse files
committed
Merge from 'main' to 'sycl-web' (24 commits)
CONFLICT (content): Merge conflict in clang/lib/Driver/Driver.cpp
2 parents bf07170 + 78ed64d commit ed5e0b6

File tree

93 files changed

+2044
-826
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

93 files changed

+2044
-826
lines changed

clang/docs/ReleaseNotes.rst

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,21 @@ code bases.
161161
- The ``-fexperimental-new-pass-manager`` and ``-fno-legacy-pass-manager``
162162
flags have been removed. These have been no-ops since 15.0.0.
163163

164+
- As a side effect of implementing DR692/DR1395/DR1432, Clang now rejects some
165+
overloaded function templates as ambiguous when one of the candidates has a
166+
trailing parameter pack.
167+
168+
.. code-block:: c++
169+
170+
template <typename T> void g(T, T = T());
171+
template <typename T, typename... U> void g(T, U...);
172+
void h() {
173+
// This is rejected due to ambiguity between the pack and the
174+
// default argument. Only parameters with arguments are considered during
175+
// partial ordering of function templates.
176+
g(42);
177+
}
178+
164179
What's New in Clang |release|?
165180
==============================
166181
Some of the major new features and improvements to Clang are listed
@@ -551,10 +566,10 @@ C2x Feature Support
551566
552567
C++ Language Changes in Clang
553568
-----------------------------
554-
- Implemented DR692, DR1395 and DR1432. Use the ``-fclang-abi-compat=15`` option
555-
to get the old partial ordering behavior regarding packs. Note that the fix for
556-
DR1432 is speculative that there is no wording or even resolution for this issue.
557-
A speculative fix for DR1432 is needed because it fixes regressions caused by DR692.
569+
- Implemented `DR692 <https://wg21.link/cwg692>`_, `DR1395 <https://wg21.link/cwg1395>`_,
570+
and `DR1432 <https://wg21.link/cwg1432>`_. The fix for DR1432 is speculative since the
571+
issue is still open and has no proposed resolution at this time. A speculative fix
572+
for DR1432 is needed to prevent regressions that would otherwise occur due to DR692.
558573
- Clang's default C++/ObjC++ standard is now ``gnu++17`` instead of ``gnu++14``.
559574
This means Clang will by default accept code using features from C++17 and
560575
conforming GNU extensions. Projects incompatible with C++17 can add

clang/include/clang-c/Index.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1978,7 +1978,11 @@ enum CXCursorKind {
19781978
*/
19791979
CXCursor_OMPParallelMaskedTaskLoopSimdDirective = 304,
19801980

1981-
CXCursor_LastStmt = CXCursor_OMPParallelMaskedTaskLoopSimdDirective,
1981+
/** OpenMP error directive.
1982+
*/
1983+
CXCursor_OMPErrorDirective = 305,
1984+
1985+
CXCursor_LastStmt = CXCursor_OMPErrorDirective,
19821986

19831987
/**
19841988
* Cursor that represents the translation unit itself.

clang/include/clang/AST/RecursiveASTVisitor.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3168,6 +3168,10 @@ DEF_TRAVERSE_STMT(OMPParallelGenericLoopDirective,
31683168

31693169
DEF_TRAVERSE_STMT(OMPTargetParallelGenericLoopDirective,
31703170
{ TRY_TO(TraverseOMPExecutableDirective(S)); })
3171+
3172+
DEF_TRAVERSE_STMT(OMPErrorDirective,
3173+
{ TRY_TO(TraverseOMPExecutableDirective(S)); })
3174+
31713175
// OpenMP clauses.
31723176
template <typename Derived>
31733177
bool RecursiveASTVisitor<Derived>::TraverseOMPClause(OMPClause *C) {

clang/include/clang/AST/StmtOpenMP.h

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6220,6 +6220,51 @@ class OMPTargetParallelGenericLoopDirective final : public OMPLoopDirective {
62206220
return T->getStmtClass() == OMPTargetParallelGenericLoopDirectiveClass;
62216221
}
62226222
};
6223+
6224+
/// This represents '#pragma omp error' directive.
6225+
///
6226+
/// \code
6227+
/// #pragma omp error
6228+
/// \endcode
6229+
class OMPErrorDirective final : public OMPExecutableDirective {
6230+
friend class ASTStmtReader;
6231+
friend class OMPExecutableDirective;
6232+
/// Build directive with the given start and end location.
6233+
///
6234+
/// \param StartLoc Starting location of the directive kind.
6235+
/// \param EndLoc Ending location of the directive.
6236+
///
6237+
OMPErrorDirective(SourceLocation StartLoc, SourceLocation EndLoc)
6238+
: OMPExecutableDirective(OMPErrorDirectiveClass, llvm::omp::OMPD_error,
6239+
StartLoc, EndLoc) {}
6240+
/// Build an empty directive.
6241+
///
6242+
explicit OMPErrorDirective()
6243+
: OMPExecutableDirective(OMPErrorDirectiveClass, llvm::omp::OMPD_error,
6244+
SourceLocation(), SourceLocation()) {}
6245+
6246+
public:
6247+
///
6248+
/// \param C AST context.
6249+
/// \param StartLoc Starting location of the directive kind.
6250+
/// \param EndLoc Ending Location of the directive.
6251+
/// \param Clauses List of clauses.
6252+
///
6253+
static OMPErrorDirective *Create(const ASTContext &C, SourceLocation StartLoc,
6254+
SourceLocation EndLoc,
6255+
ArrayRef<OMPClause *> Clauses);
6256+
6257+
/// Creates an empty directive.
6258+
///
6259+
/// \param C AST context.
6260+
///
6261+
static OMPErrorDirective *CreateEmpty(const ASTContext &C,
6262+
unsigned NumClauses, EmptyShell);
6263+
6264+
static bool classof(const Stmt *T) {
6265+
return T->getStmtClass() == OMPErrorDirectiveClass;
6266+
}
6267+
};
62236268
} // end namespace clang
62246269

62256270
#endif

clang/include/clang/Basic/StmtNodes.td

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,3 +299,4 @@ def OMPTeamsGenericLoopDirective : StmtNode<OMPLoopDirective>;
299299
def OMPTargetTeamsGenericLoopDirective : StmtNode<OMPLoopDirective>;
300300
def OMPParallelGenericLoopDirective : StmtNode<OMPLoopDirective>;
301301
def OMPTargetParallelGenericLoopDirective : StmtNode<OMPLoopDirective>;
302+
def OMPErrorDirective : StmtNode<OMPExecutableDirective>;

clang/include/clang/Sema/Sema.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11682,6 +11682,10 @@ class Sema final {
1168211682
/// Called on well-formed '\#pragma omp taskyield'.
1168311683
StmtResult ActOnOpenMPTaskyieldDirective(SourceLocation StartLoc,
1168411684
SourceLocation EndLoc);
11685+
/// Called on well-formed '\#pragma omp error'.
11686+
StmtResult ActOnOpenMPErrorDirective(ArrayRef<OMPClause *> Clauses,
11687+
SourceLocation StartLoc,
11688+
SourceLocation EndLoc);
1168511689
/// Called on well-formed '\#pragma omp barrier'.
1168611690
StmtResult ActOnOpenMPBarrierDirective(SourceLocation StartLoc,
1168711691
SourceLocation EndLoc);

clang/include/clang/Serialization/ASTBitCodes.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1937,6 +1937,7 @@ enum StmtCode {
19371937
STMT_OMP_PARALLEL_SECTIONS_DIRECTIVE,
19381938
STMT_OMP_TASK_DIRECTIVE,
19391939
STMT_OMP_TASKYIELD_DIRECTIVE,
1940+
STMT_OMP_ERROR_DIRECTIVE,
19401941
STMT_OMP_BARRIER_DIRECTIVE,
19411942
STMT_OMP_TASKWAIT_DIRECTIVE,
19421943
STMT_OMP_FLUSH_DIRECTIVE,

clang/lib/AST/StmtOpenMP.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -744,6 +744,21 @@ OMPTaskyieldDirective *OMPTaskyieldDirective::CreateEmpty(const ASTContext &C,
744744
return new (C) OMPTaskyieldDirective();
745745
}
746746

747+
OMPErrorDirective *OMPErrorDirective::Create(const ASTContext &C,
748+
SourceLocation StartLoc,
749+
SourceLocation EndLoc,
750+
ArrayRef<OMPClause *> Clauses) {
751+
return createDirective<OMPErrorDirective>(
752+
C, Clauses, /*AssociatedStmt=*/nullptr, /*NumChildren=*/0, StartLoc,
753+
EndLoc);
754+
}
755+
756+
OMPErrorDirective *OMPErrorDirective::CreateEmpty(const ASTContext &C,
757+
unsigned NumClauses,
758+
EmptyShell) {
759+
return createEmptyDirective<OMPErrorDirective>(C, NumClauses);
760+
}
761+
747762
OMPBarrierDirective *OMPBarrierDirective::Create(const ASTContext &C,
748763
SourceLocation StartLoc,
749764
SourceLocation EndLoc) {

clang/lib/AST/StmtPrinter.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -843,6 +843,11 @@ void StmtPrinter::VisitOMPTaskwaitDirective(OMPTaskwaitDirective *Node) {
843843
PrintOMPExecutableDirective(Node);
844844
}
845845

846+
void StmtPrinter::VisitOMPErrorDirective(OMPErrorDirective *Node) {
847+
Indent() << "#pragma omp error";
848+
PrintOMPExecutableDirective(Node);
849+
}
850+
846851
void StmtPrinter::VisitOMPTaskgroupDirective(OMPTaskgroupDirective *Node) {
847852
Indent() << "#pragma omp taskgroup";
848853
PrintOMPExecutableDirective(Node);

clang/lib/AST/StmtProfile.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1014,6 +1014,9 @@ void StmtProfiler::VisitOMPTaskwaitDirective(const OMPTaskwaitDirective *S) {
10141014
VisitOMPExecutableDirective(S);
10151015
}
10161016

1017+
void StmtProfiler::VisitOMPErrorDirective(const OMPErrorDirective *S) {
1018+
VisitOMPExecutableDirective(S);
1019+
}
10171020
void StmtProfiler::VisitOMPTaskgroupDirective(const OMPTaskgroupDirective *S) {
10181021
VisitOMPExecutableDirective(S);
10191022
if (const Expr *E = S->getReductionRef())

0 commit comments

Comments
 (0)