Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
a9f0594
[clang-format][NFC] Clean up FormatTestComments.cpp (#166029)
owenca Nov 3, 2025
3c0d4aa
[clang-format] Handle static_assert more accurately (#166042)
owenca Nov 3, 2025
fe01594
[TableGen] Use std::move properly (NFC) (#166104)
kazutakahirata Nov 3, 2025
7db6344
[CodeGen] Remove redundant declarations (NFC) (#166105)
kazutakahirata Nov 3, 2025
e0653ba
[Support] Remove redundant declarations (NFC) (#166106)
kazutakahirata Nov 3, 2025
2ad0668
[X86] Remove redundant declarations (NFC) (#166107)
kazutakahirata Nov 3, 2025
03eb3cd
[VPlan] Rewrite sinkScalarOperands (NFC) (#151696)
artagnon Nov 3, 2025
912cc5f
[VPlan] Improve getOrCreateVPValueForSCEVExpr (NFC) (#165699)
artagnon Nov 3, 2025
77c1db4
[OpenMP][AArch64] Fix frame pointer save in microtask (#165313)
dominik-wojt-2311446 Nov 3, 2025
f3b407f
[AArch64] Remove old non-power2 aarch64-sve-vector-bits-min tests. NFC
davemgreen Nov 3, 2025
f17c95b
[LV] Simplify vplan-printing.ll test (NFC)
sdesmalen-arm Nov 3, 2025
97d4e96
[VPlan] Perform optimizeMaskToEVL in terms of pattern matching (#155394)
lukel97 Nov 3, 2025
40a042e
[VPlanTransform] Specialize simplifyRecipe for VPSingleDefRecipe poin…
Mel-Chen Nov 3, 2025
0569cc1
[libc++] Simplify the implementation of __formatter::__fill a bit (#1…
philnik777 Nov 3, 2025
b614767
Fix bazel build caused by #165925 (#166144)
basioli-k Nov 3, 2025
4c3546f
[AArch64] Sink mismatching wide extends to mul (#164986)
davemgreen Nov 3, 2025
8998df2
[DropUnnecessaryAssumes] Don't drop public_type_test intrinsic (#166034)
hassnaaHamdi Nov 3, 2025
0013b5f
[clang-tidy][NFC] Fix alphabetical order in `list.rst` (#166123)
zeyi2 Nov 3, 2025
564c3de
[ThinLTO][NFC] Improve performance of `addThinLTO` (#166067)
nga888 Nov 3, 2025
5f3f175
[lldb-dap] Use protocol types for exceptioninfo (#165858)
da-viper Nov 3, 2025
33609bd
[AArch64][SVE] Coalesce SVE prologue/epilogue stack adjustments (#163…
MacDue Nov 3, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 17 additions & 6 deletions clang/lib/Format/TokenAnnotator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -358,11 +358,11 @@ class AnnotatingParser {
Contexts.back().IsExpression = false;
} else if (OpeningParen.Previous &&
(OpeningParen.Previous->isOneOf(
tok::kw_static_assert, tok::kw_noexcept, tok::kw_explicit,
tok::kw_while, tok::l_paren, tok::comma, TT_CastRParen,
tok::kw_noexcept, tok::kw_explicit, tok::kw_while,
tok::l_paren, tok::comma, TT_CastRParen,
TT_BinaryOperator) ||
OpeningParen.Previous->isIf())) {
// static_assert, if and while usually contain expressions.
// if and while usually contain expressions.
Contexts.back().IsExpression = true;
} else if (Style.isJavaScript() && OpeningParen.Previous &&
(OpeningParen.Previous->is(Keywords.kw_function) ||
Expand Down Expand Up @@ -454,6 +454,11 @@ class AnnotatingParser {
if (StartsObjCSelector)
OpeningParen.setType(TT_ObjCSelector);

const bool IsStaticAssert =
PrevNonComment && PrevNonComment->is(tok::kw_static_assert);
if (IsStaticAssert)
Contexts.back().InStaticAssertFirstArgument = true;

// MightBeFunctionType and ProbablyFunctionType are used for
// function pointer and reference types as well as Objective-C
// block types:
Expand Down Expand Up @@ -583,8 +588,12 @@ class AnnotatingParser {
}
// When we discover a 'new', we set CanBeExpression to 'false' in order to
// parse the type correctly. Reset that after a comma.
if (CurrentToken->is(tok::comma))
Contexts.back().CanBeExpression = true;
if (CurrentToken->is(tok::comma)) {
if (IsStaticAssert)
Contexts.back().InStaticAssertFirstArgument = false;
else
Contexts.back().CanBeExpression = true;
}

if (Style.isTableGen()) {
if (CurrentToken->is(tok::comma)) {
Expand Down Expand Up @@ -2144,6 +2153,7 @@ class AnnotatingParser {
bool CaretFound = false;
bool InCpp11AttributeSpecifier = false;
bool InCSharpAttributeSpecifier = false;
bool InStaticAssertFirstArgument = false;
bool VerilogAssignmentFound = false;
// Whether the braces may mean concatenation instead of structure or array
// literal.
Expand Down Expand Up @@ -2440,7 +2450,8 @@ class AnnotatingParser {
} else if (Current.isPointerOrReference()) {
Current.setType(determineStarAmpUsage(
Current,
Contexts.back().CanBeExpression && Contexts.back().IsExpression,
(Contexts.back().CanBeExpression && Contexts.back().IsExpression) ||
Contexts.back().InStaticAssertFirstArgument,
Contexts.back().ContextType == Context::TemplateArgument));
} else if (Current.isOneOf(tok::minus, tok::plus, tok::caret) ||
(Style.isVerilog() && Current.is(tok::pipe))) {
Expand Down
Loading