Vendor import of llvm-project branch release/21.x llvmorg-21.1.8-0-g2078da43e25a, a.k.a. 21.1.8 release.
This commit is contained in:
@@ -636,7 +636,10 @@ DeclarationFragmentsBuilder::getFragmentsForParam(const ParmVarDecl *Param) {
|
||||
DeclarationFragments::FragmentKind::InternalParam);
|
||||
} else {
|
||||
Fragments.append(std::move(TypeFragments));
|
||||
if (!T->isAnyPointerType() && !T->isBlockPointerType())
|
||||
// If the type is a type alias, append the space
|
||||
// even if the underlying type is a pointer type.
|
||||
if (T->isTypedefNameType() ||
|
||||
(!T->isAnyPointerType() && !T->isBlockPointerType()))
|
||||
Fragments.appendSpace();
|
||||
Fragments
|
||||
.append(Param->getName(),
|
||||
|
||||
@@ -182,8 +182,11 @@ const FormatToken *LeftRightQualifierAlignmentFixer::analyzeRight(
|
||||
// We only need to think about streams that begin with a qualifier.
|
||||
if (Tok->isNot(QualifierType))
|
||||
return Tok;
|
||||
|
||||
const auto *Next = Tok->getNextNonComment();
|
||||
|
||||
// Don't concern yourself if nothing follows the qualifier.
|
||||
if (!Tok->Next)
|
||||
if (!Next)
|
||||
return Tok;
|
||||
|
||||
// Skip qualifiers to the left to find what preceeds the qualifiers.
|
||||
@@ -247,9 +250,15 @@ const FormatToken *LeftRightQualifierAlignmentFixer::analyzeRight(
|
||||
}();
|
||||
|
||||
// Find the last qualifier to the right.
|
||||
const FormatToken *LastQual = Tok;
|
||||
while (isQualifier(LastQual->getNextNonComment()))
|
||||
LastQual = LastQual->getNextNonComment();
|
||||
const auto *LastQual = Tok;
|
||||
for (; isQualifier(Next); Next = Next->getNextNonComment())
|
||||
LastQual = Next;
|
||||
|
||||
if (!LastQual || !Next ||
|
||||
(LastQual->isOneOf(tok::kw_const, tok::kw_volatile) &&
|
||||
Next->isOneOf(Keywords.kw_override, Keywords.kw_final))) {
|
||||
return Tok;
|
||||
}
|
||||
|
||||
// If this qualifier is to the right of a type or pointer do a partial sort
|
||||
// and return.
|
||||
|
||||
@@ -2385,17 +2385,17 @@ bool UnwrappedLineParser::tryToParseLambdaIntroducer() {
|
||||
const FormatToken *LeftSquare = FormatTok;
|
||||
nextToken();
|
||||
if (Previous) {
|
||||
const auto *PrevPrev = Previous->getPreviousNonComment();
|
||||
if (Previous->is(tok::star) && PrevPrev && PrevPrev->isTypeName(LangOpts))
|
||||
return false;
|
||||
if (Previous->closesScope()) {
|
||||
// Not a potential C-style cast.
|
||||
if (Previous->isNot(tok::r_paren))
|
||||
return false;
|
||||
const auto *BeforeRParen = Previous->getPreviousNonComment();
|
||||
// Lambdas can be cast to function types only, e.g. `std::function<int()>`
|
||||
// and `int (*)()`.
|
||||
if (!BeforeRParen || !BeforeRParen->isOneOf(tok::greater, tok::r_paren))
|
||||
if (!PrevPrev || !PrevPrev->isOneOf(tok::greater, tok::r_paren))
|
||||
return false;
|
||||
} else if (Previous->is(tok::star)) {
|
||||
Previous = Previous->getPreviousNonComment();
|
||||
}
|
||||
if (Previous && Previous->Tok.getIdentifierInfo() &&
|
||||
!Previous->isOneOf(tok::kw_return, tok::kw_co_await, tok::kw_co_yield,
|
||||
|
||||
@@ -1295,7 +1295,10 @@ void WhitespaceManager::alignArrayInitializers() {
|
||||
bool FoundComplete = false;
|
||||
for (unsigned InsideIndex = ChangeIndex + 1; InsideIndex < ChangeEnd;
|
||||
++InsideIndex) {
|
||||
if (Changes[InsideIndex].Tok == C.Tok->MatchingParen) {
|
||||
const auto *Tok = Changes[InsideIndex].Tok;
|
||||
if (Tok->is(tok::pp_define))
|
||||
break;
|
||||
if (Tok == C.Tok->MatchingParen) {
|
||||
alignArrayInitializers(ChangeIndex, InsideIndex + 1);
|
||||
ChangeIndex = InsideIndex + 1;
|
||||
FoundComplete = true;
|
||||
|
||||
@@ -1287,7 +1287,7 @@ uptr GetPageSize() {
|
||||
|
||||
uptr ReadBinaryName(/*out*/ char *buf, uptr buf_len) {
|
||||
# if SANITIZER_HAIKU
|
||||
int cookie = 0;
|
||||
int32_t cookie = 0;
|
||||
image_info info;
|
||||
const char *argv0 = "<UNKNOWN>";
|
||||
while (get_next_image_info(B_CURRENT_TEAM, &cookie, &info) == B_OK) {
|
||||
@@ -1987,7 +1987,10 @@ SignalContext::WriteFlag SignalContext::GetWriteFlag() const {
|
||||
# elif SANITIZER_NETBSD
|
||||
uptr err = ucontext->uc_mcontext.__gregs[_REG_ERR];
|
||||
# elif SANITIZER_HAIKU
|
||||
uptr err = ucontext->uc_mcontext.r13;
|
||||
uptr err = 0; // FIXME: ucontext->uc_mcontext.r13;
|
||||
// The err register was added on the main branch and not
|
||||
// available with the current release. To be reverted later.
|
||||
// https://github.com/haiku/haiku/commit/11adda21aa4e6b24f71a496868a44d7607bc3764
|
||||
# elif SANITIZER_SOLARIS && defined(__i386__)
|
||||
const int Err = 13;
|
||||
uptr err = ucontext->uc_mcontext.gregs[Err];
|
||||
@@ -2617,6 +2620,11 @@ static void GetPcSpBp(void *context, uptr *pc, uptr *sp, uptr *bp) {
|
||||
*pc = ucontext->uc_mcontext.mc_eip;
|
||||
*bp = ucontext->uc_mcontext.mc_ebp;
|
||||
*sp = ucontext->uc_mcontext.mc_esp;
|
||||
# elif SANITIZER_HAIKU
|
||||
ucontext_t *ucontext = (ucontext_t *)context;
|
||||
*pc = ucontext->uc_mcontext.eip;
|
||||
*bp = ucontext->uc_mcontext.ebp;
|
||||
*sp = ucontext->uc_mcontext.esp;
|
||||
# else
|
||||
ucontext_t *ucontext = (ucontext_t *)context;
|
||||
# if SANITIZER_SOLARIS
|
||||
|
||||
@@ -629,7 +629,7 @@ typedef unsigned long __sanitizer_sigset_t;
|
||||
# elif SANITIZER_APPLE
|
||||
typedef unsigned __sanitizer_sigset_t;
|
||||
# elif SANITIZER_HAIKU
|
||||
typedef unsigned long __sanitizer_sigset_t;
|
||||
typedef unsigned long long __sanitizer_sigset_t;
|
||||
# elif SANITIZER_LINUX
|
||||
struct __sanitizer_sigset_t {
|
||||
// The size is determined by looking at sizeof of real sigset_t on linux.
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
// _LIBCPP_VERSION represents the version of libc++, which matches the version of LLVM.
|
||||
// Given a LLVM release LLVM XX.YY.ZZ (e.g. LLVM 17.0.1 == 17.00.01), _LIBCPP_VERSION is
|
||||
// defined to XXYYZZ.
|
||||
# define _LIBCPP_VERSION 210107
|
||||
# define _LIBCPP_VERSION 210108
|
||||
|
||||
# define _LIBCPP_CONCAT_IMPL(_X, _Y) _X##_Y
|
||||
# define _LIBCPP_CONCAT(_X, _Y) _LIBCPP_CONCAT_IMPL(_X, _Y)
|
||||
|
||||
@@ -502,7 +502,7 @@ static Value *getTrueOrFalseValue(
|
||||
} else {
|
||||
assert((isa<AShrOperator>(AuxI) || isa<SExtInst>(AuxI)) &&
|
||||
"Unexpected opcode");
|
||||
CBO->setOperand(CondIdx, ConstantInt::get(CBO->getType(), -1));
|
||||
CBO->setOperand(CondIdx, ConstantInt::getAllOnesValue(CBO->getType()));
|
||||
}
|
||||
|
||||
unsigned OtherIdx = 1 - CondIdx;
|
||||
|
||||
@@ -216,6 +216,18 @@ static MachineInstr *findStartOfTree(MachineOperand &MO,
|
||||
return Def;
|
||||
}
|
||||
|
||||
// FAKE_USEs are no-ops, so remove them here so that the values used by them
|
||||
// will be correctly dropped later.
|
||||
static void removeFakeUses(MachineFunction &MF) {
|
||||
SmallVector<MachineInstr *> ToDelete;
|
||||
for (auto &MBB : MF)
|
||||
for (auto &MI : MBB)
|
||||
if (MI.isFakeUse())
|
||||
ToDelete.push_back(&MI);
|
||||
for (auto *MI : ToDelete)
|
||||
MI->eraseFromParent();
|
||||
}
|
||||
|
||||
bool WebAssemblyExplicitLocals::runOnMachineFunction(MachineFunction &MF) {
|
||||
LLVM_DEBUG(dbgs() << "********** Make Locals Explicit **********\n"
|
||||
"********** Function: "
|
||||
@@ -226,6 +238,8 @@ bool WebAssemblyExplicitLocals::runOnMachineFunction(MachineFunction &MF) {
|
||||
WebAssemblyFunctionInfo &MFI = *MF.getInfo<WebAssemblyFunctionInfo>();
|
||||
const auto *TII = MF.getSubtarget<WebAssemblySubtarget>().getInstrInfo();
|
||||
|
||||
removeFakeUses(MF);
|
||||
|
||||
// Map non-stackified virtual registers to their local ids.
|
||||
DenseMap<unsigned, unsigned> Reg2Local;
|
||||
|
||||
|
||||
@@ -866,6 +866,10 @@ bool WebAssemblyRegStackify::runOnMachineFunction(MachineFunction &MF) {
|
||||
if (Insert->isDebugValue())
|
||||
continue;
|
||||
|
||||
// Ignore FAKE_USEs, which are no-ops and will be deleted later.
|
||||
if (Insert->isFakeUse())
|
||||
continue;
|
||||
|
||||
// Iterate through the inputs in reverse order, since we'll be pulling
|
||||
// operands off the stack in LIFO order.
|
||||
CommutingState Commuting;
|
||||
|
||||
@@ -90,6 +90,9 @@ PreservedAnalyses RealtimeSanitizerPass::run(Module &M,
|
||||
[&](Function *Ctor, FunctionCallee) { appendToGlobalCtors(M, Ctor, 0); });
|
||||
|
||||
for (Function &F : M) {
|
||||
if (F.empty())
|
||||
continue;
|
||||
|
||||
if (F.hasFnAttribute(Attribute::SanitizeRealtime))
|
||||
runSanitizeRealtime(F);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user