Skip to content

Commit 6fb83d8

Browse files
SC llvm teamSC llvm team
SC llvm team
authored and
SC llvm team
committed
Merged main:2cd2445c21bc into amd-gfx:80abf82a4fc4
Local branch amd-gfx 80abf82 Merged main:b4afade17564 into amd-gfx:259556a2c143 Remote branch main 2cd2445 [AMDGPU] Src1 of VOP3 DPP instructions can be SGPR on supported subtargets (llvm#67461)
2 parents 80abf82 + 2cd2445 commit 6fb83d8

File tree

81 files changed

+1500
-1005
lines changed

Some content is hidden

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

81 files changed

+1500
-1005
lines changed

clang/lib/Analysis/ThreadSafety.cpp

Lines changed: 70 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1055,6 +1055,19 @@ class ThreadSafetyAnalyzer {
10551055
}
10561056

10571057
void runAnalysis(AnalysisDeclContext &AC);
1058+
1059+
void warnIfMutexNotHeld(const FactSet &FSet, const NamedDecl *D,
1060+
const Expr *Exp, AccessKind AK, Expr *MutexExp,
1061+
ProtectedOperationKind POK, til::LiteralPtr *Self,
1062+
SourceLocation Loc);
1063+
void warnIfMutexHeld(const FactSet &FSet, const NamedDecl *D, const Expr *Exp,
1064+
Expr *MutexExp, til::LiteralPtr *Self,
1065+
SourceLocation Loc);
1066+
1067+
void checkAccess(const FactSet &FSet, const Expr *Exp, AccessKind AK,
1068+
ProtectedOperationKind POK);
1069+
void checkPtAccess(const FactSet &FSet, const Expr *Exp, AccessKind AK,
1070+
ProtectedOperationKind POK);
10581071
};
10591072

10601073
} // namespace
@@ -1534,16 +1547,15 @@ class BuildLockset : public ConstStmtVisitor<BuildLockset> {
15341547
unsigned CtxIndex;
15351548

15361549
// helper functions
1537-
void warnIfMutexNotHeld(const NamedDecl *D, const Expr *Exp, AccessKind AK,
1538-
Expr *MutexExp, ProtectedOperationKind POK,
1539-
til::LiteralPtr *Self, SourceLocation Loc);
1540-
void warnIfMutexHeld(const NamedDecl *D, const Expr *Exp, Expr *MutexExp,
1541-
til::LiteralPtr *Self, SourceLocation Loc);
15421550

15431551
void checkAccess(const Expr *Exp, AccessKind AK,
1544-
ProtectedOperationKind POK = POK_VarAccess);
1552+
ProtectedOperationKind POK = POK_VarAccess) {
1553+
Analyzer->checkAccess(FSet, Exp, AK, POK);
1554+
}
15451555
void checkPtAccess(const Expr *Exp, AccessKind AK,
1546-
ProtectedOperationKind POK = POK_VarAccess);
1556+
ProtectedOperationKind POK = POK_VarAccess) {
1557+
Analyzer->checkPtAccess(FSet, Exp, AK, POK);
1558+
}
15471559

