Skip to content

Commit baa883c

Browse files
committed
merge main into amd-staging
Change-Id: If2716ef14e382f171f89cd84004535a6cfe60e38
2 parents b9205fa + 40954d7 commit baa883c

File tree

72 files changed

+1194
-570
lines changed

Some content is hidden

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

72 files changed

+1194
-570
lines changed

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ clang/test/AST/Interp/ @tbaederr
8686
/mlir/**/*VectorToLLVM* @banach-space @dcaballe @nicolasvasilache
8787
/mlir/**/*X86Vector* @aartbik @dcaballe @nicolasvasilache
8888
/mlir/include/mlir/Dialect/Vector @banach-space @dcaballe @nicolasvasilache
89+
/mlir/include/mlir/Dialect/Vector/IR @kuhar
8990
/mlir/lib/Dialect/Vector @banach-space @dcaballe @nicolasvasilache
9091
/mlir/lib/Dialect/Vector/Transforms/* @banach-space @dcaballe @hanhanW @nicolasvasilache
9192
/mlir/lib/Dialect/Vector/Transforms/VectorEmulateNarrowType.cpp @banach-space @dcaballe @MaheshRavishankar @nicolasvasilache

bolt/lib/Rewrite/DWARFRewriter.cpp

Lines changed: 67 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -620,10 +620,9 @@ void DWARFRewriter::updateDebugInfo() {
620620
uint32_t CUIndex = 0;
621621
std::mutex AccessMutex;
622622
// Needs to be invoked in the same order as CUs are processed.
623-
llvm::DenseMap<uint64_t, uint64_t> LocListWritersIndexByCU;
624-
auto createRangeLocListAddressWriters = [&](DWARFUnit &CU) {
623+
auto createRangeLocListAddressWriters =
624+
[&](DWARFUnit &CU) -> DebugLocWriter * {
625625
std::lock_guard<std::mutex> Lock(AccessMutex);
626-
627626
const uint16_t DwarfVersion = CU.getVersion();
628627
if (DwarfVersion >= 5) {
629628
auto AddrW = std::make_unique<DebugAddrWriterDwarf5>(
@@ -642,6 +641,7 @@ void DWARFRewriter::updateDebugInfo() {
642641
RangeListsWritersByCU[*DWOId] = std::move(DWORangeListsSectionWriter);
643642
}
644643
AddressWritersByCU[CU.getOffset()] = std::move(AddrW);
644+
645645
} else {
646646
auto AddrW =
647647
std::make_unique<DebugAddrWriter>(&BC, CU.getAddressByteSize());
@@ -657,7 +657,7 @@ void DWARFRewriter::updateDebugInfo() {
657657
std::move(LegacyRangesSectionWriterByCU);
658658
}
659659
}
660-
LocListWritersIndexByCU[CU.getOffset()] = CUIndex++;
660+
return LocListWritersByCU[CUIndex++].get();
661661
};
662662

663663
DWARF5AcceleratorTable DebugNamesTable(opts::CreateDebugNames, BC,
@@ -666,68 +666,74 @@ void DWARFRewriter::updateDebugInfo() {
666666
DWPState State;
667667
if (opts::WriteDWP)
668668
initDWPState(State);
669-
auto processSplitCU = [&](DWARFUnit &Unit, DWARFUnit &SplitCU,
670-
DIEBuilder &DIEBlder,
671-
DebugRangesSectionWriter &TempRangesSectionWriter,
672-
DebugAddrWriter &AddressWriter) {
673-
DIEBuilder DWODIEBuilder(BC, &(SplitCU).getContext(), DebugNamesTable,
674-
&Unit);
675-
DWODIEBuilder.buildDWOUnit(SplitCU);
676-
std::string DWOName = "";
677-
std::optional<std::string> DwarfOutputPath =
678-
opts::DwarfOutputPath.empty()
679-
? std::nullopt
680-
: std::optional<std::string>(opts::DwarfOutputPath.c_str());
681-
{
682-
std::lock_guard<std::mutex> Lock(AccessMutex);
683-
DWOName = DIEBlder.updateDWONameCompDir(
684-
*StrOffstsWriter, *StrWriter, Unit, DwarfOutputPath, std::nullopt);
685-
}
686-
DebugStrOffsetsWriter DWOStrOffstsWriter(BC);
687-
DebugStrWriter DWOStrWriter((SplitCU).getContext(), true);
688-
DWODIEBuilder.updateDWONameCompDirForTypes(
689-
DWOStrOffstsWriter, DWOStrWriter, SplitCU, DwarfOutputPath, DWOName);
690-
DebugLoclistWriter DebugLocDWoWriter(Unit, Unit.getVersion(), true,
691-
AddressWriter);
692-
693-
updateUnitDebugInfo(SplitCU, DWODIEBuilder, DebugLocDWoWriter,
694-
TempRangesSectionWriter, AddressWriter);
695-
DebugLocDWoWriter.finalize(DWODIEBuilder,
696-
*DWODIEBuilder.getUnitDIEbyUnit(SplitCU));
697-
if (Unit.getVersion() >= 5)
698-
TempRangesSectionWriter.finalizeSection();
699-
700-
emitDWOBuilder(DWOName, DWODIEBuilder, *this, SplitCU, Unit, State,
701-
DebugLocDWoWriter, DWOStrOffstsWriter, DWOStrWriter,
702-
GDBIndexSection);
703-
};
704-
auto processMainBinaryCU = [&](DWARFUnit &Unit, DIEBuilder &DIEBlder) {
705-
DebugAddrWriter &AddressWriter =
706-
*AddressWritersByCU[Unit.getOffset()].get();
707-
DebugRangesSectionWriter &RangesSectionWriter =
708-
Unit.getVersion() >= 5 ? *RangeListsSectionWriter.get()
709-
: *LegacyRangesSectionWriter.get();
710-
DebugLocWriter &DebugLocWriter =
711-
*LocListWritersByCU[LocListWritersIndexByCU[Unit.getOffset()]].get();
712-
std::optional<uint64_t> RangesBase;
669+
auto processUnitDIE = [&](DWARFUnit *Unit, DIEBuilder *DIEBlder) {
670+
// Check if the unit is a skeleton and we need special updates for it and
671+
// its matching split/DWO CU.
713672
std::optional<DWARFUnit *> SplitCU;
714-
std::optional<uint64_t> DWOId = Unit.getDWOId();
673+
std::optional<uint64_t> RangesBase;
674+
std::optional<uint64_t> DWOId = Unit->getDWOId();
715675
if (DWOId)
716676
SplitCU = BC.getDWOCU(*DWOId);
717-
if (Unit.getVersion() >= 5) {
718-
RangesBase = RangesSectionWriter.getSectionOffset() +
677+
DebugLocWriter *DebugLocWriter = createRangeLocListAddressWriters(*Unit);
678+
DebugRangesSectionWriter *RangesSectionWriter =
679+
Unit->getVersion() >= 5 ? RangeListsSectionWriter.get()
680+
: LegacyRangesSectionWriter.get();
681+
DebugAddrWriter *AddressWriter =
682+
AddressWritersByCU[Unit->getOffset()].get();
683+
// Skipping CUs that failed to load.
684+
if (SplitCU) {
685+
DIEBuilder DWODIEBuilder(BC, &(*SplitCU)->getContext(), DebugNamesTable,
686+
Unit);
687+
DWODIEBuilder.buildDWOUnit(**SplitCU);
688+
std::string DWOName = "";
689+
std::optional<std::string> DwarfOutputPath =
690+
opts::DwarfOutputPath.empty()
691+
? std::nullopt
692+
: std::optional<std::string>(opts::DwarfOutputPath.c_str());
693+
{
694+
std::lock_guard<std::mutex> Lock(AccessMutex);
695+
DWOName = DIEBlder->updateDWONameCompDir(
696+
*StrOffstsWriter, *StrWriter, *Unit, DwarfOutputPath, std::nullopt);
697+
}
698+
DebugStrOffsetsWriter DWOStrOffstsWriter(BC);
699+
DebugStrWriter DWOStrWriter((*SplitCU)->getContext(), true);
700+
DWODIEBuilder.updateDWONameCompDirForTypes(DWOStrOffstsWriter,
701+
DWOStrWriter, **SplitCU,
702+
DwarfOutputPath, DWOName);
703+
DebugLoclistWriter DebugLocDWoWriter(*Unit, Unit->getVersion(), true,
704+
*AddressWriter);
705+
DebugRangesSectionWriter *TempRangesSectionWriter = RangesSectionWriter;
706+
if (Unit->getVersion() >= 5) {
707+
TempRangesSectionWriter = RangeListsWritersByCU[*DWOId].get();
708+
} else {
709+
TempRangesSectionWriter = LegacyRangesWritersByCU[*DWOId].get();
710+
RangesBase = RangesSectionWriter->getSectionOffset();
711+
}
712+
713+
updateUnitDebugInfo(*(*SplitCU), DWODIEBuilder, DebugLocDWoWriter,
714+
*TempRangesSectionWriter, *AddressWriter);
715+
DebugLocDWoWriter.finalize(DWODIEBuilder,
716+
*DWODIEBuilder.getUnitDIEbyUnit(**SplitCU));
717+
if (Unit->getVersion() >= 5)
718+
TempRangesSectionWriter->finalizeSection();
719+
720+
emitDWOBuilder(DWOName, DWODIEBuilder, *this, **SplitCU, *Unit, State,
721+
DebugLocDWoWriter, DWOStrOffstsWriter, DWOStrWriter,
722+
GDBIndexSection);
723+
}
724+
725+
if (Unit->getVersion() >= 5) {
726+
RangesBase = RangesSectionWriter->getSectionOffset() +
719727
getDWARF5RngListLocListHeaderSize();
720-
RangesSectionWriter.initSection(Unit);
721-
StrOffstsWriter->finalizeSection(Unit, DIEBlder);
722-
} else if (SplitCU) {
723-
RangesBase = LegacyRangesSectionWriter.get()->getSectionOffset();
728+
RangesSectionWriter->initSection(*Unit);
729+
StrOffstsWriter->finalizeSection(*Unit, *DIEBlder);
724730
}
725731

726-
updateUnitDebugInfo(Unit, DIEBlder, DebugLocWriter, RangesSectionWriter,
727-
AddressWriter, RangesBase);
728-
DebugLocWriter.finalize(DIEBlder, *DIEBlder.getUnitDIEbyUnit(Unit));
729-
if (Unit.getVersion() >= 5)
730-
RangesSectionWriter.finalizeSection();
732+
updateUnitDebugInfo(*Unit, *DIEBlder, *DebugLocWriter, *RangesSectionWriter,
733+
*AddressWriter, RangesBase);
734+
DebugLocWriter->finalize(*DIEBlder, *DIEBlder->getUnitDIEbyUnit(*Unit));
735+
if (Unit->getVersion() >= 5)
736+
RangesSectionWriter->finalizeSection();
731737
};
732738

733739
DIEBuilder DIEBlder(BC, BC.DwCtx.get(), DebugNamesTable);
@@ -745,24 +751,8 @@ void DWARFRewriter::updateDebugInfo() {
745751
CUPartitionVector PartVec = partitionCUs(*BC.DwCtx);
746752
for (std::vector<DWARFUnit *> &Vec : PartVec) {
747753
DIEBlder.buildCompileUnits(Vec);
748-
for (DWARFUnit *CU : DIEBlder.getProcessedCUs()) {
749-
createRangeLocListAddressWriters(*CU);
750-
std::optional<DWARFUnit *> SplitCU;
751-
std::optional<uint64_t> DWOId = CU->getDWOId();
752-
if (DWOId)
753-
SplitCU = BC.getDWOCU(*DWOId);
754-
if (!SplitCU)
755-
continue;
756-
DebugAddrWriter &AddressWriter =
757-
*AddressWritersByCU[CU->getOffset()].get();
758-
DebugRangesSectionWriter *TempRangesSectionWriter =
759-
CU->getVersion() >= 5 ? RangeListsWritersByCU[*DWOId].get()
760-
: LegacyRangesWritersByCU[*DWOId].get();
761-
processSplitCU(*CU, **SplitCU, DIEBlder, *TempRangesSectionWriter,
762-
AddressWriter);
763-
}
764754
for (DWARFUnit *CU : DIEBlder.getProcessedCUs())
765-
processMainBinaryCU(*CU, DIEBlder);
755+
processUnitDIE(CU, &DIEBlder);
766756
finalizeCompileUnits(DIEBlder, *Streamer, OffsetMap,
767757
DIEBlder.getProcessedCUs(), *FinalAddrWriter);
768758
}

clang-tools-extra/clang-tidy/add_new_check.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -552,8 +552,8 @@ def format_link_alias(doc_file):
552552
f.write(' :header: "Name", "Offers fixes"\n\n')
553553
f.writelines(checks)
554554
# and the aliases
555-
f.write("\n\n")
556-
f.write(".. csv-table:: Aliases..\n")
555+
f.write("\nCheck aliases\n-------------\n\n")
556+
f.write(".. csv-table::\n")
557557
f.write(' :header: "Name", "Redirect", "Offers fixes"\n\n')
558558
f.writelines(checks_alias)
559559
break

clang-tools-extra/clang-tidy/utils/ASTUtils.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ bool areStatementsIdentical(const Stmt *FirstStmt, const Stmt *SecondStmt,
9696
if (FirstStmt == SecondStmt)
9797
return true;
9898

99-
if (FirstStmt->getStmtClass() != FirstStmt->getStmtClass())
99+
if (FirstStmt->getStmtClass() != SecondStmt->getStmtClass())
100100
return false;
101101

102102
if (isa<Expr>(FirstStmt) && isa<Expr>(SecondStmt)) {

clang-tools-extra/clang-tidy/utils/ExceptionAnalyzer.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,10 @@ bool isStandardPointerConvertible(QualType From, QualType To) {
141141
if (RD->isCompleteDefinition() &&
142142
isBaseOf(From->getPointeeType().getTypePtr(),
143143
To->getPointeeType().getTypePtr())) {
144-
return true;
144+
// If B is an inaccessible or ambiguous base class of D, a program
145+
// that necessitates this conversion is ill-formed
146+
return isUnambiguousPublicBaseClass(From->getPointeeType().getTypePtr(),
147+
To->getPointeeType().getTypePtr());
145148
}
146149
}
147150

@@ -375,10 +378,7 @@ bool ExceptionAnalyzer::ExceptionInfo::filterByCatch(
375378
isPointerOrPointerToMember(ExceptionCanTy->getTypePtr())) {
376379
// A standard pointer conversion not involving conversions to pointers to
377380
// private or protected or ambiguous classes ...
378-
if (isStandardPointerConvertible(ExceptionCanTy, HandlerCanTy) &&
379-
isUnambiguousPublicBaseClass(
380-
ExceptionCanTy->getTypePtr()->getPointeeType().getTypePtr(),
381-
HandlerCanTy->getTypePtr()->getPointeeType().getTypePtr())) {
381+
if (isStandardPointerConvertible(ExceptionCanTy, HandlerCanTy)) {
382382
TypesToDelete.push_back(ExceptionTy);
383383
}
384384
// A function pointer conversion ...

clang-tools-extra/docs/ReleaseNotes.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,10 @@ Changes in existing checks
247247
where source is already a ``void``` pointer, making middle ``void`` pointer
248248
casts bug-free.
249249

250+
- Improved :doc:`bugprone-exception-escape
251+
<clang-tidy/checks/bugprone/exception-escape>` check to correctly detect exception
252+
handler of type ``CV void *`` as catching all ``CV`` compatible pointer types.
253+
250254
- Improved :doc:`bugprone-forwarding-reference-overload
251255
<clang-tidy/checks/bugprone/forwarding-reference-overload>`
252256
check to ignore deleted constructors which won't hide other overloads.
Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
.. title:: clang-tidy - clang-analyzer-cplusplus.Move
2+
.. meta::
3+
:http-equiv=refresh: 5;URL=https://clang.llvm.org/docs/analyzer/checkers.html#cplusplus-move
24

35
clang-analyzer-cplusplus.Move
46
=============================
57

68
Find use-after-move bugs in C++.
79

8-
The clang-analyzer-cplusplus.Move check is an alias of
9-
Clang Static Analyzer cplusplus.Move.
10+
The `clang-analyzer-cplusplus.Move` check is an alias, please see
11+
`Clang Static Analyzer Available Checkers
12+
<https://clang.llvm.org/docs/analyzer/checkers.html#cplusplus-move>`_
13+
for more information.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
.. title:: clang-tidy - clang-analyzer-optin.taint.TaintedAlloc
2+
.. meta::
3+
:http-equiv=refresh: 5;URL=https://clang.llvm.org/docs/analyzer/checkers.html#optin-taint-taintedalloc
4+
5+
clang-analyzer-optin.taint.TaintedAlloc
6+
=======================================
7+
8+
Check for memory allocations, where the size parameter might be a tainted
9+
(attacker controlled) value.
10+
11+
The `clang-analyzer-optin.taint.TaintedAlloc` check is an alias, please see
12+
`Clang Static Analyzer Available Checkers
13+
<https://clang.llvm.org/docs/analyzer/checkers.html#optin-taint-taintedalloc>`_
14+
for more information.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
.. title:: clang-tidy - clang-analyzer-security.PutenvStackArray
2+
3+
clang-analyzer-security.PutenvStackArray
4+
========================================
5+
6+
Finds calls to the function 'putenv' which pass a pointer to an automatic
7+
(stack-allocated) array as the argument.
8+
9+
The clang-analyzer-security.PutenvStackArray check is an alias of
10+
Clang Static Analyzer security.PutenvStackArray.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
.. title:: clang-tidy - clang-analyzer-unix.BlockInCriticalSection
2+
.. meta::
3+
:http-equiv=refresh: 5;URL=https://clang.llvm.org/docs/analyzer/checkers.html#unix-blockincriticalsection
4+
5+
clang-analyzer-unix.BlockInCriticalSection
6+
==========================================
7+
8+
Check for calls to blocking functions inside a critical section.
9+
10+
The `clang-analyzer-unix.BlockInCriticalSection` check is an alias, please see
11+
`Clang Static Analyzer Available Checkers
12+
<https://clang.llvm.org/docs/analyzer/checkers.html#unix-blockincriticalsection>`_
13+
for more information.

0 commit comments

Comments
 (0)