Skip to content

Commit f894d7d

Browse files
Merge branch 'main' into main
2 parents 105afd1 + 1f3e2c6 commit f894d7d

File tree

347 files changed

+15415
-12419
lines changed

Some content is hidden

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

347 files changed

+15415
-12419
lines changed

.github/workflows/libcxx-build-containers.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,9 @@ jobs:
6464

6565
- name: Push the images
6666
if: github.event_name == 'push'
67-
run: docker compose push libcxx-linux-builder-base libcxx-linux-builder libcxx-android-builder
67+
run: docker compose --file libcxx/utils/ci/docker/docker-compose.yml push libcxx-linux-builder-base libcxx-linux-builder libcxx-android-builder
68+
env:
69+
TAG: ${{ github.sha }}
6870

6971
# We create tarballs with the images and upload them as artifacts, since that's useful for testing
7072
# the images when making changes.

clang/docs/ReleaseNotes.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ Potentially Breaking Changes
6969
call the member ``operator delete`` instead of the expected global
7070
delete operator. The old behavior is retained under ``-fclang-abi-compat=21``
7171
flag.
72+
- Clang warning suppressions file, ``--warning-suppression-mappings=``, now will
73+
use the last matching entry instead of the longest one.
7274
- Trailing null statements in GNU statement expressions are no longer
7375
ignored by Clang; they now result in a void type. Clang previously
7476
matched GCC's behavior, which was recently clarified to be incorrect.

clang/docs/WarningSuppressionMappings.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ Format
6363
Warning suppression mappings uses the same format as
6464
:doc:`SanitizerSpecialCaseList`.
6565

66-
Sections describe which diagnostic group's behaviour to change, e.g.
66+
Sections describe which diagnostic group's behavior to change, e.g.
6767
``[unused]``. When a diagnostic is matched by multiple sections, the latest
6868
section takes precedence.
6969

@@ -76,7 +76,7 @@ Source files are matched against these globs either:
7676
- as paths relative to the current working directory
7777
- as absolute paths.
7878

79-
When a source file matches multiple globs in a section, the longest one takes
79+
When a source file matches multiple globs in a section, the last one takes
8080
precedence.
8181

8282
.. code-block:: bash

