Skip to content

Commit 3e25f3d

Browse files
committed
Merge commit '50dec541f328' from llvm.org/main into next
Conflicts: clang/include/clang/AST/DeclBase.h
2 parents 9e66765 + 50dec54 commit 3e25f3d

File tree

10 files changed

+28
-28
lines changed

10 files changed

+28
-28
lines changed

clang/include/clang/AST/DeclBase.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1399,6 +1399,12 @@ enum class DeductionCandidate : unsigned char {
13991399
Aggregate,
14001400
};
14011401

1402+
enum class OMPDeclareReductionInitKind {
1403+
Call, // Initialized by function call.
1404+
Direct, // omp_priv(<expr>)
1405+
Copy // omp_priv = <expr>
1406+
};
1407+
14021408
/// DeclContext - This is used only as base class of specific decl types that
14031409
/// can act as declaration contexts. These decls are (only the top classes
14041410
/// that directly derive from DeclContext are mentioned, not their subclasses):

clang/include/clang/AST/DeclOpenMP.h

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -171,14 +171,7 @@ class OMPThreadPrivateDecl final : public OMPDeclarativeDirective<Decl> {
171171
class OMPDeclareReductionDecl final : public ValueDecl, public DeclContext {
172172
// This class stores some data in DeclContext::OMPDeclareReductionDeclBits
173173
// to save some space. Use the provided accessors to access it.
174-
public:
175-
enum InitKind {
176-
CallInit, // Initialized by function call.
177-
DirectInit, // omp_priv(<expr>)
178-
CopyInit // omp_priv = <expr>
179-
};
180174

181-
private:
182175
friend class ASTDeclReader;
183176
/// Combiner for declare reduction construct.
184177
Expr *Combiner = nullptr;
@@ -239,8 +232,9 @@ class OMPDeclareReductionDecl final : public ValueDecl, public DeclContext {
239232
Expr *getInitializer() { return Initializer; }
240233
const Expr *getInitializer() const { return Initializer; }
241234
/// Get initializer kind.
242-
InitKind getInitializerKind() const {
243-
return static_cast<InitKind>(OMPDeclareReductionDeclBits.InitializerKind);
235+
OMPDeclareReductionInitKind getInitializerKind() const {
236+
return static_cast<OMPDeclareReductionInitKind>(
237+
OMPDeclareReductionDeclBits.InitializerKind);
244238
}
245239
/// Get Orig variable of the initializer.
246240
Expr *getInitOrig() { return Orig; }
@@ -249,9 +243,9 @@ class OMPDeclareReductionDecl final : public ValueDecl, public DeclContext {
249243
Expr *getInitPriv() { return Priv; }
250244
const Expr *getInitPriv() const { return Priv; }
251245
/// Set initializer expression for the declare reduction construct.
252-
void setInitializer(Expr *E, InitKind IK) {
246+
void setInitializer(Expr *E, OMPDeclareReductionInitKind IK) {
253247
Initializer = E;
254-
OMPDeclareReductionDeclBits.InitializerKind = IK;
248+
OMPDeclareReductionDeclBits.InitializerKind = llvm::to_underlying(IK);
255249
}
256250
/// Set initializer Orig and Priv vars.
257251
void setInitializerData(Expr *OrigE, Expr *PrivE) {

clang/lib/AST/DeclOpenMP.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ OMPDeclareReductionDecl::OMPDeclareReductionDecl(
104104
QualType Ty, OMPDeclareReductionDecl *PrevDeclInScope)
105105
: ValueDecl(DK, DC, L, Name, Ty), DeclContext(DK), Combiner(nullptr),
106106
PrevDeclInScope(PrevDeclInScope) {
107-
setInitializer(nullptr, CallInit);
107+
setInitializer(nullptr, OMPDeclareReductionInitKind::Call);
108108
}
109109

110110
void OMPDeclareReductionDecl::anchor() {}

clang/lib/AST/DeclPrinter.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1871,17 +1871,17 @@ void DeclPrinter::VisitOMPDeclareReductionDecl(OMPDeclareReductionDecl *D) {
18711871
if (auto *Init = D->getInitializer()) {
18721872
Out << " initializer(";
18731873
switch (D->getInitializerKind()) {
1874-
case OMPDeclareReductionDecl::DirectInit:
1874+
case OMPDeclareReductionInitKind::Direct:
18751875
Out << "omp_priv(";
18761876
break;
1877-
case OMPDeclareReductionDecl::CopyInit:
1877+
case OMPDeclareReductionInitKind::Copy:
18781878
Out << "omp_priv = ";
18791879
break;
1880-
case OMPDeclareReductionDecl::CallInit:
1880+
case OMPDeclareReductionInitKind::Call:
18811881
break;
18821882
}
18831883
Init->printPretty(Out, nullptr, Policy, 0, "\n", &Context);
1884-
if (D->getInitializerKind() == OMPDeclareReductionDecl::DirectInit)
1884+
if (D->getInitializerKind() == OMPDeclareReductionInitKind::Direct)
18851885
Out << ")";
18861886
Out << ")";
18871887
}

clang/lib/AST/TextNodeDumper.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2078,13 +2078,13 @@ void TextNodeDumper::VisitOMPDeclareReductionDecl(
20782078
OS << " initializer";
20792079
dumpPointer(Initializer);
20802080
switch (D->getInitializerKind()) {
2081-
case OMPDeclareReductionDecl::DirectInit:
2081+
case OMPDeclareReductionInitKind::Direct:
20822082
OS << " omp_priv = ";
20832083
break;
2084-
case OMPDeclareReductionDecl::CopyInit:
2084+
case OMPDeclareReductionInitKind::Copy:
20852085
OS << " omp_priv ()";
20862086
break;
2087-
case OMPDeclareReductionDecl::CallInit:
2087+
case OMPDeclareReductionInitKind::Call:
20882088
break;
20892089
}
20902090
}

clang/lib/CodeGen/CGOpenMPRuntime.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1133,7 +1133,7 @@ void CGOpenMPRuntime::emitUserDefinedReduction(
11331133
if (const Expr *Init = D->getInitializer()) {
11341134
Initializer = emitCombinerOrInitializer(
11351135
CGM, D->getType(),
1136-
D->getInitializerKind() == OMPDeclareReductionDecl::CallInit ? Init
1136+
D->getInitializerKind() == OMPDeclareReductionInitKind::Call ? Init
11371137
: nullptr,
11381138
cast<VarDecl>(cast<DeclRefExpr>(D->getInitOrig())->getDecl()),
11391139
cast<VarDecl>(cast<DeclRefExpr>(D->getInitPriv())->getDecl()),

clang/lib/Sema/SemaOpenMP.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22611,12 +22611,12 @@ void Sema::ActOnOpenMPDeclareReductionInitializerEnd(Decl *D, Expr *Initializer,
2261122611
PopFunctionScopeInfo();
2261222612

2261322613
if (Initializer != nullptr) {
22614-
DRD->setInitializer(Initializer, OMPDeclareReductionDecl::CallInit);
22614+
DRD->setInitializer(Initializer, OMPDeclareReductionInitKind::Call);
2261522615
} else if (OmpPrivParm->hasInit()) {
2261622616
DRD->setInitializer(OmpPrivParm->getInit(),
2261722617
OmpPrivParm->isDirectInit()
22618-
? OMPDeclareReductionDecl::DirectInit
22619-
: OMPDeclareReductionDecl::CopyInit);
22618+
? OMPDeclareReductionInitKind::Direct
22619+
: OMPDeclareReductionInitKind::Copy);
2262022620
} else {
2262122621
DRD->setInvalidDecl();
2262222622
}

clang/lib/Sema/SemaTemplateInstantiateDecl.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3627,7 +3627,7 @@ Decl *TemplateDeclInstantiator::VisitOMPDeclareReductionDecl(
36273627
SemaRef.CurrentInstantiationScope->InstantiatedLocal(
36283628
cast<DeclRefExpr>(D->getInitPriv())->getDecl(),
36293629
cast<DeclRefExpr>(NewDRD->getInitPriv())->getDecl());
3630-
if (D->getInitializerKind() == OMPDeclareReductionDecl::CallInit) {
3630+
if (D->getInitializerKind() == OMPDeclareReductionInitKind::Call) {
36313631
SubstInitializer = SemaRef.SubstExpr(Init, TemplateArgs).get();
36323632
} else {
36333633
auto *OldPrivParm =
@@ -3642,9 +3642,9 @@ Decl *TemplateDeclInstantiator::VisitOMPDeclareReductionDecl(
36423642
}
36433643
IsCorrect = IsCorrect && SubstCombiner &&
36443644
(!Init ||
3645-
(D->getInitializerKind() == OMPDeclareReductionDecl::CallInit &&
3645+
(D->getInitializerKind() == OMPDeclareReductionInitKind::Call &&
36463646
SubstInitializer) ||
3647-
(D->getInitializerKind() != OMPDeclareReductionDecl::CallInit &&
3647+
(D->getInitializerKind() != OMPDeclareReductionInitKind::Call &&
36483648
!SubstInitializer));
36493649

36503650
(void)SemaRef.ActOnOpenMPDeclareReductionDirectiveEnd(

clang/lib/Serialization/ASTReaderDecl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3007,7 +3007,7 @@ void ASTDeclReader::VisitOMPDeclareReductionDecl(OMPDeclareReductionDecl *D) {
30073007
Expr *Priv = Record.readExpr();
30083008
D->setInitializerData(Orig, Priv);
30093009
Expr *Init = Record.readExpr();
3010-
auto IK = static_cast<OMPDeclareReductionDecl::InitKind>(Record.readInt());
3010+
auto IK = static_cast<OMPDeclareReductionInitKind>(Record.readInt());
30113011
D->setInitializer(Init, IK);
30123012
D->PrevDeclInScope = readDeclID();
30133013
}

clang/lib/Serialization/ASTWriterDecl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1974,7 +1974,7 @@ void ASTDeclWriter::VisitOMPDeclareReductionDecl(OMPDeclareReductionDecl *D) {
19741974
Record.AddStmt(D->getInitOrig());
19751975
Record.AddStmt(D->getInitPriv());
19761976
Record.AddStmt(D->getInitializer());
1977-
Record.push_back(D->getInitializerKind());
1977+
Record.push_back(llvm::to_underlying(D->getInitializerKind()));
19781978
Record.AddDeclRef(D->getPrevDeclInScope());
19791979
Code = serialization::DECL_OMP_DECLARE_REDUCTION;
19801980
}

0 commit comments

Comments
 (0)