Skip to content

Commit 3374b3b

Browse files
committed
[FOLD] format
1 parent 1297786 commit 3374b3b

File tree

5 files changed

+41
-50
lines changed

5 files changed

+41
-50
lines changed

clang/lib/Sema/SemaExpr.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -666,10 +666,9 @@ ExprResult Sema::DefaultLvalueConversion(Expr *E) {
666666
// expressions of certain types in C++.
667667
if (getLangOpts().CPlusPlus &&
668668
(E->getType() == Context.OverloadTy ||
669-
// FIXME: This is a hack! We want the lvalue-to-rvalue conversion applied
670-
// to pointer types even if the pointee type is dependent.
671-
(T->isDependentType() && !T->isPointerType()) ||
672-
T->isRecordType()))
669+
// FIXME: This is a hack! We want the lvalue-to-rvalue conversion applied
670+
// to pointer types even if the pointee type is dependent.
671+
(T->isDependentType() && !T->isPointerType()) || T->isRecordType()))
673672
return E;
674673

675674
// The C standard is actually really unclear on this point, and

clang/lib/Sema/SemaExprMember.cpp

Lines changed: 25 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -670,8 +670,7 @@ class RecordMemberExprValidatorCCC final : public CorrectionCandidateCallback {
670670
}
671671

