Skip to content

Commit d6d9b54

Browse files
committed
Merge branch 'main' into pauth-gnuprop-readobj
2 parents b5bf1ff + 6288f36 commit d6d9b54

File tree

114 files changed

+4377
-1882
lines changed

Some content is hidden

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

114 files changed

+4377
-1882
lines changed

.github/workflows/email-check.yaml

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: "Check for private emails used in PRs"
22

33
on:
4-
pull_request_target:
4+
pull_request:
55
types:
66
- opened
77

@@ -10,8 +10,6 @@ permissions:
1010

1111
jobs:
1212
validate_email:
13-
permissions:
14-
pull-requests: write
1513
runs-on: ubuntu-latest
1614
if: github.repository == 'llvm/llvm-project'
1715
steps:
@@ -25,20 +23,24 @@ jobs:
2523
run: |
2624
git log -1
2725
echo "EMAIL=$(git show -s --format='%ae' HEAD~0)" >> $GITHUB_OUTPUT
26+
# Create empty comment file
27+
echo "[]" > comments
2828
2929
- name: Validate author email
3030
if: ${{ endsWith(steps.author.outputs.EMAIL, 'noreply.github.com') }}
31-
uses: actions/github-script@v6
3231
env:
33-
EMAIL: ${{ steps.author.outputs.EMAIL }}
32+
COMMENT: >-
33+
⚠️ We detected that you are using a GitHub private e-mail address to contribute to the repo.<br/>
34+
Please turn off [Keep my email addresses private](https://github.com/settings/emails) setting in your account.<br/>
35+
See [LLVM Discourse](https://discourse.llvm.org/t/hidden-emails-on-github-should-we-do-something-about-it) for more information.
36+
run: |
37+
cat << EOF > comments
38+
[{"body" : "$COMMENT"}]
39+
EOF
40+
41+
- uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 #v4.3.0
42+
if: always()
3443
with:
35-
script: |
36-
const { EMAIL } = process.env
37-
await github.rest.issues.createComment({
38-
issue_number: context.issue.number,
39-
owner: context.repo.owner,
40-
repo: context.repo.repo,
41-
body: `⚠️ We detected that you are using a GitHub private e-mail address to contribute to the repo.
42-
Please turn off [Keep my email addresses private](https://github.com/settings/emails) setting in your account.
43-
See [LLVM Discourse](https://discourse.llvm.org/t/hidden-emails-on-github-should-we-do-something-about-it) for more information.
44-
`})
44+
name: workflow-args
45+
path: |
46+
comments

.github/workflows/issue-write.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@ name: Comment on an issue
22

33
on:
44
workflow_run:
5-
workflows: ["Check code formatting"]
5+
workflows:
6+
- "Check code formatting"
7+
- "Check for private emails used in PRs"
68
types:
79
- completed
810

clang/cmake/caches/Fuchsia.cmake

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ set(_FUCHSIA_BOOTSTRAP_PASSTHROUGH
7171
Python3_LIBRARIES
7272
Python3_INCLUDE_DIRS
7373
Python3_RPATH
74+
SWIG_DIR
75+
SWIG_EXECUTABLE
7476
CMAKE_FIND_PACKAGE_PREFER_CONFIG
7577
CMAKE_SYSROOT
7678
CMAKE_MODULE_LINKER_FLAGS

clang/include/clang/Serialization/ASTBitCodes.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ namespace serialization {
4141
/// Version 4 of AST files also requires that the version control branch and
4242
/// revision match exactly, since there is no backward compatibility of
4343
/// AST files at this time.
44-
const unsigned VERSION_MAJOR = 29;
44+
const unsigned VERSION_MAJOR = 30;
4545

4646
/// AST file minor version number supported by this version of
4747
/// Clang.

clang/include/clang/Serialization/ASTWriter.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -542,6 +542,7 @@ class ASTWriter : public ASTDeserializationListener,
542542
void WriteReferencedSelectorsPool(Sema &SemaRef);
543543
void WriteIdentifierTable(Preprocessor &PP, IdentifierResolver &IdResolver,
544544
bool IsModule);
545+
void WriteDeclAndTypes(ASTContext &Context);
545546
void WriteDeclUpdatesBlocks(RecordDataImpl &OffsetsRecord);
546547
void WriteDeclContextVisibleUpdate(const DeclContext *DC);
547548
void WriteFPPragmaOptions(const FPOptionsOverride &Opts);
@@ -846,7 +847,7 @@ class ASTWriter : public ASTDeserializationListener,
846847
/// AST and semantic-analysis consumer that generates a
847848
/// precompiled header from the parsed source code.
848849
class PCHGenerator : public SemaConsumer {
849-
const Preprocessor &PP;
850+
Preprocessor &PP;
850851
std::string OutputFile;
851852
std::string isysroot;
852853
Sema *SemaPtr;
@@ -867,11 +868,12 @@ class PCHGenerator : public SemaConsumer {
867868
DiagnosticsEngine &getDiagnostics() const {
868869
return SemaPtr->getDiagnostics();
869870
}
871+
Preprocessor &getPreprocessor() { return PP; }
870872

871873
virtual Module *getEmittingModule(ASTContext &Ctx);
872874

873875
public:
874-
PCHGenerator(const Preprocessor &PP, InMemoryModuleCache &ModuleCache,
876+
PCHGenerator(Preprocessor &PP, InMemoryModuleCache &ModuleCache,
875877
StringRef OutputFile, StringRef isysroot,
876878
std::shared_ptr<PCHBuffer> Buffer,
877879
ArrayRef<std::shared_ptr<ModuleFileExtension>> Extensions,
@@ -893,7 +895,7 @@ class ReducedBMIGenerator : public PCHGenerator {
893895
virtual Module *getEmittingModule(ASTContext &Ctx) override;
894896

895897
public:
896-
ReducedBMIGenerator(const Preprocessor &PP, InMemoryModuleCache &ModuleCache,
898+
ReducedBMIGenerator(Preprocessor &PP, InMemoryModuleCache &ModuleCache,
897899
StringRef OutputFile);
898900

899901
void HandleTranslationUnit(ASTContext &Ctx) override;

clang/lib/AST/DeclBase.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1852,9 +1852,9 @@ DeclContext::lookup(DeclarationName Name) const {
18521852

18531853
DeclContext::lookup_result
18541854
DeclContext::noload_lookup(DeclarationName Name) {
1855-
assert(getDeclKind() != Decl::LinkageSpec &&
1856-
getDeclKind() != Decl::Export &&
1857-
"should not perform lookups into transparent contexts");
1855+
// For transparent DeclContext, we should lookup in their enclosing context.
1856+
if (getDeclKind() == Decl::LinkageSpec || getDeclKind() == Decl::Export)
1857+
return getParent()->noload_lookup(Name);
18581858

18591859
DeclContext *PrimaryContext = getPrimaryContext();
18601860
if (PrimaryContext != this)

clang/lib/CodeGen/BackendUtil.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,8 @@ using namespace llvm;
100100
namespace llvm {
101101
extern cl::opt<bool> PrintPipelinePasses;
102102

103-
cl::opt<bool> ClRemoveTraps("clang-remove-traps", cl::Optional,
104-
cl::desc("Insert remove-traps pass."));
103+
static cl::opt<bool> ClRemoveTraps("clang-remove-traps", cl::Optional,
104+
cl::desc("Insert remove-traps pass."));
105105

106106
// Experiment to move sanitizers earlier.
107107
static cl::opt<bool> ClSanitizeOnOptimizerEarlyEP(

clang/lib/Driver/ToolChains/MSVC.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,8 @@ class LLVM_LIBRARY_VISIBILITY MSVCToolChain : public ToolChain {
6161
/// formats, and to DWARF otherwise. Users can use -gcodeview and -gdwarf to
6262
/// override the default.
6363
llvm::codegenoptions::DebugInfoFormat getDefaultDebugFormat() const override {
64-
return getTriple().isOSBinFormatMachO()
65-
? llvm::codegenoptions::DIF_DWARF
66-
: llvm::codegenoptions::DIF_CodeView;
64+
return getTriple().isOSBinFormatCOFF() ? llvm::codegenoptions::DIF_CodeView
65+
: llvm::codegenoptions::DIF_DWARF;
6766
}
6867

6968
/// Set the debugger tuning to "default", since we're definitely not tuning

clang/lib/Format/TokenAnnotator.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3889,6 +3889,8 @@ void TokenAnnotator::calculateFormattingInformation(AnnotatedLine &Line) const {
38893889
}
38903890
} else if (ClosingParen) {
38913891
for (auto *Tok = ClosingParen->Next; Tok; Tok = Tok->Next) {
3892+
if (Tok->is(TT_CtorInitializerColon))
3893+
break;
38923894
if (Tok->is(tok::arrow)) {
38933895
Tok->setType(TT_TrailingReturnArrow);
38943896
break;

clang/lib/Frontend/PrecompiledPreamble.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -290,8 +290,7 @@ class PrecompilePreambleAction : public ASTFrontendAction {
290290

291291
class PrecompilePreambleConsumer : public PCHGenerator {
292292
public:
293-
PrecompilePreambleConsumer(PrecompilePreambleAction &Action,
294-
const Preprocessor &PP,
293+
PrecompilePreambleConsumer(PrecompilePreambleAction &Action, Preprocessor &PP,
295294
InMemoryModuleCache &ModuleCache,
296295
StringRef isysroot,
297296
std::shared_ptr<PCHBuffer> Buffer)

clang/lib/Sema/SemaStmtAttr.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -406,8 +406,8 @@ static void CheckForDuplicateLoopAttrs(Sema &S, ArrayRef<const Attr *> Attrs) {
406406
<< *FirstItr;
407407
S.Diag((*FirstItr)->getLocation(), diag::note_previous_attribute);
408408
}
409-
return;
410409
}
410+
return;
411411
}
412412

413413
static Attr *handleMSConstexprAttr(Sema &S, Stmt *St, const ParsedAttr &A,

clang/lib/Serialization/ASTReader.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6622,17 +6622,17 @@ void ASTReader::ReadPragmaDiagnosticMappings(DiagnosticsEngine &Diag) {
66226622
while (NumLocations--) {
66236623
assert(Idx < Record.size() &&
66246624
"Invalid data, missing pragma diagnostic states");
6625-
SourceLocation Loc = ReadSourceLocation(F, Record[Idx++]);
6626-
auto IDAndOffset = SourceMgr.getDecomposedLoc(Loc);
6627-
assert(IDAndOffset.first.isValid() && "invalid FileID for transition");
6628-
assert(IDAndOffset.second == 0 && "not a start location for a FileID");
6625+
FileID FID = ReadFileID(F, Record, Idx);
6626+
assert(FID.isValid() && "invalid FileID for transition");
6627+
// FIXME: Remove this once we don't need the side-effects.
6628+
(void)SourceMgr.getSLocEntryOrNull(FID);
66296629
unsigned Transitions = Record[Idx++];
66306630

66316631
// Note that we don't need to set up Parent/ParentOffset here, because
66326632
// we won't be changing the diagnostic state within imported FileIDs
66336633
// (other than perhaps appending to the main source file, which has no
66346634
// parent).
6635-
auto &F = Diag.DiagStatesByLoc.Files[IDAndOffset.first];
6635+
auto &F = Diag.DiagStatesByLoc.Files[FID];
66366636
F.StateTransitions.reserve(F.StateTransitions.size() + Transitions);
66376637
for (unsigned I = 0; I != Transitions; ++I) {
66386638
unsigned Offset = Record[Idx++];

clang/lib/Serialization/ASTWriter.cpp

Lines changed: 68 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -3131,9 +3131,7 @@ void ASTWriter::WritePragmaDiagnosticMappings(const DiagnosticsEngine &Diag,
31313131
continue;
31323132
++NumLocations;
31333133

3134-
SourceLocation Loc = Diag.SourceMgr->getComposedLoc(FileIDAndFile.first, 0);
3135-
assert(!Loc.isInvalid() && "start loc for valid FileID is invalid");
3136-
AddSourceLocation(Loc, Record);
3134+
AddFileID(FileIDAndFile.first, Record);
31373135

31383136
Record.push_back(FileIDAndFile.second.StateTransitions.size());
31393137
for (auto &StatePoint : FileIDAndFile.second.StateTransitions) {
@@ -5109,69 +5107,7 @@ ASTFileSignature ASTWriter::WriteASTCore(Sema &SemaRef, StringRef isysroot,
51095107
for (auto *D : SemaRef.DeclsToCheckForDeferredDiags)
51105108
DeclsToCheckForDeferredDiags.push_back(GetDeclRef(D));
51115109

5112-
{
5113-
auto Abv = std::make_shared<BitCodeAbbrev>();
5114-
Abv->Add(llvm::BitCodeAbbrevOp(UPDATE_VISIBLE));
5115-
Abv->Add(llvm::BitCodeAbbrevOp(llvm::BitCodeAbbrevOp::VBR, 6));
5116-
Abv->Add(llvm::BitCodeAbbrevOp(llvm::BitCodeAbbrevOp::Blob));
5117-
UpdateVisibleAbbrev = Stream.EmitAbbrev(std::move(Abv));
5118-
}
5119-
5120-
RecordData DeclUpdatesOffsetsRecord;
5121-
5122-
// Keep writing types, declarations, and declaration update records
5123-
// until we've emitted all of them.
5124-
Stream.EnterSubblock(DECLTYPES_BLOCK_ID, /*bits for abbreviations*/5);
5125-
DeclTypesBlockStartOffset = Stream.GetCurrentBitNo();
5126-
WriteTypeAbbrevs();
5127-
WriteDeclAbbrevs();
5128-
do {
5129-
WriteDeclUpdatesBlocks(DeclUpdatesOffsetsRecord);
5130-
while (!DeclTypesToEmit.empty()) {
5131-
DeclOrType DOT = DeclTypesToEmit.front();
5132-
DeclTypesToEmit.pop();
5133-
if (DOT.isType())
5134-
WriteType(DOT.getType());
5135-
else
5136-
WriteDecl(Context, DOT.getDecl());
5137-
}
5138-
} while (!DeclUpdates.empty());
5139-
Stream.ExitBlock();
5140-
5141-
DoneWritingDeclsAndTypes = true;
5142-
5143-
// These things can only be done once we've written out decls and types.
5144-
WriteTypeDeclOffsets();
5145-
if (!DeclUpdatesOffsetsRecord.empty())
5146-
Stream.EmitRecord(DECL_UPDATE_OFFSETS, DeclUpdatesOffsetsRecord);
5147-
5148-
// Create a lexical update block containing all of the declarations in the
5149-
// translation unit that do not come from other AST files.
5150-
{
5151-
SmallVector<uint32_t, 128> NewGlobalKindDeclPairs;
5152-
for (const auto *D : TU->noload_decls()) {
5153-
if (!D->isFromASTFile()) {
5154-
NewGlobalKindDeclPairs.push_back(D->getKind());
5155-
NewGlobalKindDeclPairs.push_back(GetDeclRef(D));
5156-
}
5157-
}
5158-
5159-
auto Abv = std::make_shared<BitCodeAbbrev>();
5160-
Abv->Add(llvm::BitCodeAbbrevOp(TU_UPDATE_LEXICAL));
5161-
Abv->Add(llvm::BitCodeAbbrevOp(llvm::BitCodeAbbrevOp::Blob));
5162-
unsigned TuUpdateLexicalAbbrev = Stream.EmitAbbrev(std::move(Abv));
5163-
5164-
RecordData::value_type Record[] = {TU_UPDATE_LEXICAL};
5165-
Stream.EmitRecordWithBlob(TuUpdateLexicalAbbrev, Record,
5166-
bytes(NewGlobalKindDeclPairs));
5167-
}
5168-
5169-
// And a visible updates block for the translation unit.
5170-
WriteDeclContextVisibleUpdate(TU);
5171-
5172-
// If we have any extern "C" names, write out a visible update for them.
5173-
if (Context.ExternCContext)
5174-
WriteDeclContextVisibleUpdate(Context.ExternCContext);
5110+
WriteDeclAndTypes(Context);
51755111

51765112
WriteFileDeclIDsMap();
51775113
WriteSourceManagerBlock(Context.getSourceManager(), PP);
@@ -5257,10 +5193,6 @@ ASTFileSignature ASTWriter::WriteASTCore(Sema &SemaRef, StringRef isysroot,
52575193
if (!DeleteExprsToAnalyze.empty())
52585194
Stream.EmitRecord(DELETE_EXPRS_TO_ANALYZE, DeleteExprsToAnalyze);
52595195

5260-
// Write the visible updates to DeclContexts.
5261-
for (auto *DC : UpdatedDeclContexts)
5262-
WriteDeclContextVisibleUpdate(DC);
5263-
52645196
if (!WritingModule) {
52655197
// Write the submodules that were imported, if any.
52665198
struct ModuleInfo {
@@ -5325,6 +5257,72 @@ ASTFileSignature ASTWriter::WriteASTCore(Sema &SemaRef, StringRef isysroot,
53255257
return backpatchSignature();
53265258
}
53275259

5260+
void ASTWriter::WriteDeclAndTypes(ASTContext &Context) {
5261+
// Keep writing types, declarations, and declaration update records
5262+
// until we've emitted all of them.
5263+
RecordData DeclUpdatesOffsetsRecord;
5264+
Stream.EnterSubblock(DECLTYPES_BLOCK_ID, /*bits for abbreviations*/5);
5265+
DeclTypesBlockStartOffset = Stream.GetCurrentBitNo();
5266+
WriteTypeAbbrevs();
5267+
WriteDeclAbbrevs();
5268+
do {
5269+
WriteDeclUpdatesBlocks(DeclUpdatesOffsetsRecord);
5270+
while (!DeclTypesToEmit.empty()) {
5271+
DeclOrType DOT = DeclTypesToEmit.front();
5272+
DeclTypesToEmit.pop();
5273+
if (DOT.isType())
5274+
WriteType(DOT.getType());
5275+
else
5276+
WriteDecl(Context, DOT.getDecl());
5277+
}
5278+
} while (!DeclUpdates.empty());
5279+
Stream.ExitBlock();
5280+
5281+
DoneWritingDeclsAndTypes = true;
5282+
5283+
// These things can only be done once we've written out decls and types.
5284+
WriteTypeDeclOffsets();
5285+
if (!DeclUpdatesOffsetsRecord.empty())
5286+
Stream.EmitRecord(DECL_UPDATE_OFFSETS, DeclUpdatesOffsetsRecord);
5287+
5288+
const TranslationUnitDecl *TU = Context.getTranslationUnitDecl();
5289+
// Create a lexical update block containing all of the declarations in the
5290+
// translation unit that do not come from other AST files.
5291+
SmallVector<uint32_t, 128> NewGlobalKindDeclPairs;
5292+
for (const auto *D : TU->noload_decls()) {
5293+
if (!D->isFromASTFile()) {
5294+
NewGlobalKindDeclPairs.push_back(D->getKind());
5295+
NewGlobalKindDeclPairs.push_back(GetDeclRef(D));
5296+
}
5297+
}
5298+
5299+
auto Abv = std::make_shared<llvm::BitCodeAbbrev>();
5300+
Abv->Add(llvm::BitCodeAbbrevOp(TU_UPDATE_LEXICAL));
5301+
Abv->Add(llvm::BitCodeAbbrevOp(llvm::BitCodeAbbrevOp::Blob));
5302+
unsigned TuUpdateLexicalAbbrev = Stream.EmitAbbrev(std::move(Abv));
5303+
5304+
RecordData::value_type Record[] = {TU_UPDATE_LEXICAL};
5305+
Stream.EmitRecordWithBlob(TuUpdateLexicalAbbrev, Record,
5306+
bytes(NewGlobalKindDeclPairs));
5307+
5308+
Abv = std::make_shared<llvm::BitCodeAbbrev>();
5309+
Abv->Add(llvm::BitCodeAbbrevOp(UPDATE_VISIBLE));
5310+
Abv->Add(llvm::BitCodeAbbrevOp(llvm::BitCodeAbbrevOp::VBR, 6));
5311+
Abv->Add(llvm::BitCodeAbbrevOp(llvm::BitCodeAbbrevOp::Blob));
5312+
UpdateVisibleAbbrev = Stream.EmitAbbrev(std::move(Abv));
5313+
5314+
// And a visible updates block for the translation unit.
5315+
WriteDeclContextVisibleUpdate(TU);
5316+
5317+
// If we have any extern "C" names, write out a visible update for them.
5318+
if (Context.ExternCContext)
5319+
WriteDeclContextVisibleUpdate(Context.ExternCContext);
5320+
5321+
// Write the visible updates to DeclContexts.
5322+
for (auto *DC : UpdatedDeclContexts)
5323+
WriteDeclContextVisibleUpdate(DC);
5324+
}
5325+
53285326
void ASTWriter::WriteDeclUpdatesBlocks(RecordDataImpl &OffsetsRecord) {
53295327
if (DeclUpdates.empty())
53305328
return;

0 commit comments

Comments
 (0)