Skip to content

Commit 80a4987

Browse files
SC llvm teamSC llvm team
SC llvm team
authored and
SC llvm team
committed
Merged main:75ef95584d8867d0039a43bad0bd8e53f3293f67 into amd-gfx:600cb8c5e762
Local branch amd-gfx 600cb8c Manually merged main:ca53611c905f82628ab2e40185307995b552e14d into amd-gfx:4d9f2b277a22 Remote branch main 75ef955 [clang][bytecode][NFC] Move test to verify=expected,both style
2 parents 600cb8c + 75ef955 commit 80a4987

File tree

30 files changed

+321
-317
lines changed

30 files changed

+321
-317
lines changed

clang-tools-extra/include-cleaner/lib/WalkAST.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -351,11 +351,11 @@ class ASTWalker : public RecursiveASTVisitor<ASTWalker> {
351351
}
352352

353353
bool VisitCXXNewExpr(CXXNewExpr *E) {
354-
report(E->getExprLoc(), E->getOperatorNew());
354+
report(E->getExprLoc(), E->getOperatorNew(), RefType::Ambiguous);
355355
return true;
356356
}
357357
bool VisitCXXDeleteExpr(CXXDeleteExpr *E) {
358-
report(E->getExprLoc(), E->getOperatorDelete());
358+
report(E->getExprLoc(), E->getOperatorDelete(), RefType::Ambiguous);
359359
return true;
360360
}
361361
};

clang-tools-extra/include-cleaner/unittests/WalkASTTest.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -557,9 +557,9 @@ TEST(WalkAST, FriendDecl) {
557557
}
558558