672672
static bool LookupMemberExprInRecord(Sema &SemaRef, LookupResult &R,
673-
Expr *BaseExpr,
674-
QualType RTy,
673+
Expr *BaseExpr, QualType RTy,
675674
SourceLocation OpLoc, bool IsArrow,
676675
CXXScopeSpec &SS, bool HasTemplateArgs,
677676
SourceLocation TemplateKWLoc,
@@ -695,9 +694,8 @@ static bool LookupMemberExprInRecord(Sema &SemaRef, LookupResult &R,
695694
SourceRange BaseRange = BaseExpr ? BaseExpr->getSourceRange() : SourceRange();
696695
if (!RTy->isDependentType() &&
697696
!SemaRef.isThisOutsideMemberFunctionBody(RTy) &&
698-
SemaRef.RequireCompleteType(OpLoc, RTy,
699-
diag::err_typecheck_incomplete_tag,
700-
BaseRange))
697+
SemaRef.RequireCompleteType(
698+
OpLoc, RTy, diag::err_typecheck_incomplete_tag, BaseRange))
701699
return true;
702700

703701
if (HasTemplateArgs || TemplateKWLoc.isValid()) {
@@ -792,26 +790,22 @@ static ExprResult LookupMemberExpr(Sema &S, LookupResult &R,
792790
Decl *ObjCImpDecl, bool HasTemplateArgs,
793791
SourceLocation TemplateKWLoc);
794792

795-
ExprResult
796-
Sema::BuildMemberReferenceExpr(Expr *Base, QualType BaseType,
797-
SourceLocation OpLoc, bool IsArrow,
798-
CXXScopeSpec &SS,
799-
SourceLocation TemplateKWLoc,
800-
NamedDecl *FirstQualifierInScope,
801-
const DeclarationNameInfo &NameInfo,
802-
const TemplateArgumentListInfo *TemplateArgs,
803-
const Scope *S,
804-
ActOnMemberAccessExtraArgs *ExtraArgs) {
793+
ExprResult Sema::BuildMemberReferenceExpr(
794+
Expr *Base, QualType BaseType, SourceLocation OpLoc, bool IsArrow,
795+
CXXScopeSpec &SS, SourceLocation TemplateKWLoc,
796+
NamedDecl *FirstQualifierInScope, const DeclarationNameInfo &NameInfo,
797+
const TemplateArgumentListInfo *TemplateArgs, const Scope *S,
798+
ActOnMemberAccessExtraArgs *ExtraArgs) {
805799
LookupResult R(*this, NameInfo, LookupMemberName);
806800

807801
// Implicit member accesses.
808802
if (!Base) {
809803
TypoExpr *TE = nullptr;
810804
QualType RecordTy = BaseType;
811805
if (IsArrow) RecordTy = RecordTy->castAs<PointerType>()->getPointeeType();
812-
if (LookupMemberExprInRecord(
813-
*this, R, nullptr, RecordTy, OpLoc, IsArrow,
814-
SS, TemplateArgs != nullptr, TemplateKWLoc, TE))
806+
if (LookupMemberExprInRecord(*this, R, nullptr, RecordTy, OpLoc, IsArrow,
807+
SS, TemplateArgs != nullptr, TemplateKWLoc,
808+
TE))
815809
return ExprError();
816810
if (TE)
817811
return TE;
@@ -1006,9 +1000,8 @@ Sema::BuildMemberReferenceExpr(Expr *BaseExpr, QualType BaseExprType,
10061000

10071001
if (R.wasNotFoundInCurrentInstantiation() ||
10081002
(SS.isValid() && !computeDeclContext(SS, false))) {
1009-
return ActOnDependentMemberExpr(BaseExpr, BaseExprType,
1010-
IsArrow, OpLoc,
1011-
SS, TemplateKWLoc, FirstQualifierInScope,
1003+
return ActOnDependentMemberExpr(BaseExpr, BaseExprType, IsArrow, OpLoc, SS,
1004+
TemplateKWLoc, FirstQualifierInScope,
10121005
R.getLookupNameInfo(), TemplateArgs);
10131006
}
10141007

@@ -1048,9 +1041,8 @@ Sema::BuildMemberReferenceExpr(Expr *BaseExpr, QualType BaseExprType,
10481041

10491042
if (R.empty()) {
10501043
// Rederive where we looked up.
1051-
DeclContext *DC = (SS.isSet()
1052-
? computeDeclContext(SS, false)
1053-
: BaseType->getAsRecordDecl());
1044+
DeclContext *DC = (SS.isSet() ? computeDeclContext(SS, false)
1045+
: BaseType->getAsRecordDecl());
10541046

10551047
if (ExtraArgs) {
10561048
ExprResult RetryExpr;
@@ -1077,7 +1069,7 @@ Sema::BuildMemberReferenceExpr(Expr *BaseExpr, QualType BaseExprType,
10771069
}
10781070
}
10791071

1080-
if(DC) {
1072+
if (DC) {
10811073
Diag(R.getNameLoc(), diag::err_no_member)
10821074
<< MemberName << DC
10831075
<< (BaseExpr ? BaseExpr->getSourceRange() : SourceRange());
@@ -1317,9 +1309,9 @@ static ExprResult LookupMemberExpr(Sema &S, LookupResult &R,
13171309

13181310
QualType BaseType = BaseExpr.get()->getType();
13191311

1320-
#if 0
1312+
#if 0
13211313
assert(!BaseType->isDependentType());
1322-
#endif
1314+
#endif
13231315

13241316
DeclarationName MemberName = R.getLookupName();
13251317
SourceLocation MemberLoc = R.getNameLoc();
@@ -1332,12 +1324,12 @@ static ExprResult LookupMemberExpr(Sema &S, LookupResult &R,
13321324
if (const PointerType *Ptr = BaseType->getAs<PointerType>())
13331325
BaseType = Ptr->getPointeeType();
13341326
else if (!BaseType->isDependentType()) {
1335-
if (const ObjCObjectPointerType *Ptr
1336-
= BaseType->getAs<ObjCObjectPointerType>())
1337-
BaseType = Ptr->getPointeeType();
1327+
if (const ObjCObjectPointerType *Ptr =
1328+
BaseType->getAs<ObjCObjectPointerType>())
1329+
BaseType = Ptr->getPointeeType();
13381330
else if (BaseType->isRecordType()) {
13391331
// Recover from arrow accesses to records, e.g.:
1340-
// struct MyRecord foo;
1332+
// struct MyRecord foo;
13411333
// foo->bar
13421334
// This is actually well-formed in C++ if MyRecord has an
13431335
// overloaded operator->, but that should have been dealt with
@@ -1356,7 +1348,6 @@ static ExprResult LookupMemberExpr(Sema &S, LookupResult &R,
13561348
<< BaseType << BaseExpr.get()->getSourceRange();
13571349
return ExprError();
13581350
}
1359-
13601351
}
13611352
}
13621353

@@ -1378,8 +1369,8 @@ static ExprResult LookupMemberExpr(Sema &S, LookupResult &R,
13781369
// Handle field access to simple records.
13791370
if (BaseType->getAsRecordDecl() || BaseType->isDependentType()) {
13801371
TypoExpr *TE = nullptr;
1381-
if (LookupMemberExprInRecord(S, R, BaseExpr.get(), BaseType, OpLoc, IsArrow, SS,
1382-
HasTemplateArgs, TemplateKWLoc, TE))
1372+
if (LookupMemberExprInRecord(S, R, BaseExpr.get(), BaseType, OpLoc, IsArrow,
1373+
SS, HasTemplateArgs, TemplateKWLoc, TE))
13831374
return ExprError();
13841375

13851376
// Returning valid-but-null is how we indicate to the caller that

clang/lib/Sema/SemaOverload.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5789,10 +5789,10 @@ static ImplicitConversionSequence TryObjectArgumentInitialization(
57895789
return ICS;
57905790
}
57915791

5792-
// FIXME: Should this check getAsRecordDecl instead?
5793-
#if 0
5792+
// FIXME: Should this check getAsRecordDecl instead?
5793+
#if 0
57945794
assert(FromType->isRecordType());
5795-
#endif
5795+
#endif
57965796

57975797
QualType ClassType = S.Context.getTypeDeclType(ActingContext);
57985798
// C++98 [class.dtor]p2:

clang/lib/Sema/TreeTransform.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12939,14 +12939,14 @@ bool TreeTransform<Derived>::TransformOverloadExprDecls(OverloadExpr *Old,
1293912939
if (R.empty()) {
1294012940
// If a 'template' keyword was used, a lookup that finds only non-template
1294112941
// names is an error.
12942-
getSema().Diag(R.getNameLoc(), diag::err_template_kw_refers_to_non_template)
12943-
<< R.getLookupName()
12944-
<< Old->getQualifierLoc().getSourceRange()
12945-
<< Old->hasTemplateKeyword()
12946-
<< Old->getTemplateKeywordLoc();
12947-
getSema().Diag(FoundDecl->getLocation(), diag::note_template_kw_refers_to_non_template)
12942+
getSema().Diag(R.getNameLoc(),
12943+
diag::err_template_kw_refers_to_non_template)
12944+
<< R.getLookupName() << Old->getQualifierLoc().getSourceRange()
12945+
<< Old->hasTemplateKeyword() << Old->getTemplateKeywordLoc();
12946+
getSema().Diag(FoundDecl->getLocation(),
12947+
diag::note_template_kw_refers_to_non_template)
1294812948
<< R.getLookupName();
12949-
return true;
12949+
return true;
1295012950
}
1295112951
}
1295212952

clang/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1569,8 +1569,9 @@ TEST_P(ASTMatchersTest, IsArrow_MatchesMemberVariablesViaArrow) {
15691569
matches("class Y { void x() { y; } int y; };", memberExpr(isArrow())));
15701570
EXPECT_TRUE(notMatches("class Y { void x() { (*this).y; } int y; };",
15711571
memberExpr(isArrow())));
1572-
EXPECT_TRUE(matches("template <class T> class Y { void x() { this->m; } int m; };",
1573-
memberExpr(isArrow())));
1572+
EXPECT_TRUE(
1573+
matches("template <class T> class Y { void x() { this->m; } int m; };",
1574+
memberExpr(isArrow())));
15741575
EXPECT_TRUE(
15751576
notMatches("template <class T> class Y { void x() { (*this).m; } };",
15761577
cxxDependentScopeMemberExpr(isArrow())));

0 commit comments

Comments
 (0)