Skip to content

Commit b2638a0

Browse files
committed
merge main into amd-staging
2 parents 473d7ea + bfc732e commit b2638a0

File tree

31 files changed

+1291
-147
lines changed

31 files changed

+1291
-147
lines changed

clang-tools-extra/clangd/test/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ set(CLANGD_TEST_DEPS
33
ClangdTests
44
clangd-indexer
55
split-file
6-
IndexBenchmark
76
)
87

98
if(CLANGD_BUILD_XPC)

clang-tools-extra/clangd/test/include-cleaner-batch-fix.test

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,7 @@
77
# RUN: cp -r %S/Inputs/include-cleaner %t/include
88
# RUN: echo '-I%t/include' > %t/compile_flags.txt
99
# Create a config file enabling include-cleaner features.
10-
# RUN: echo 'Diagnostics:' > %t/clangd/config.yaml
11-
# RUN: echo ' UnusedIncludes: Strict' >> %t/clangd/config.yaml
12-
# RUN: echo ' MissingIncludes: Strict' >> %t/clangd/config.yaml
10+
# RUN: echo $'Diagnostics:\n UnusedIncludes: Strict\n MissingIncludes: Strict' >> %t/clangd/config.yaml
1311

1412
# RUN: env XDG_CONFIG_HOME=%t clangd -lit-test -enable-config --compile-commands-dir=%t < %s | FileCheck -strict-whitespace %s
1513
{"jsonrpc":"2.0","id":0,"method":"initialize","params":{"processId":123,"rootPath":"clangd","capabilities":{"workspace":{"workspaceEdit":{"documentChanges":true, "changeAnnotationSupport":{"groupsOnLabel":true}}}},"trace":"off"}}
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# Paths are not constructed correctly for the test to run on Windows.
2-
# UNSUPPORTED: system-windows
31
# RUN: clangd-indexer %p/Inputs/BenchmarkSource.cpp -- -I%p/Inputs > %t.index
4-
# RUN: %clangd-benchmark-dir/IndexBenchmark %t.index %p/Inputs/requests.json --benchmark_min_time=0.01
2+
# FIXME: By default, benchmarks are excluded from the list of default targets hence not built. Find a way to depend on benchmarks to run the next command.
3+
# REQUIRES: shell
4+
# RUN: if [ -f %clangd-benchmark-dir/IndexBenchmark ]; then %clangd-benchmark-dir/IndexBenchmark %t.index %p/Inputs/requests.json --benchmark_min_time=0.01 ; fi
55
# Pass invalid JSON file and check that IndexBenchmark fails to parse it.
6-
# RUN: not %clangd-benchmark-dir/IndexBenchmark %t.index %t --benchmark_min_time=0.01
6+
# RUN: if [ -f %clangd-benchmark-dir/IndexBenchmark ]; then not %clangd-benchmark-dir/IndexBenchmark %t.index %t --benchmark_min_time=0.01 ; fi

clang-tools-extra/clangd/test/system-include-extractor.test

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
55

66
# Create a bin directory to store the mock-driver and add it to the path
77
# RUN: mkdir -p %t.dir/bin
8-
# RUN: %python -c "print(__import__('os').environ['PATH'])" > %t.path
9-
# RUN: export PATH=%t.dir/bin:%{readfile:%t.path}
8+
# RUN: export PATH=%t.dir/bin:$PATH
109
# Generate a mock-driver that will print %temp_dir%/my/dir and
1110
# %temp_dir%/my/dir2 as include search paths.
1211
# RUN: echo '#!/bin/sh' >> %t.dir/bin/my_driver.sh

clang/docs/LanguageExtensions.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4848,6 +4848,14 @@ memory scope argument. These are designed to be a generic alternative to the
48484848
``__opencl_atomic_*`` builtin functions for targets that support atomic memory
48494849
scopes.
48504850
4851+
Clang provides two additional __scoped_atomic builtins:
4852+
4853+
* ``__scoped_atomic_uinc_wrap``
4854+
* ``__scoped_atomic_udec_wrap``
4855+
4856+
See LLVM IR `atomicrmw <https://llvm.org/docs/LangRef.html#atomicrmw-instruction>`_
4857+
instruction for the semantics of uinc_wrap and udec_wrap.
4858+
48514859
Atomic memory scopes are designed to assist optimizations for systems with
48524860
several levels of memory hierarchy like GPUs. The following memory scopes are
48534861
currently supported:

clang/docs/ReleaseNotes.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,8 @@ C23 Feature Support
225225