15481560
void handleCall(const Expr *Exp, const NamedDecl *D,
15491561
til::LiteralPtr *Self = nullptr,
@@ -1571,86 +1583,82 @@ class BuildLockset : public ConstStmtVisitor<BuildLockset> {
15711583

15721584
/// Warn if the LSet does not contain a lock sufficient to protect access
15731585
/// of at least the passed in AccessKind.
1574-
void BuildLockset::warnIfMutexNotHeld(const NamedDecl *D, const Expr *Exp,
1575-
AccessKind AK, Expr *MutexExp,
1576-
ProtectedOperationKind POK,
1577-
til::LiteralPtr *Self,
1578-
SourceLocation Loc) {
1586+
void ThreadSafetyAnalyzer::warnIfMutexNotHeld(
1587+
const FactSet &FSet, const NamedDecl *D, const Expr *Exp, AccessKind AK,
1588+
Expr *MutexExp, ProtectedOperationKind POK, til::LiteralPtr *Self,
1589+
SourceLocation Loc) {
15791590
LockKind LK = getLockKindFromAccessKind(AK);
1580-
1581-
CapabilityExpr Cp =
1582-
Analyzer->SxBuilder.translateAttrExpr(MutexExp, D, Exp, Self);
1591+
CapabilityExpr Cp = SxBuilder.translateAttrExpr(MutexExp, D, Exp, Self);
15831592
if (Cp.isInvalid()) {
1584-
warnInvalidLock(Analyzer->Handler, MutexExp, D, Exp, Cp.getKind());
1593+
warnInvalidLock(Handler, MutexExp, D, Exp, Cp.getKind());
15851594
return;
15861595
} else if (Cp.shouldIgnore()) {
15871596
return;
15881597
}
15891598

15901599
if (Cp.negative()) {
15911600
// Negative capabilities act like locks excluded
1592-
const FactEntry *LDat = FSet.findLock(Analyzer->FactMan, !Cp);
1601+
const FactEntry *LDat = FSet.findLock(FactMan, !Cp);
15931602
if (LDat) {
1594-
Analyzer->Handler.handleFunExcludesLock(
1595-
Cp.getKind(), D->getNameAsString(), (!Cp).toString(), Loc);
1603+
Handler.handleFunExcludesLock(Cp.getKind(), D->getNameAsString(),
1604+
(!Cp).toString(), Loc);
15961605
return;
15971606
}
15981607

15991608
// If this does not refer to a negative capability in the same class,
16001609
// then stop here.
1601-
if (!Analyzer->inCurrentScope(Cp))
1610+
if (!inCurrentScope(Cp))
16021611
return;
16031612

16041613
// Otherwise the negative requirement must be propagated to the caller.
1605-
LDat = FSet.findLock(Analyzer->FactMan, Cp);
1614+
LDat = FSet.findLock(FactMan, Cp);
16061615
if (!LDat) {
1607-
Analyzer->Handler.handleNegativeNotHeld(D, Cp.toString(), Loc);
1616+
Handler.handleNegativeNotHeld(D, Cp.toString(), Loc);
16081617
}
16091618
return;
16101619
}
16111620

1612-
const FactEntry *LDat = FSet.findLockUniv(Analyzer->FactMan, Cp);
1621+
const FactEntry *LDat = FSet.findLockUniv(FactMan, Cp);
16131622
bool NoError = true;
16141623
if (!LDat) {
16151624
// No exact match found. Look for a partial match.
1616-
LDat = FSet.findPartialMatch(Analyzer->FactMan, Cp);
1625+
LDat = FSet.findPartialMatch(FactMan, Cp);
16171626
if (LDat) {
16181627
// Warn that there's no precise match.
16191628
std::string PartMatchStr = LDat->toString();
16201629
StringRef PartMatchName(PartMatchStr);
1621-
Analyzer->Handler.handleMutexNotHeld(Cp.getKind(), D, POK, Cp.toString(),
1622-
LK, Loc, &PartMatchName);
1630+
Handler.handleMutexNotHeld(Cp.getKind(), D, POK, Cp.toString(), LK, Loc,
1631+
&PartMatchName);
16231632
} else {
16241633
// Warn that there's no match at all.
1625-
Analyzer->Handler.handleMutexNotHeld(Cp.getKind(), D, POK, Cp.toString(),
1626-
LK, Loc);
1634+
Handler.handleMutexNotHeld(Cp.getKind(), D, POK, Cp.toString(), LK, Loc);
16271635
}
16281636
NoError = false;
16291637
}
16301638
// Make sure the mutex we found is the right kind.
16311639
if (NoError && LDat && !LDat->isAtLeast(LK)) {
1632-
Analyzer->Handler.handleMutexNotHeld(Cp.getKind(), D, POK, Cp.toString(),
1633-
LK, Loc);
1640+
Handler.handleMutexNotHeld(Cp.getKind(), D, POK, Cp.toString(), LK, Loc);
16341641
}
16351642
}
16361643

16371644
/// Warn if the LSet contains the given lock.
1638-
void BuildLockset::warnIfMutexHeld(const NamedDecl *D, const Expr *Exp,
1639-
Expr *MutexExp, til::LiteralPtr *Self,
1640-
SourceLocation Loc) {
1641-
CapabilityExpr Cp =
1642-
Analyzer->SxBuilder.translateAttrExpr(MutexExp, D, Exp, Self);
1645+
void ThreadSafetyAnalyzer::warnIfMutexHeld(const FactSet &FSet,
1646+
const NamedDecl *D, const Expr *Exp,
1647+
Expr *MutexExp,
1648+
til::LiteralPtr *Self,
1649+
SourceLocation Loc) {
1650+
CapabilityExpr Cp = SxBuilder.translateAttrExpr(MutexExp, D, Exp, Self);
16431651
if (Cp.isInvalid()) {
1644-
warnInvalidLock(Analyzer->Handler, MutexExp, D, Exp, Cp.getKind());
1652+
warnInvalidLock(Handler, MutexExp, D, Exp, Cp.getKind());
16451653
return;
16461654
} else if (Cp.shouldIgnore()) {
16471655
return;
16481656
}
16491657

1650-
const FactEntry *LDat = FSet.findLock(Analyzer->FactMan, Cp);
1658+
const FactEntry *LDat = FSet.findLock(FactMan, Cp);
16511659
if (LDat) {
1652-
Analyzer->Handler.handleFunExcludesLock(Cp.getKind(), D->getNameAsString(),
1653-
Cp.toString(), Loc);
1660+
Handler.handleFunExcludesLock(Cp.getKind(), D->getNameAsString(),
1661+
Cp.toString(), Loc);
16541662
}
16551663
}
16561664

@@ -1659,8 +1667,9 @@ void BuildLockset::warnIfMutexHeld(const NamedDecl *D, const Expr *Exp,
16591667
/// marked with guarded_by, we must ensure the appropriate mutexes are held.
16601668
/// Similarly, we check if the access is to an expression that dereferences
16611669
/// a pointer marked with pt_guarded_by.
1662-
void BuildLockset::checkAccess(const Expr *Exp, AccessKind AK,
1663-
ProtectedOperationKind POK) {
1670+
void ThreadSafetyAnalyzer::checkAccess(const FactSet &FSet, const Expr *Exp,
1671+
AccessKind AK,
1672+
ProtectedOperationKind POK) {
16641673
Exp = Exp->IgnoreImplicit()->IgnoreParenCasts();
16651674

16661675
SourceLocation Loc = Exp->getExprLoc();
@@ -1684,49 +1693,50 @@ void BuildLockset::checkAccess(const Expr *Exp, AccessKind AK,
16841693
if (const auto *UO = dyn_cast<UnaryOperator>(Exp)) {
16851694
// For dereferences
16861695
if (UO->getOpcode() == UO_Deref)
1687-
checkPtAccess(UO->getSubExpr(), AK, POK);
1696+
checkPtAccess(FSet, UO->getSubExpr(), AK, POK);
16881697
return;
16891698
}
16901699

16911700
if (const auto *BO = dyn_cast<BinaryOperator>(Exp)) {
16921701
switch (BO->getOpcode()) {
16931702
case BO_PtrMemD: // .*
1694-
return checkAccess(BO->getLHS(), AK, POK);
1703+
return checkAccess(FSet, BO->getLHS(), AK, POK);
16951704
case BO_PtrMemI: // ->*
1696-
return checkPtAccess(BO->getLHS(), AK, POK);
1705+
return checkPtAccess(FSet, BO->getLHS(), AK, POK);
16971706
default:
16981707
return;
16991708
}
17001709
}
17011710

17021711
if (const auto *AE = dyn_cast<ArraySubscriptExpr>(Exp)) {
1703-
checkPtAccess(AE->getLHS(), AK, POK);
1712+
checkPtAccess(FSet, AE->getLHS(), AK, POK);
17041713
return;
17051714
}
17061715

17071716
if (const auto *ME = dyn_cast<MemberExpr>(Exp)) {
17081717
if (ME->isArrow())
1709-
checkPtAccess(ME->getBase(), AK, POK);
1718+
checkPtAccess(FSet, ME->getBase(), AK, POK);
17101719
else
1711-
checkAccess(ME->getBase(), AK, POK);
1720+
checkAccess(FSet, ME->getBase(), AK, POK);
17121721
}
17131722

17141723
const ValueDecl *D = getValueDecl(Exp);
17151724
if (!D || !D->hasAttrs())
17161725
return;
17171726

1718-
if (D->hasAttr<GuardedVarAttr>() && FSet.isEmpty(Analyzer->FactMan)) {
1719-
Analyzer->Handler.handleNoMutexHeld(D, POK, AK, Loc);
1727+
if (D->hasAttr<GuardedVarAttr>() && FSet.isEmpty(FactMan)) {
1728+
Handler.handleNoMutexHeld(D, POK, AK, Loc);
17201729
}
17211730

17221731
for (const auto *I : D->specific_attrs<GuardedByAttr>())
1723-
warnIfMutexNotHeld(D, Exp, AK, I->getArg(), POK, nullptr, Loc);
1732+
warnIfMutexNotHeld(FSet, D, Exp, AK, I->getArg(), POK, nullptr, Loc);
17241733
}
17251734

17261735
/// Checks pt_guarded_by and pt_guarded_var attributes.
17271736
/// POK is the same operationKind that was passed to checkAccess.
1728-
void BuildLockset::checkPtAccess(const Expr *Exp, AccessKind AK,
1729-
ProtectedOperationKind POK) {
1737+
void ThreadSafetyAnalyzer::checkPtAccess(const FactSet &FSet, const Expr *Exp,
1738+
AccessKind AK,
1739+
ProtectedOperationKind POK) {
17301740
while (true) {
17311741
if (const auto *PE = dyn_cast<ParenExpr>(Exp)) {
17321742
Exp = PE->getSubExpr();
@@ -1736,7 +1746,7 @@ void BuildLockset::checkPtAccess(const Expr *Exp, AccessKind AK,
17361746
if (CE->getCastKind() == CK_ArrayToPointerDecay) {
17371747
// If it's an actual array, and not a pointer, then it's elements
17381748
// are protected by GUARDED_BY, not PT_GUARDED_BY;
1739-
checkAccess(CE->getSubExpr(), AK, POK);
1749+
checkAccess(FSet, CE->getSubExpr(), AK, POK);
17401750
return;
17411751
}
17421752
Exp = CE->getSubExpr();
@@ -1753,11 +1763,11 @@ void BuildLockset::checkPtAccess(const Expr *Exp, AccessKind AK,
17531763
if (!D || !D->hasAttrs())
17541764
return;
17551765

1756-
if (D->hasAttr<PtGuardedVarAttr>() && FSet.isEmpty(Analyzer->FactMan))
1757-
Analyzer->Handler.handleNoMutexHeld(D, PtPOK, AK, Exp->getExprLoc());
1766+
if (D->hasAttr<PtGuardedVarAttr>() && FSet.isEmpty(FactMan))
1767+
Handler.handleNoMutexHeld(D, PtPOK, AK, Exp->getExprLoc());
17581768

17591769
for (auto const *I : D->specific_attrs<PtGuardedByAttr>())
1760-
warnIfMutexNotHeld(D, Exp, AK, I->getArg(), PtPOK, nullptr,
1770+
warnIfMutexNotHeld(FSet, D, Exp, AK, I->getArg(), PtPOK, nullptr,
17611771
Exp->getExprLoc());
17621772
}
17631773

@@ -1869,8 +1879,9 @@ void BuildLockset::handleCall(const Expr *Exp, const NamedDecl *D,
18691879
case attr::RequiresCapability: {
18701880
const auto *A = cast<RequiresCapabilityAttr>(At);
18711881
for (auto *Arg : A->args()) {
1872-
warnIfMutexNotHeld(D, Exp, A->isShared() ? AK_Read : AK_Written, Arg,
1873-
POK_FunctionCall, Self, Loc);
1882+
Analyzer->warnIfMutexNotHeld(FSet, D, Exp,
1883+
A->isShared() ? AK_Read : AK_Written,
1884+
Arg, POK_FunctionCall, Self, Loc);
18741885
// use for adopting a lock
18751886
if (!Scp.shouldIgnore())
18761887
Analyzer->getMutexIDs(ScopedReqsAndExcludes, A, Exp, D, Self);
@@ -1881,7 +1892,7 @@ void BuildLockset::handleCall(const Expr *Exp, const NamedDecl *D,
18811892
case attr::LocksExcluded: {
18821893
const auto *A = cast<LocksExcludedAttr>(At);
18831894
for (auto *Arg : A->args()) {
1884-
warnIfMutexHeld(D, Exp, Arg, Self, Loc);
1895+
Analyzer->warnIfMutexHeld(FSet, D, Exp, Arg, Self, Loc);
18851896
// use for deferring a lock
18861897
if (!Scp.shouldIgnore())
18871898
Analyzer->getMutexIDs(ScopedReqsAndExcludes, A, Exp, D, Self);

clang/lib/Driver/ToolChains/CommonArgs.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -902,11 +902,8 @@ void tools::addOpenMPRuntimeLibraryPath(const ToolChain &TC,
902902

903903
void tools::addArchSpecificRPath(const ToolChain &TC, const ArgList &Args,
904904
ArgStringList &CmdArgs) {
905-
// Enable -frtlib-add-rpath by default for the case of VE.
906-
const bool IsVE = TC.getTriple().isVE();
907-
bool DefaultValue = IsVE;
908905
if (!Args.hasFlag(options::OPT_frtlib_add_rpath,
909-
options::OPT_fno_rtlib_add_rpath, DefaultValue))
906+
options::OPT_fno_rtlib_add_rpath, false))
910907
return;
911908

912909
for (const auto &CandidateRPath : TC.getArchSpecificLibPaths()) {

clang/lib/Driver/ToolChains/VEToolchain.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ VEToolChain::VEToolChain(const Driver &D, const llvm::Triple &Triple,
3333
// These are OK.
3434

3535
// Default file paths are following:
36+
// ${RESOURCEDIR}/lib/ve-unknown-linux-gnu, (== getArchSpecificLibPaths)
3637
// ${RESOURCEDIR}/lib/linux/ve, (== getArchSpecificLibPaths)
3738
// /lib/../lib64,
3839
// /usr/lib/../lib64,
@@ -46,6 +47,7 @@ VEToolChain::VEToolChain(const Driver &D, const llvm::Triple &Triple,
4647

4748
// Add library directories:
4849
// ${BINPATH}/../lib/ve-unknown-linux-gnu, (== getStdlibPath)
50+
// ${RESOURCEDIR}/lib/ve-unknown-linux-gnu, (== getArchSpecificLibPaths)
4951
// ${RESOURCEDIR}/lib/linux/ve, (== getArchSpecificLibPaths)
5052
// ${SYSROOT}/opt/nec/ve/lib,
5153
if (std::optional<std::string> Path = getStdlibPath())
@@ -141,6 +143,12 @@ void VEToolChain::AddCXXStdlibLibArgs(const ArgList &Args,
141143

142144
tools::addArchSpecificRPath(*this, Args, CmdArgs);
143145

146+
// Add paths for libc++.so and other shared libraries.
147+
if (std::optional<std::string> Path = getStdlibPath()) {
148+
CmdArgs.push_back("-rpath");
149+
CmdArgs.push_back(Args.MakeArgString(*Path));
150+
}
151+
144152
CmdArgs.push_back("-lc++");
145153
if (Args.hasArg(options::OPT_fexperimental_library))
146154
CmdArgs.push_back("-lc++experimental");

clang/lib/Format/WhitespaceManager.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -974,7 +974,11 @@ void WhitespaceManager::alignConsecutiveDeclarations() {
974974
AlignTokens(
975975
Style,
976976
[](Change const &C) {
977-
if (C.Tok->isOneOf(TT_FunctionDeclarationName, TT_FunctionTypeLParen))
977+
if (C.Tok->is(TT_FunctionDeclarationName) && C.Tok->Previous &&
978+
C.Tok->Previous->isNot(tok::tilde)) {
979+
return true;
980+
}
981+
if (C.Tok->is(TT_FunctionTypeLParen))
978982
return true;
979983
if (C.Tok->isNot(TT_StartOfName))
980984
return false;

clang/test/Driver/Inputs/basic_ve_tree/resource_dir/lib/ve-unknown-linux-gnu/libclang_rt.builtins.a

Whitespace-only changes.

clang/test/Driver/ve-toolchain.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,8 @@
9797
// DEF-SAME: "[[SYSROOT]]/opt/nec/ve/lib/crt1.o"
9898
// DEF-SAME: "[[SYSROOT]]/opt/nec/ve/lib/crti.o"
9999
// DEF-SAME: "-z" "max-page-size=0x4000000"
100-
// DEF-SAME: "[[RESOURCE_DIR]]/lib/linux/clang_rt.crtbegin-ve.o"
101-
// DEF-SAME: "[[RESOURCE_DIR]]/lib/linux/libclang_rt.builtins-ve.a" "-lc"
102-
// DEF-SAME: "[[RESOURCE_DIR]]/lib/linux/libclang_rt.builtins-ve.a"
103-
// DEF-SAME: "[[RESOURCE_DIR]]/lib/linux/clang_rt.crtend-ve.o"
100+
// DEF-SAME: "[[RESOURCE_DIR]]/lib/ve-unknown-linux-gnu/clang_rt.crtbegin.o"
101+
// DEF-SAME: "[[RESOURCE_DIR]]/lib/ve-unknown-linux-gnu/libclang_rt.builtins.a" "-lc"
102+
// DEF-SAME: "[[RESOURCE_DIR]]/lib/ve-unknown-linux-gnu/libclang_rt.builtins.a"
103+
// DEF-SAME: "[[RESOURCE_DIR]]/lib/ve-unknown-linux-gnu/clang_rt.crtend.o"
104104
// DEF-SAME: "[[SYSROOT]]/opt/nec/ve/lib/crtn.o"

clang/test/Driver/ve-toolchain.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@
2525
// DEFINC-SAME: "-internal-isystem" "{{.*}}/bin/../include/c++/v1"
2626
// DEFINC-SAME: "-internal-isystem" "[[RESOURCE_DIR]]/include"
2727
// DEFINC-SAME: "-internal-isystem" "[[SYSROOT]]/opt/nec/ve/include"
28+
// DEFINC: nld"
29+
// DEFINC-SAME: "-rpath" "[[SYSROOT]]/bin/../lib/ve-unknown-linux-gnu"
2830

2931
// RUN: %clangxx -### --target=ve-unknown-linux-gnu \
3032
// RUN: --sysroot %S/Inputs/basic_ve_tree %s \
@@ -146,9 +148,9 @@
146148
// DEF-SAME: "[[SYSROOT]]/opt/nec/ve/lib/crt1.o"
147149
// DEF-SAME: "[[SYSROOT]]/opt/nec/ve/lib/crti.o"
148150
// DEF-SAME: "-z" "max-page-size=0x4000000"
149-
// DEF-SAME: "[[RESOURCE_DIR]]/lib/linux/clang_rt.crtbegin-ve.o"
151+
// DEF-SAME: "[[RESOURCE_DIR]]/lib/ve-unknown-linux-gnu/clang_rt.crtbegin.o"
150152
// DEF-SAME: "-lc++" "-lc++abi" "-lunwind" "-lpthread" "-ldl"
151-
// DEF-SAME: "[[RESOURCE_DIR]]/lib/linux/libclang_rt.builtins-ve.a" "-lc"
152-
// DEF-SAME: "[[RESOURCE_DIR]]/lib/linux/libclang_rt.builtins-ve.a"
153-
// DEF-SAME: "[[RESOURCE_DIR]]/lib/linux/clang_rt.crtend-ve.o"
153+
// DEF-SAME: "[[RESOURCE_DIR]]/lib/ve-unknown-linux-gnu/libclang_rt.builtins.a" "-lc"
154+
// DEF-SAME: "[[RESOURCE_DIR]]/lib/ve-unknown-linux-gnu/libclang_rt.builtins.a"
155+
// DEF-SAME: "[[RESOURCE_DIR]]/lib/ve-unknown-linux-gnu/clang_rt.crtend.o"
154156
// DEF-SAME: "[[SYSROOT]]/opt/nec/ve/lib/crtn.o"

clang/unittests/Format/FormatTest.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18677,6 +18677,12 @@ TEST_F(FormatTest, AlignConsecutiveDeclarations) {
1867718677
verifyFormat("int a(int x);\n"
1867818678
"double b();",
1867918679
Alignment);
18680+
verifyFormat("struct Test {\n"
18681+
" Test(const Test &) = default;\n"
18682+
" ~Test() = default;\n"
18683+
" Test &operator=(const Test &) = default;\n"
18684+
"};",
18685+
Alignment);
1868018686
unsigned OldColumnLimit = Alignment.ColumnLimit;
1868118687
// We need to set ColumnLimit to zero, in order to stress nested alignments,
1868218688
// otherwise the function parameters will be re-flowed onto a single line.
@@ -18713,6 +18719,12 @@ TEST_F(FormatTest, AlignConsecutiveDeclarations) {
1871318719
"double b();",
1871418720
Alignment);
1871518721
Alignment.AlignConsecutiveAssignments.Enabled = true;
18722+
verifyFormat("struct Test {\n"
18723+
" Test(const Test &) = default;\n"
18724+
" ~Test() = default;\n"
18725+
" Test &operator=(const Test &) = default;\n"
18726+
"};",
18727+
Alignment);
1871618728
// Ensure recursive alignment is broken by function braces, so that the
1871718729
// "a = 1" does not align with subsequent assignments inside the function
1871818730
// body.

0 commit comments

Comments
 (0)