Skip to content

Commit 283cba1

Browse files
author
git apple-llvm automerger
committed
Merge commit 'b10296eff0c2' from llvm.org/main into next
2 parents d1139cb + 839bff0 commit 283cba1

File tree

4 files changed

+23
-23
lines changed

4 files changed

+23
-23
lines changed

clang/include/clang/Sema/Sema.h

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -604,6 +604,16 @@ enum class FunctionEffectMode : uint8_t {
604604
Dependent // effect(expr) where expr is dependent.
605605
};
606606

607+
/// pragma clang section kind
608+
enum class PragmaClangSectionKind {
609+
Invalid = 0,
610+
BSS = 1,
611+
Data = 2,
612+
Rodata = 3,
613+
Text = 4,
614+
Relro = 5
615+
};
616+
607617
/// Sema - This implements semantic analysis and AST building for C.
608618
/// \nosubgrouping
609619
class Sema final : public SemaBase {
@@ -1567,16 +1577,6 @@ class Sema final : public SemaBase {
15671577
bool isCXXSafeBuffersBoundsSafetyInteropEnabledAt(SourceLocation Loc) const;
15681578
/* TO_UPSTREAM(BoundsSafety) OFF */
15691579

1570-
/// pragma clang section kind
1571-
enum PragmaClangSectionKind {
1572-
PCSK_Invalid = 0,
1573-
PCSK_BSS = 1,
1574-
PCSK_Data = 2,
1575-
PCSK_Rodata = 3,
1576-
PCSK_Text = 4,
1577-
PCSK_Relro = 5
1578-
};
1579-
15801580
enum PragmaClangSectionAction { PCSA_Set = 0, PCSA_Clear = 1 };
15811581

15821582
struct PragmaClangSection {

clang/lib/Parse/ParsePragma.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2314,7 +2314,7 @@ void PragmaClangSectionHandler::HandlePragma(Preprocessor &PP,
23142314
Token &FirstToken) {
23152315

23162316
Token Tok;
2317-
auto SecKind = Sema::PragmaClangSectionKind::PCSK_Invalid;
2317+
auto SecKind = PragmaClangSectionKind::Invalid;
23182318

23192319
PP.Lex(Tok); // eat 'section'
23202320
while (Tok.isNot(tok::eod)) {
@@ -2325,15 +2325,15 @@ void PragmaClangSectionHandler::HandlePragma(Preprocessor &PP,
23252325

23262326
const IdentifierInfo *SecType = Tok.getIdentifierInfo();
23272327
if (SecType->isStr("bss"))
2328-
SecKind = Sema::PragmaClangSectionKind::PCSK_BSS;
2328+
SecKind = PragmaClangSectionKind::BSS;
23292329
else if (SecType->isStr("data"))
2330-
SecKind = Sema::PragmaClangSectionKind::PCSK_Data;
2330+
SecKind = PragmaClangSectionKind::Data;
23312331
else if (SecType->isStr("rodata"))
2332-
SecKind = Sema::PragmaClangSectionKind::PCSK_Rodata;
2332+
SecKind = PragmaClangSectionKind::Rodata;
23332333
else if (SecType->isStr("relro"))
2334-
SecKind = Sema::PragmaClangSectionKind::PCSK_Relro;
2334+
SecKind = PragmaClangSectionKind::Relro;
23352335
else if (SecType->isStr("text"))
2336-
SecKind = Sema::PragmaClangSectionKind::PCSK_Text;
2336+
SecKind = PragmaClangSectionKind::Text;
23372337
else {
23382338
PP.Diag(Tok.getLocation(), diag::err_pragma_expected_clang_section_name) << "clang section";
23392339
return;
@@ -2342,7 +2342,7 @@ void PragmaClangSectionHandler::HandlePragma(Preprocessor &PP,
23422342
SourceLocation PragmaLocation = Tok.getLocation();
23432343
PP.Lex(Tok); // eat ['bss'|'data'|'rodata'|'text']
23442344
if (Tok.isNot(tok::equal)) {
2345-
PP.Diag(Tok.getLocation(), diag::err_pragma_clang_section_expected_equal) << SecKind;
2345+
PP.Diag(Tok.getLocation(), diag::err_pragma_clang_section_expected_equal) << llvm::to_underlying(SecKind);
23462346
return;
23472347
}
23482348

clang/lib/Sema/SemaAttr.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -393,21 +393,21 @@ void Sema::ActOnPragmaClangSection(SourceLocation PragmaLoc,
393393
PragmaClangSection *CSec;
394394
int SectionFlags = ASTContext::PSF_Read;
395395
switch (SecKind) {
396-
case PragmaClangSectionKind::PCSK_BSS:
396+
case PragmaClangSectionKind::BSS:
397397
CSec = &PragmaClangBSSSection;
398398
SectionFlags |= ASTContext::PSF_Write | ASTContext::PSF_ZeroInit;
399399
break;
400-
case PragmaClangSectionKind::PCSK_Data:
400+
case PragmaClangSectionKind::Data:
401401
CSec = &PragmaClangDataSection;
402402
SectionFlags |= ASTContext::PSF_Write;
403403
break;
404-
case PragmaClangSectionKind::PCSK_Rodata:
404+
case PragmaClangSectionKind::Rodata:
405405
CSec = &PragmaClangRodataSection;
406406
break;
407-
case PragmaClangSectionKind::PCSK_Relro:
407+
case PragmaClangSectionKind::Relro:
408408
CSec = &PragmaClangRelroSection;
409409
break;
410-
case PragmaClangSectionKind::PCSK_Text:
410+
case PragmaClangSectionKind::Text:
411411
CSec = &PragmaClangTextSection;
412412
SectionFlags |= ASTContext::PSF_Execute;
413413
break;

clang/lib/Serialization/ASTWriter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7750,7 +7750,7 @@ void ASTWriter::LazyAttributeToDecl(const Attr *Attr,
77507750
if (Chain && Chain->isProcessingUpdateRecords()) return;
77517751
// Reuse UPD_ADDED_ATTR_TO_RECORD to share its functionality to write and
77527752
// read the attribute for Decl.
7753-
DeclUpdates[D].push_back(DeclUpdate(UPD_ADDED_ATTR_TO_RECORD, Attr));
7753+
DeclUpdates[D].push_back(DeclUpdate(DeclUpdateKind::AddedAttrToRecord, Attr));
77547754
}
77557755
/* TO_UPSTREAM(BoundsSafety) OFF*/
77567756

0 commit comments

Comments
 (0)