226226
Non-comprehensive list of changes in this release
227227
-------------------------------------------------
228+
- Added ``__scoped_atomic_uinc_wrap`` and ``__scoped_atomic_udec_wrap``.
229+
228230
- Removed OpenCL header-only feature macros (previously unconditionally enabled
229231
on SPIR-V and only selectively disabled via ``-D__undef_<feature>``). All
230232
OpenCL extensions and features are now centralized in OpenCLExtensions.def,

clang/include/clang/Basic/Builtins.td

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2290,6 +2290,18 @@ def ScopedAtomicMaxFetch : AtomicBuiltin {
22902290
let Prototype = "void(...)";
22912291
}
22922292

2293+
def ScopedAtomicUIncWrap : AtomicBuiltin {
2294+
let Spellings = ["__scoped_atomic_uinc_wrap"];
2295+
let Attributes = [CustomTypeChecking];
2296+
let Prototype = "void(...)";
2297+
}
2298+
2299+
def ScopedAtomicUDecWrap : AtomicBuiltin {
2300+
let Spellings = ["__scoped_atomic_udec_wrap"];
2301+
let Attributes = [CustomTypeChecking];
2302+
let Prototype = "void(...)";
2303+
}
2304+
22932305
// OpenCL 2.0 atomic builtins.
22942306
def OpenCLAtomicInit : AtomicBuiltin {
22952307
let Spellings = ["__opencl_atomic_init"];

clang/lib/AST/Expr.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5213,6 +5213,8 @@ unsigned AtomicExpr::getNumSubExprs(AtomicOp Op) {
52135213
case AO__scoped_atomic_fetch_min:
52145214
case AO__scoped_atomic_fetch_max:
52155215
case AO__scoped_atomic_exchange_n:
5216+
case AO__scoped_atomic_uinc_wrap:
5217+
case AO__scoped_atomic_udec_wrap:
52165218
case AO__hip_atomic_exchange:
52175219
case AO__hip_atomic_fetch_add:
52185220
case AO__hip_atomic_fetch_sub:

clang/lib/Analysis/FlowSensitive/Transfer.cpp

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -769,8 +769,29 @@ class TransferVisitor : public ConstStmtVisitor<TransferVisitor> {
769769
StorageLocation *TrueLoc = TrueEnv->getStorageLocation(*S->getTrueExpr());
770770
StorageLocation *FalseLoc =
771771
FalseEnv->getStorageLocation(*S->getFalseExpr());
772-
if (TrueLoc == FalseLoc && TrueLoc != nullptr)
772+
if (TrueLoc == FalseLoc && TrueLoc != nullptr) {
773773
Env.setStorageLocation(*S, *TrueLoc);
774+
} else if (!S->getType()->isRecordType()) {
775+
// Ideally, we would have something like an "alias set" to say that the
776+
// result StorageLocation can be either of the locations from the
777+
// TrueEnv or FalseEnv. Then, when this ConditionalOperator is
778+
// (a) used in an LValueToRValue cast, the value is the join of all of
779+
// the values in the alias set.
780+
// (b) or, used in an assignment to the resulting LValue, the assignment
781+
// *may* update all of the locations in the alias set.
782+
// For now, we do the simpler thing of creating a new StorageLocation
783+
// and joining the values right away, handling only case (a).
784+
// Otherwise, the dataflow framework needs to be updated be able to
785+
// represent alias sets and weak updates (for the "may").
786+
if (Value *Val = Environment::joinValues(
787+
S->getType(), TrueEnv->getValue(*S->getTrueExpr()), *TrueEnv,
788+
FalseEnv->getValue(*S->getFalseExpr()), *FalseEnv, Env,
789+
Model)) {
790+
StorageLocation &Loc = Env.createStorageLocation(*S);
791+
Env.setStorageLocation(*S, Loc);
792+
Env.setValue(Loc, *Val);
793+
}
794+
}
774795
} else if (!S->getType()->isRecordType()) {
775796
// The conditional operator can evaluate to either of the values of the
776797
// two branches. To model this, join these two values together to yield

clang/lib/Analysis/ThreadSafety.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2820,7 +2820,7 @@ void ThreadSafetyAnalyzer::runAnalysis(AnalysisDeclContext &AC) {
28202820
case CFGElement::AutomaticObjectDtor: {
28212821
CFGAutomaticObjDtor AD = BI.castAs<CFGAutomaticObjDtor>();
28222822
const auto *DD = AD.getDestructorDecl(AC.getASTContext());
2823-
if (!DD->hasAttrs())
2823+
if (!DD || !DD->hasAttrs())
28242824
break;
28252825

28262826
LocksetBuilder.handleCall(

0 commit comments

Comments
 (0)