Skip to content

Commit 162dd77

Browse files
SC llvm teamSC llvm team
SC llvm team
authored and
SC llvm team
committed
Merged main:a87638596a78 into amd-gfx:d1338c27690c
Local branch amd-gfx d1338c2 Merged main:159614a52f0b into amd-gfx:71bb95469251 Remote branch main a876385 Revert tests missed in b997ff4
2 parents d1338c2 + a876385 commit 162dd77

40 files changed

+770
-224
lines changed

clang/lib/Format/TokenAnnotator.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3544,7 +3544,7 @@ void TokenAnnotator::calculateFormattingInformation(AnnotatedLine &Line) const {
35443544
}
35453545
}
35463546
}
3547-
} else if (Current->SpacesRequiredBefore == 0 &&
3547+
} else if (!Current->Finalized && Current->SpacesRequiredBefore == 0 &&
35483548
spaceRequiredBefore(Line, *Current)) {
35493549
Current->SpacesRequiredBefore = 1;
35503550
}

clang/test/CXX/over/over.match/over.match.funcs/over.match.oper/p3-2a.cpp

Lines changed: 0 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -324,57 +324,6 @@ bool x = X() == X(); // expected-warning {{ambiguous}}
324324
}
325325
} // namespace P2468R2
326326

327-
namespace GH53954{
328-
namespace friend_template_1 {
329-
struct P {
330-
template <class T>
331-
friend bool operator==(const P&, const T&); // expected-note {{candidate}} \
332-
// expected-note {{ambiguous candidate function with reversed arguments}}
333-
};
334-
struct A : public P {};
335-
struct B : public P {};
336-
bool check(A a, B b) { return a == b; } // expected-warning {{use of overloaded operator '==' (with operand types 'A' and 'B') to be ambiguous}}
337-
}
338-
339-
namespace friend_template_2 {
340-
struct P {
341-
template <class T>
342-
friend bool operator==(const T&, const P&); // expected-note {{candidate}} \
343-
// expected-note {{ambiguous candidate function with reversed arguments}}
344-
};
345-
struct A : public P {};
346-
struct B : public P {};
347-
bool check(A a, B b) { return a == b; } // expected-warning {{use of overloaded operator '==' (with operand types 'A' and 'B') to be ambiguous}}
348-
}
349-
350-
namespace member_template {
351-
struct P {
352-
template<class S>
353-
bool operator==(const S &) const; // expected-note {{candidate}} \
354-
// expected-note {{ambiguous candidate function with reversed arguments}}
355-
};
356-
struct A : public P {};
357-
struct B : public P {};
358-
bool check(A a, B b) { return a == b; } // expected-warning {{use of overloaded operator '==' (with operand types 'A' and 'B') to be ambiguous}}
359-
}
360-
361-
namespace non_member_template_1 {
362-
struct P {};
363-
template<class S>
364-
bool operator==(const P&, const S &); // expected-note {{candidate}} \
365-
// expected-note {{ambiguous candidate function with reversed arguments}}
366-
367-
struct A : public P {};
368-
struct B : public P {};
369-
bool check(A a, B b) { return a == b; } // expected-warning {{use of overloaded operator '==' (with operand types 'A' and 'B') to be ambiguous}}
370-
371-
template<class S>
372-
bool operator!=(const P&, const S &);
373-
bool fine(A a, B b) { return a == b; } // Ok. Found a matching operator!=.
374-
}
375-
}
376-
377-
378327
namespace ADL_GH68901{
379328
namespace test1 {
380329
namespace A {
@@ -477,17 +426,6 @@ bool i(X x) {
477426
} // namespace test2
478427
} // namespace function_scope_operator_eqeq
479428

480-
namespace non_member_template_2 {
481-
struct P {};
482-
template<class S>
483-
bool operator==(const S&, const P&); // expected-note {{candidate}} \
484-
// expected-note {{ambiguous candidate function with reversed arguments}}
485-
486-
struct A : public P {};
487-
struct B : public P {};
488-
bool check(A a, B b) { return a == b; } // expected-warning {{use of overloaded operator '==' (with operand types 'A' and 'B') to be ambiguous}}
489-
}
490-
491429
#else // NO_ERRORS
492430

493431
namespace problem_cases {

clang/unittests/Format/FormatTest.cpp

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26459,6 +26459,25 @@ TEST_F(FormatTest, AllowBreakBeforeNoexceptSpecifier) {
2645926459
Style);
2646026460
}
2646126461

26462+
TEST_F(FormatTest, PPBranchesInBracedInit) {
26463+
verifyFormat("A a_{kFlag1,\n"
26464+
"#if BUILD_FLAG\n"
26465+
" kFlag2,\n"
26466+
"#else\n"
26467+
" kFlag3,\n"
26468+
"#endif\n"
26469+
" kFlag4};",
26470+
"A a_{\n"
26471+
" kFlag1,\n"
26472+
"#if BUILD_FLAG\n"
26473+
" kFlag2,\n"
26474+
"#else\n"
26475+
" kFlag3,\n"
26476+
"#endif\n"
26477+
" kFlag4\n"
26478+
"};");
26479+
}
26480+
2646226481
} // namespace
2646326482
} // namespace test
2646426483
} // namespace format

0 commit comments

Comments
 (0)