Skip to content

Commit 3fa2b50

Browse files
authored
Merge branch 'main' into make_from_tuple_temp
2 parents 4e73566 + 6b09e95 commit 3fa2b50

File tree

658 files changed

+29962
-9466
lines changed

Some content is hidden

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

658 files changed

+29962
-9466
lines changed

.ci/utils.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,15 @@ function at-exit {
2626
mkdir -p artifacts
2727
sccache --show-stats >> artifacts/sccache_stats.txt
2828
cp "${BUILD_DIR}"/.ninja_log artifacts/.ninja_log
29+
cp "${MONOREPO_ROOT}"/*.log artifacts/ || :
2930
cp "${BUILD_DIR}"/test-results.*.xml artifacts/ || :
3031

3132
# If building fails there will be no results files.
3233
shopt -s nullglob
3334

3435
if [[ "$GITHUB_STEP_SUMMARY" != "" ]]; then
3536
python "${MONOREPO_ROOT}"/.ci/generate_test_report_github.py \
36-
$retcode "${BUILD_DIR}"/test-results.*.xml "${BUILD_DIR}"/ninja*.log \
37+
$retcode "${BUILD_DIR}"/test-results.*.xml "${MONOREPO_ROOT}"/ninja*.log \
3738
>> $GITHUB_STEP_SUMMARY
3839
fi
3940
}

.git-blame-ignore-revs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,3 @@ a3a007ad5fa20abc90ead4e1030b481bf109b4cf
143143
b7e332d3f59f567b1999fbcc660d7837cba8e406
144144
6056f942abe83b05406df8b04e95ec37a3d160b5
145145
906295b8a31c8dac5aa845864c0bca9f02f86184
146-
147-
# [mlir][tensor][linalg] Move Pack/UnPack Ops to Linalg
148-
517800e37e8d3a4ee84214bef65e227612c2a98b

clang-tools-extra/clang-tidy/readability/ContainerSizeEmptyCheck.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -238,9 +238,12 @@ void ContainerSizeEmptyCheck::check(const MatchFinder::MatchResult &Result) {
238238
? MemberCallObject
239239
: (Pointee ? Pointee : Result.Nodes.getNodeAs<Expr>("STLObject"));
240240
FixItHint Hint;
241-
std::string ReplacementText = std::string(
242-
Lexer::getSourceText(CharSourceRange::getTokenRange(E->getSourceRange()),
243-
*Result.SourceManager, getLangOpts()));
241+
std::string ReplacementText =
242+
E->isImplicitCXXThis()
243+
? ""
244+
: std::string(Lexer::getSourceText(
245+
CharSourceRange::getTokenRange(E->getSourceRange()),
246+
*Result.SourceManager, getLangOpts()));
244247
const auto *OpCallExpr = dyn_cast<CXXOperatorCallExpr>(E);
245248
if (isBinaryOrTernary(E) || isa<UnaryOperator>(E) ||
246249
(OpCallExpr && (OpCallExpr->getOperator() == OO_Star))) {
@@ -251,6 +254,8 @@ void ContainerSizeEmptyCheck::check(const MatchFinder::MatchResult &Result) {
251254
// This can happen if the object is a smart pointer. Don't add anything
252255
// because a '->' is already there (PR#51776), just call the method.
253256
ReplacementText += "empty()";
257+
} else if (E->isImplicitCXXThis()) {
258+
ReplacementText += "empty()";
254259
} else if (E->getType()->isPointerType())
255260
ReplacementText += "->empty()";
256261
else

clang-tools-extra/docs/ReleaseNotes.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,10 @@ Changes in existing checks
186186
<clang-tidy/checks/portability/template-virtual-member-function>` check to
187187
avoid false positives on pure virtual member functions.
188188

189+
- Improved :doc:`readability-container-size-empty
190+
<clang-tidy/checks/readability/container-size-empty>` check by correctly
191+
generating fix-it hints when size method is called from implicit ``this``.
192+
189193
- Improved :doc:`readability-identifier-naming
190194
<clang-tidy/checks/readability/identifier-naming>` check by ignoring
191195
declarations in system headers.

clang-tools-extra/test/clang-tidy/checkers/readability/container-size-empty.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -895,3 +895,16 @@ namespace PR94454 {
895895
int operator""_ci() { return 0; }
896896
auto eq = 0_ci == 0;
897897
}
898+
899+
namespace GH152387 {
900+
901+
class foo : public std::string{
902+
void doit() {
903+
if (!size()) {
904+
// CHECK-MESSAGES: :[[@LINE-1]]:10: warning: the 'empty' method should be used to check for emptiness instead of 'size'
905+
// CHECK-FIXES: if (empty()) {
906+
}
907+
}
908+
};
909+
910+
}

clang/bindings/python/clang/cindex.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1907,6 +1907,15 @@ def linkage(self) -> LinkageKind:
19071907

19081908
return LinkageKind.from_id(self._linkage)
19091909

1910+
@property
1911+
@cursor_null_guard
1912+
def language(self) -> LanguageKind:
1913+
"""Determine the "language" of the entity referred to by a given cursor."""
1914+
if not hasattr(self, "_language"):
1915+
self._language = conf.lib.clang_getCursorLanguage(self)
1916+
1917+
return LanguageKind.from_id(self._language)
1918+
19101919
@property
19111920
@cursor_null_guard
19121921
def tls_kind(self) -> TLSKind:
@@ -2584,6 +2593,17 @@ class LinkageKind(BaseEnumeration):
25842593
EXTERNAL = 4
25852594

25862595

2596+
class LanguageKind(BaseEnumeration):
2597+
"""
2598+
Describe the "language" of the entity referred to by a cursor.
2599+
"""
2600+
2601+
INVALID = 0
2602+
C = 1
2603+
OBJ_C = 2
2604+
C_PLUS_PLUS = 3
2605+
2606+
25872607
class TLSKind(BaseEnumeration):
25882608
"""Describes the kind of thread-local storage (TLS) of a cursor."""
25892609

@@ -4084,6 +4104,7 @@ def set_property(self, property, value):
40844104
("clang_getCursorDisplayName", [Cursor], _CXString),
40854105
("clang_getCursorExceptionSpecificationType", [Cursor], c_int),
40864106
("clang_getCursorExtent", [Cursor], SourceRange),
4107+
("clang_getCursorLanguage", [Cursor], c_int),
40874108
("clang_getCursorLexicalParent", [Cursor], Cursor),
40884109
("clang_getCursorLinkage", [Cursor], c_int),
40894110
("clang_getCursorLocation", [Cursor], SourceLocation),
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import os
2+
3+
from clang.cindex import Config, LanguageKind
4+
5+
if "CLANG_LIBRARY_PATH" in os.environ:
6+
Config.set_library_path(os.environ["CLANG_LIBRARY_PATH"])
7+
8+
import unittest
9+
10+
from .util import get_cursor, get_tu
11+
12+
13+
class TestCursorLanguage(unittest.TestCase):
14+
def test_c(self):
15+
tu = get_tu("int a;", lang="c")
16+
main_func = get_cursor(tu.cursor, "a")
17+
self.assertEqual(main_func.language, LanguageKind.C)
18+
19+
def test_c(self):
20+
tu = get_tu("class Cls {};", lang="cpp")
21+
main_func = get_cursor(tu.cursor, "Cls")
22+
self.assertEqual(main_func.language, LanguageKind.C_PLUS_PLUS)
23+
24+
def test_obj_c(self):
25+
tu = get_tu("@interface If : NSObject", lang="objc")
26+
main_func = get_cursor(tu.cursor, "If")
27+
self.assertEqual(main_func.language, LanguageKind.OBJ_C)

clang/bindings/python/tests/cindex/test_enums.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
BinaryOperator,
77
CursorKind,
88
ExceptionSpecificationKind,
9+
LanguageKind,
910
LinkageKind,
1011
RefQualifierKind,
1112
StorageClass,
@@ -26,6 +27,7 @@ class TestEnums(unittest.TestCase):
2627
AccessSpecifier,
2728
TypeKind,
2829
RefQualifierKind,
30+
LanguageKind,
2931
LinkageKind,
3032
TLSKind,
3133
StorageClass,

clang/docs/LanguageExtensions.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -759,7 +759,8 @@ Unless specified otherwise operation(±0) = ±0 and operation(±infinity) = ±in
759759

760760
The integer elementwise intrinsics, including ``__builtin_elementwise_popcount``,
761761
``__builtin_elementwise_bitreverse``, ``__builtin_elementwise_add_sat``,
762-
``__builtin_elementwise_sub_sat`` can be called in a ``constexpr`` context.
762+
``__builtin_elementwise_sub_sat``, ``__builtin_elementwise_max``,
763+
``__builtin_elementwise_min`` can be called in a ``constexpr`` context.
763764

764765
No implicit promotion of integer types takes place. The mixing of integer types
765766
of different sizes and signs is forbidden in binary and ternary builtins.

clang/docs/ReleaseNotes.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,9 @@ Non-comprehensive list of changes in this release
124124
This feature is enabled by default but can be disabled by compiling with
125125
``-fno-sanitize-annotate-debug-info-traps``.
126126

127+
- ``__builtin_elementwise_max`` and ``__builtin_elementwise_min`` functions for integer types can
128+
now be used in constant expressions.
129+
127130
New Compiler Flags
128131
------------------
129132
- New option ``-fno-sanitize-annotate-debug-info-traps`` added to disable emitting trap reasons into the debug info when compiling with trapping UBSan (e.g. ``-fsanitize-trap=undefined``).
@@ -188,6 +191,7 @@ Bug Fixes to C++ Support
188191
(``[[assume(expr)]]``) creates temporary objects.
189192
- Fix the dynamic_cast to final class optimization to correctly handle
190193
casts that are guaranteed to fail (#GH137518).
194+
- Fix bug rejecting partial specialization of variable templates with auto NTTPs (#GH118190).
191195

192196
Bug Fixes to AST Handling
193197
^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -294,6 +298,7 @@ Crash and bug fixes
294298
^^^^^^^^^^^^^^^^^^^
295299
- Fixed a crash in the static analyzer that when the expression in an
296300
``[[assume(expr)]]`` attribute was enclosed in parentheses. (#GH151529)
301+
- Fixed a crash when parsing ``#embed`` parameters with unmatched closing brackets. (#GH152829)
297302

298303
Improvements
299304
^^^^^^^^^^^^
@@ -308,6 +313,7 @@ Sanitizers
308313

309314
Python Binding Changes
310315
----------------------
316+
- Exposed `clang_getCursorLanguage` via `Cursor.language`.
311317

312318
OpenMP Support
313319
--------------

0 commit comments

Comments
 (0)