559559
TEST(WalkAST, OperatorNewDelete) {
560-
testWalk("void* $explicit^operator new(decltype(sizeof(int)), void*);",
560+
testWalk("void* $ambiguous^operator new(decltype(sizeof(int)), void*);",
561561
"struct Bar { void foo() { Bar b; ^new (&b) Bar; } };");
562-
testWalk("struct A { static void $explicit^operator delete(void*); };",
562+
testWalk("struct A { static void $ambiguous^operator delete(void*); };",
563563
"void foo() { A a; ^delete &a; }");
564564
}
565565
} // namespace

clang/lib/Format/ContinuationIndenter.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -830,6 +830,12 @@ void ContinuationIndenter::addTokenOnCurrentLine(LineState &State, bool DryRun,
830830
const auto IsSimpleFunction = [&](const FormatToken &Tok) {
831831
if (!Tok.FakeLParens.empty() && Tok.FakeLParens.back() > prec::Unknown)
832832
return false;
833+
// Nested calls that involve `new` expressions also look like simple
834+
// function calls, eg:
835+
// - foo(new Bar())
836+
// - foo(::new Bar())
837+
if (Tok.is(tok::kw_new) || Tok.startsSequence(tok::coloncolon, tok::kw_new))
838+
return true;
833839
const auto *Previous = Tok.Previous;
834840
if (!Previous || (!Previous->isOneOf(TT_FunctionDeclarationLParen,
835841
TT_LambdaDefinitionLParen) &&
@@ -852,6 +858,9 @@ void ContinuationIndenter::addTokenOnCurrentLine(LineState &State, bool DryRun,
852858
// caaaaaaaaaaaall(
853859
// caaaaaaaaaaaall(
854860
// caaaaaaaaaaaaaaaaaaaaaaall(aaaaaaaaaaaaaa, aaaaaaaaa))));
861+
// or
862+
// caaaaaaaaaaaaaaaaaaaaal(
863+
// new SomethingElseeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee());
855864
!IsSimpleFunction(Current)) {
856865
CurrentState.NoLineBreak = true;
857866
}

clang/test/AST/ByteCode/invalid.cpp

Lines changed: 16 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -5,65 +5,49 @@ namespace Throw {
55

66
constexpr int ConditionalThrow(bool t) {
77
if (t)
8-
throw 4; // expected-note {{subexpression not valid in a constant expression}} \
9-
// ref-note {{subexpression not valid in a constant expression}}
8+
throw 4; // both-note {{subexpression not valid in a constant expression}}
109

1110
return 0;
1211
}
1312

1413
static_assert(ConditionalThrow(false) == 0, "");
15-
static_assert(ConditionalThrow(true) == 0, ""); // expected-error {{not an integral constant expression}} \
16-
// expected-note {{in call to 'ConditionalThrow(true)'}} \
17-
// ref-error {{not an integral constant expression}} \
18-
// ref-note {{in call to 'ConditionalThrow(true)'}}
14+
static_assert(ConditionalThrow(true) == 0, ""); // both-error {{not an integral constant expression}} \
15+
// both-note {{in call to 'ConditionalThrow(true)'}}
1916

20-
constexpr int Throw() { // expected-error {{never produces a constant expression}} \
21-
// ref-error {{never produces a constant expression}}
22-
throw 5; // expected-note {{subexpression not valid in a constant expression}} \
23-
// ref-note {{subexpression not valid in a constant expression}}
17+
constexpr int Throw() { // both-error {{never produces a constant expression}}
18+
throw 5; // both-note {{subexpression not valid in a constant expression}}
2419
return 0;
2520
}
2621

27-
constexpr int NoSubExpr() { // ref-error {{never produces a constant expression}} \
28-
// expected-error {{never produces a constant expression}}
29-
throw; // ref-note 2{{subexpression not valid}} \
30-
// expected-note 2{{subexpression not valid}}
22+
constexpr int NoSubExpr() { // both-error {{never produces a constant expression}}
23+
throw; // both-note 2{{subexpression not valid}}
3124
return 0;
3225
}
33-
static_assert(NoSubExpr() == 0, ""); // ref-error {{not an integral constant expression}} \
34-
// ref-note {{in call to}} \
35-
// expected-error {{not an integral constant expression}} \
36-
// expected-note {{in call to}}
26+
static_assert(NoSubExpr() == 0, ""); // both-error {{not an integral constant expression}} \
27+
// both-note {{in call to}}
3728
}
3829

3930
namespace Asm {
4031
constexpr int ConditionalAsm(bool t) {
4132
if (t)
42-
asm(""); // expected-note {{subexpression not valid in a constant expression}} \
43-
// ref-note {{subexpression not valid in a constant expression}}
33+
asm(""); // both-note {{subexpression not valid in a constant expression}}
4434

4535
return 0;
4636
}
4737
static_assert(ConditionalAsm(false) == 0, "");
48-
static_assert(ConditionalAsm(true) == 0, ""); // expected-error {{not an integral constant expression}} \
49-
// expected-note {{in call to 'ConditionalAsm(true)'}} \
50-
// ref-error {{not an integral constant expression}} \
51-
// ref-note {{in call to 'ConditionalAsm(true)'}}
38+
static_assert(ConditionalAsm(true) == 0, ""); // both-error {{not an integral constant expression}} \
39+
// both-note {{in call to 'ConditionalAsm(true)'}}
5240

5341

54-
constexpr int Asm() { // expected-error {{never produces a constant expression}} \
55-
// ref-error {{never produces a constant expression}}
56-
__asm volatile(""); // expected-note {{subexpression not valid in a constant expression}} \
57-
// ref-note {{subexpression not valid in a constant expression}}
42+
constexpr int Asm() { // both-error {{never produces a constant expression}}
43+
__asm volatile(""); // both-note {{subexpression not valid in a constant expression}}
5844
return 0;
5945
}
6046
}
6147

6248
namespace Casts {
63-
constexpr int a = reinterpret_cast<int>(12); // expected-error {{must be initialized by a constant expression}} \
64-
// expected-note {{reinterpret_cast is not allowed}} \
65-
// ref-error {{must be initialized by a constant expression}} \
66-
// ref-note {{reinterpret_cast is not allowed}}
49+
constexpr int a = reinterpret_cast<int>(12); // both-error {{must be initialized by a constant expression}} \
50+
// both-note {{reinterpret_cast is not allowed}}
6751

6852
void func() {
6953
struct B {};

clang/unittests/Format/FormatTest.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9383,6 +9383,18 @@ TEST_F(FormatTest, AlignsAfterOpenBracket) {
93839383
" aaaaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaa)) &&\n"
93849384
" aaaaaaaaaaaaaaaa);",
93859385
Style);
9386+
verifyFormat(
9387+
"fooooooooooo(new BARRRRRRRRR(\n"
9388+
" XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXZZZZZZZZZZZZZZZZZZZZZZZZZ()));",
9389+
Style);
9390+
verifyFormat(
9391+
"fooooooooooo(::new BARRRRRRRRR(\n"
9392+
" XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXZZZZZZZZZZZZZZZZZZZZZZZZZ()));",
9393+
Style);
9394+
verifyFormat(
9395+
"fooooooooooo(new FOO::BARRRR(\n"
9396+
" XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXZZZZZZZZZZZZZZZZZZZZZZZZZ()));",
9397+
Style);
93869398

93879399
Style.AlignAfterOpenBracket = FormatStyle::BAS_BlockIndent;
93889400
Style.BinPackArguments = false;

compiler-rt/lib/nsan/nsan.cpp

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -445,32 +445,6 @@ int32_t checkFT(const FT value, ShadowFT Shadow, CheckTypeT CheckType,
445445
const InternalFT check_value = value;
446446
const InternalFT check_shadow = Shadow;
447447

448-
// We only check for NaNs in the value, not the shadow.
449-
if (flags().check_nan && isnan(check_value)) {
450-
GET_CALLER_PC_BP;
451-
BufferedStackTrace stack;
452-
stack.Unwind(pc, bp, nullptr, false);
453-
if (GetSuppressionForStack(&stack, CheckKind::Consistency)) {
454-
// FIXME: optionally print.
455-
return flags().resume_after_suppression ? kResumeFromValue
456-
: kContinueWithShadow;
457-
}
458-
Decorator D;
459-
Printf("%s", D.Warning());
460-
Printf("WARNING: NumericalStabilitySanitizer: NaN detected\n");
461-
Printf("%s", D.Default());
462-
stack.Print();
463-
if (flags().halt_on_error) {
464-
if (common_flags()->abort_on_error)
465-
Printf("ABORTING\n");
466-
else
467-
Printf("Exiting\n");
468-
Die();
469-
}
470-
// Performing other tests for NaN values is meaningless when dealing with numbers.
471-
return kResumeFromValue;
472-
}
473-
474448
// See this article for an interesting discussion of how to compare floats:
475449
// https://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/
476450
static constexpr const FT Eps = FTInfo<FT>::kEpsilon;

compiler-rt/lib/nsan/nsan_flags.inc

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,5 +48,3 @@ NSAN_FLAG(bool, enable_loadtracking_stats, false,
4848
"due to invalid or unknown types.")
4949
NSAN_FLAG(bool, poison_in_free, true, "")
5050
NSAN_FLAG(bool, print_stats_on_exit, false, "If true, print stats on exit.")
51-
NSAN_FLAG(bool, check_nan, false,
52-
"If true, check the floating-point number is nan")

compiler-rt/test/nsan/nan.cpp

Lines changed: 0 additions & 25 deletions
This file was deleted.

compiler-rt/test/nsan/softmax.cpp

Lines changed: 0 additions & 54 deletions
This file was deleted.

compiler-rt/test/nsan/vec_sqrt.cpp

Lines changed: 0 additions & 34 deletions
This file was deleted.

compiler-rt/test/nsan/vec_sqrt_ext.cpp

Lines changed: 0 additions & 25 deletions
This file was deleted.

llvm/docs/GitHub.rst

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,19 +26,19 @@ aren't associated with a pull-request **will be deleted**.
2626
Using Graphite for stacked Pull Requests
2727
========================================
2828

29-
[Graphite](https://app.graphite.dev/) is a stacked pull request tool supported
30-
by the LLVM repo (the other being [reviewable.io](https://reviewable.io)).
29+
`Graphite <https://app.graphite.dev/>`_ is a stacked pull request tool supported
30+
by the LLVM repo (the other being `reviewable.io <https://reviewable.io>`_).
3131

32-
Graphite will want to create branches under `llvm/llvm-project` rather than your
32+
Graphite will want to create branches under ``llvm/llvm-project`` rather than your
3333
private fork, so the guidance above, about branch naming, is critical, otherwise
34-
`gt submit` (i.e. publish your PRs for review) will fail.
34+
``gt submit`` (i.e. publish your PRs for review) will fail.
3535

36-
Use `gt config` then `Branch naming settings` and `Set a prefix for branch names`.
37-
Include the last `/`.
36+
Use ``gt config`` then ``Branch naming settings`` and ``Set a prefix for branch names``.
37+
Include the last ``/``.
3838

3939
If you didn't do the above and Graphite created non-prefixed branches, a simple way to
40-
unblock is to rename (`git -m <old name> <new name>`), and then checkout the branch
41-
and `gt track`.
40+
unblock is to rename (``git -m <old name> <new name>``), and then checkout the branch
41+
and ``gt track``.
4242

4343
Pull Requests
4444
=============

0 commit comments

Comments
 (0)