clang/include/clang/Basic/Diagnostic.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -971,7 +971,7 @@ class DiagnosticsEngine : public RefCountedBase<DiagnosticsEngine> {
971971
/// diagnostics in specific files.
972972
/// Mapping file is expected to be a special case list with sections denoting
973973
/// diagnostic groups and `src` entries for globs to suppress. `emit` category
974-
/// can be used to disable suppression. Longest glob that matches a filepath
974+
/// can be used to disable suppression. The last glob that matches a filepath
975975
/// takes precedence. For example:
976976
/// [unused]
977977
/// src:clang/*

clang/lib/Basic/Diagnostic.cpp

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -525,8 +525,7 @@ std::unique_ptr<WarningsSpecialCaseList>
525525
WarningsSpecialCaseList::create(const llvm::MemoryBuffer &Input,
526526
std::string &Err) {
527527
auto WarningSuppressionList = std::make_unique<WarningsSpecialCaseList>();
528-
if (!WarningSuppressionList->createInternal(&Input, Err,
529-
/*OrderBySize=*/true))
528+
if (!WarningSuppressionList->createInternal(&Input, Err))
530529
return nullptr;
531530
return WarningSuppressionList;
532531
}
@@ -588,15 +587,12 @@ bool WarningsSpecialCaseList::isDiagSuppressed(diag::kind DiagId,
588587

589588
StringRef F = llvm::sys::path::remove_leading_dotslash(PLoc.getFilename());
590589

591-
StringRef LongestSup = DiagSection->getLongestMatch("src", F, "");
592-
if (LongestSup.empty())
590+
unsigned LastSup = DiagSection->getLastMatch("src", F, "");
591+
if (LastSup == 0)
593592
return false;
594593

595-
StringRef LongestEmit = DiagSection->getLongestMatch("src", F, "emit");
596-
if (LongestEmit.empty())
597-
return true;
598-
599-
return LongestSup.size() > LongestEmit.size();
594+
unsigned LastEmit = DiagSection->getLastMatch("src", F, "emit");
595+
return LastSup > LastEmit;
600596
}
601597

602598
bool DiagnosticsEngine::isSuppressedViaMapping(diag::kind DiagId,

clang/lib/CIR/CodeGen/CIRGenBuilder.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -315,8 +315,10 @@ class CIRGenBuilderTy : public cir::CIRBaseBuilderTy {
315315
return getConstantInt(loc, getUInt32Ty(), c);
316316
}
317317
cir::ConstantOp getSInt64(uint64_t c, mlir::Location loc) {
318-
cir::IntType sInt64Ty = getSInt64Ty();
319-
return cir::ConstantOp::create(*this, loc, cir::IntAttr::get(sInt64Ty, c));
318+
return getConstantInt(loc, getSInt64Ty(), c);
319+
}
320+
cir::ConstantOp getUInt64(uint64_t c, mlir::Location loc) {
321+
return getConstantInt(loc, getUInt64Ty(), c);
320322
}
321323

322324
mlir::Value createNeg(mlir::Value value) {

clang/lib/CIR/CodeGen/CIRGenBuiltin.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -630,6 +630,22 @@ CIRGenFunction::emitTargetBuiltinExpr(unsigned builtinID, const CallExpr *e,
630630
getTarget().getTriple().getArch());
631631
}
632632

633+
mlir::Value CIRGenFunction::emitScalarOrConstFoldImmArg(
634+
const unsigned iceArguments, const unsigned idx, const Expr *argExpr) {
635+
mlir::Value arg = {};
636+
if ((iceArguments & (1 << idx)) == 0) {
637+
arg = emitScalarExpr(argExpr);
638+
} else {
639+
// If this is required to be a constant, constant fold it so that we
640+
// know that the generated intrinsic gets a ConstantInt.
641+
const std::optional<llvm::APSInt> result =
642+
argExpr->getIntegerConstantExpr(getContext());
643+
assert(result && "Expected argument to be a constant");
644+
arg = builder.getConstInt(getLoc(argExpr->getSourceRange()), *result);
645+
}
646+
return arg;
647+
}
648+
633649
/// Given a builtin id for a function like "__builtin_fabsf", return a Function*
634650
/// for "fabsf".
635651
cir::FuncOp CIRGenModule::getBuiltinLibFunction(const FunctionDecl *fd,

clang/lib/CIR/CodeGen/CIRGenBuiltinX86.cpp

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
#include "clang/Basic/Builtins.h"
1717
#include "clang/Basic/TargetBuiltins.h"
1818
#include "clang/CIR/MissingFeatures.h"
19-
#include "llvm/IR/IntrinsicsX86.h"
2019

2120
using namespace clang;
2221
using namespace clang::CIRGen;
@@ -66,9 +65,8 @@ mlir::Value CIRGenFunction::emitX86BuiltinExpr(unsigned builtinID,
6665
getContext().GetBuiltinType(builtinID, error, &iceArguments);
6766
assert(error == ASTContext::GE_None && "Error while getting builtin type.");
6867

69-
for (auto [idx, arg] : llvm::enumerate(e->arguments())) {
68+
for (auto [idx, arg] : llvm::enumerate(e->arguments()))
7069
ops.push_back(emitScalarOrConstFoldImmArg(iceArguments, idx, arg));
71-
}
7270

7371
CIRGenBuilderTy &builder = getBuilder();
7472
mlir::Type voidTy = builder.getVoidTy();
@@ -98,6 +96,10 @@ mlir::Value CIRGenFunction::emitX86BuiltinExpr(unsigned builtinID,
9896
case X86::BI__builtin_ia32_undef128:
9997
case X86::BI__builtin_ia32_undef256:
10098
case X86::BI__builtin_ia32_undef512:
99+
cgm.errorNYI(e->getSourceRange(),
100+
std::string("unimplemented X86 builtin call: ") +
101+
getContext().BuiltinInfo.getName(builtinID));
102+
return {};
101103
case X86::BI__builtin_ia32_vec_ext_v4hi:
102104
case X86::BI__builtin_ia32_vec_ext_v16qi:
103105
case X86::BI__builtin_ia32_vec_ext_v8hi:
@@ -107,7 +109,22 @@ mlir::Value CIRGenFunction::emitX86BuiltinExpr(unsigned builtinID,
107109
case X86::BI__builtin_ia32_vec_ext_v32qi:
108110
case X86::BI__builtin_ia32_vec_ext_v16hi:
109111
case X86::BI__builtin_ia32_vec_ext_v8si:
110-
case X86::BI__builtin_ia32_vec_ext_v4di:
112+
case X86::BI__builtin_ia32_vec_ext_v4di: {
113+
unsigned numElts = cast<cir::VectorType>(ops[0].getType()).getSize();
114+
115+
uint64_t index =
116+
ops[1].getDefiningOp<cir::ConstantOp>().getIntValue().getZExtValue();
117+
118+
index &= numElts - 1;
119+
120+
cir::ConstantOp indexVal =
121+
builder.getUInt64(index, getLoc(e->getExprLoc()));
122+
123+
// These builtins exist so we can ensure the index is an ICE and in range.
124+
// Otherwise we could just do this in the header file.
125+
return cir::VecExtractOp::create(builder, getLoc(e->getExprLoc()), ops[0],
126+
indexVal);
127+
}
111128
case X86::BI__builtin_ia32_vec_set_v4hi:
112129
case X86::BI__builtin_ia32_vec_set_v16qi:
113130
case X86::BI__builtin_ia32_vec_set_v8hi:

clang/lib/CIR/CodeGen/CIRGenExprScalar.cpp

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1442,28 +1442,6 @@ mlir::Value CIRGenFunction::emitPromotedScalarExpr(const Expr *e,
14421442
return ScalarExprEmitter(*this, builder).Visit(const_cast<Expr *>(e));
14431443
}
14441444

1445-
mlir::Value CIRGenFunction::emitScalarOrConstFoldImmArg(unsigned iceArguments,
1446-
unsigned index,
1447-
const Expr *arg) {
1448-
mlir::Value result{};
1449-
1450-
// The bit at the specified index indicates whether the argument is required
1451-
// to be a constant integer expression.
1452-
bool isArgRequiredToBeConstant = (iceArguments & (1 << index));
1453-
1454-
if (!isArgRequiredToBeConstant) {
1455-
result = emitScalarExpr(arg);
1456-
} else {
1457-
// If this is required to be a constant, constant fold it so that we
1458-
// know that the generated intrinsic gets a ConstantInt.
1459-
std::optional<llvm::APSInt> iceOpt =
1460-
arg->getIntegerConstantExpr(getContext());
1461-
assert(iceOpt && "Expected argument to be a constant");
1462-
result = builder.getConstInt(getLoc(arg->getSourceRange()), *iceOpt);
1463-
}
1464-
return result;
1465-
}
1466-
14671445
[[maybe_unused]] static bool mustVisitNullValue(const Expr *e) {
14681446
// If a null pointer expression's type is the C++0x nullptr_t and
14691447
// the expression is not a simple literal, it must be evaluated

clang/lib/CIR/CodeGen/CIRGenFunction.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1546,9 +1546,6 @@ class CIRGenFunction : public CIRGenTypeCache {
15461546
mlir::Value emitScalarExpr(const clang::Expr *e,
15471547
bool ignoreResultAssign = false);
15481548

1549-
mlir::Value emitScalarOrConstFoldImmArg(unsigned iceArguments, unsigned index,
1550-
const Expr *arg);
1551-
15521549
mlir::Value emitScalarPrePostIncDec(const UnaryOperator *e, LValue lv,
15531550
cir::UnaryOpKind kind, bool isPre);
15541551

@@ -1721,6 +1718,9 @@ class CIRGenFunction : public CIRGenTypeCache {
17211718
void emitScalarInit(const clang::Expr *init, mlir::Location loc,
17221719
LValue lvalue, bool capturedByInit = false);
17231720

1721+
mlir::Value emitScalarOrConstFoldImmArg(unsigned iceArguments, unsigned idx,
1722+
const Expr *argExpr);
1723+
17241724
void emitStaticVarDecl(const VarDecl &d, cir::GlobalLinkageKind linkage);
17251725

17261726
void emitStoreOfComplex(mlir::Location loc, mlir::Value v, LValue dest,

0 commit comments

Comments
 (0)