Fix a few line endings. NFC.

llvm-svn: 236301
This commit is contained in:
Yunzhong Gao 2015-05-01 02:04:32 +00:00
parent a7e2cc684f
commit eba323ab44
5 changed files with 104 additions and 104 deletions

View File

@ -3818,16 +3818,16 @@ Stmt *RewriteObjC::SynthesizeBlockCall(CallExpr *Exp, const Expr *BlockExp) {
FieldDecl *FD = FieldDecl::Create(*Context, nullptr, SourceLocation(),
SourceLocation(),
&Context->Idents.get("FuncPtr"),
Context->VoidPtrTy, nullptr,
/*BitWidth=*/nullptr, /*Mutable=*/true,
ICIS_NoInit);
MemberExpr *ME =
new (Context) MemberExpr(PE, true, SourceLocation(), FD, SourceLocation(),
FD->getType(), VK_LValue, OK_Ordinary);
CastExpr *FunkCast = NoTypeInfoCStyleCastExpr(Context, PtrToFuncCastType,
CK_BitCast, ME);
PE = new (Context) ParenExpr(SourceLocation(), SourceLocation(), FunkCast);
Context->VoidPtrTy, nullptr,
/*BitWidth=*/nullptr, /*Mutable=*/true,
ICIS_NoInit);
MemberExpr *ME =
new (Context) MemberExpr(PE, true, SourceLocation(), FD, SourceLocation(),
FD->getType(), VK_LValue, OK_Ordinary);
CastExpr *FunkCast = NoTypeInfoCStyleCastExpr(Context, PtrToFuncCastType,
CK_BitCast, ME);
PE = new (Context) ParenExpr(SourceLocation(), SourceLocation(), FunkCast);
SmallVector<Expr*, 8> BlkExprs;
// Add the implicit argument.
@ -3866,26 +3866,26 @@ Stmt *RewriteObjC::RewriteBlockDeclRefExpr(DeclRefExpr *DeclRefExp) {
FieldDecl *FD = FieldDecl::Create(*Context, nullptr, SourceLocation(),
SourceLocation(),
&Context->Idents.get("__forwarding"),
Context->VoidPtrTy, nullptr,
/*BitWidth=*/nullptr, /*Mutable=*/true,
ICIS_NoInit);
MemberExpr *ME = new (Context)
MemberExpr(DeclRefExp, isArrow, SourceLocation(), FD, SourceLocation(),
FD->getType(), VK_LValue, OK_Ordinary);
StringRef Name = VD->getName();
FD = FieldDecl::Create(*Context, nullptr, SourceLocation(), SourceLocation(),
Context->VoidPtrTy, nullptr,
/*BitWidth=*/nullptr, /*Mutable=*/true,
ICIS_NoInit);
MemberExpr *ME = new (Context)
MemberExpr(DeclRefExp, isArrow, SourceLocation(), FD, SourceLocation(),
FD->getType(), VK_LValue, OK_Ordinary);
StringRef Name = VD->getName();
FD = FieldDecl::Create(*Context, nullptr, SourceLocation(), SourceLocation(),
&Context->Idents.get(Name),
Context->VoidPtrTy, nullptr,
/*BitWidth=*/nullptr, /*Mutable=*/true,
ICIS_NoInit);
ME =
new (Context) MemberExpr(ME, true, SourceLocation(), FD, SourceLocation(),
DeclRefExp->getType(), VK_LValue, OK_Ordinary);
// Need parens to enforce precedence.
ParenExpr *PE = new (Context) ParenExpr(DeclRefExp->getExprLoc(),
DeclRefExp->getExprLoc(),
Context->VoidPtrTy, nullptr,
/*BitWidth=*/nullptr, /*Mutable=*/true,
ICIS_NoInit);
ME =
new (Context) MemberExpr(ME, true, SourceLocation(), FD, SourceLocation(),
DeclRefExp->getType(), VK_LValue, OK_Ordinary);
// Need parens to enforce precedence.
ParenExpr *PE = new (Context) ParenExpr(DeclRefExp->getExprLoc(),
DeclRefExp->getExprLoc(),
ME);
ReplaceStmt(DeclRefExp, PE);
return PE;
@ -5874,15 +5874,15 @@ Stmt *RewriteObjCFragileABI::RewriteObjCIvarRefExpr(ObjCIvarRefExpr *IV) {
// Don't forget the parens to enforce the proper binding.
ParenExpr *PE = new (Context) ParenExpr(OldRange.getBegin(),
OldRange.getEnd(),
castExpr);
if (IV->isFreeIvar() &&
declaresSameEntity(CurMethodDef->getClassInterface(), iFaceDecl->getDecl())) {
MemberExpr *ME = new (Context)
MemberExpr(PE, true, SourceLocation(), D, IV->getLocation(),
D->getType(), VK_LValue, OK_Ordinary);
Replacement = ME;
} else {
IV->setBase(PE);
castExpr);
if (IV->isFreeIvar() &&
declaresSameEntity(CurMethodDef->getClassInterface(), iFaceDecl->getDecl())) {
MemberExpr *ME = new (Context)
MemberExpr(PE, true, SourceLocation(), D, IV->getLocation(),
D->getType(), VK_LValue, OK_Ordinary);
Replacement = ME;
} else {
IV->setBase(PE);
}
}
} else { // we are outside a method.

View File

@ -12488,17 +12488,17 @@ Expr *Sema::FixOverloadedFunctionReference(Expr *E, DeclAccessPair Found,
type = Fn->getType();
} else {
valueKind = VK_RValue;
type = Context.BoundMemberTy;
}
MemberExpr *ME = MemberExpr::Create(
Context, Base, MemExpr->isArrow(), MemExpr->getOperatorLoc(),
MemExpr->getQualifierLoc(), MemExpr->getTemplateKeywordLoc(), Fn, Found,
MemExpr->getMemberNameInfo(), TemplateArgs, type, valueKind,
OK_Ordinary);
ME->setHadMultipleCandidates(true);
MarkMemberReferenced(ME);
return ME;
type = Context.BoundMemberTy;
}
MemberExpr *ME = MemberExpr::Create(
Context, Base, MemExpr->isArrow(), MemExpr->getOperatorLoc(),
MemExpr->getQualifierLoc(), MemExpr->getTemplateKeywordLoc(), Fn, Found,
MemExpr->getMemberNameInfo(), TemplateArgs, type, valueKind,
OK_Ordinary);
ME->setHadMultipleCandidates(true);
MarkMemberReferenced(ME);
return ME;
}
llvm_unreachable("Invalid reference to overloaded function");

View File

@ -2488,18 +2488,18 @@ Stmt *ASTReader::ReadStmtFromStream(ModuleFile &F) {
ExprObjectKind OK = static_cast<ExprObjectKind>(Record[Idx++]);
Expr *Base = ReadSubExpr();
ValueDecl *MemberD = ReadDeclAs<ValueDecl>(F, Record, Idx);
SourceLocation MemberLoc = ReadSourceLocation(F, Record, Idx);
DeclarationNameInfo MemberNameInfo(MemberD->getDeclName(), MemberLoc);
bool IsArrow = Record[Idx++];
SourceLocation OperatorLoc = ReadSourceLocation(F, Record, Idx);
S = MemberExpr::Create(Context, Base, IsArrow, OperatorLoc, QualifierLoc,
TemplateKWLoc, MemberD, FoundDecl, MemberNameInfo,
HasTemplateKWAndArgsInfo ? &ArgInfo : nullptr, T,
VK, OK);
ReadDeclarationNameLoc(F, cast<MemberExpr>(S)->MemberDNLoc,
MemberD->getDeclName(), Record, Idx);
if (HadMultipleCandidates)
SourceLocation MemberLoc = ReadSourceLocation(F, Record, Idx);
DeclarationNameInfo MemberNameInfo(MemberD->getDeclName(), MemberLoc);
bool IsArrow = Record[Idx++];
SourceLocation OperatorLoc = ReadSourceLocation(F, Record, Idx);
S = MemberExpr::Create(Context, Base, IsArrow, OperatorLoc, QualifierLoc,
TemplateKWLoc, MemberD, FoundDecl, MemberNameInfo,
HasTemplateKWAndArgsInfo ? &ArgInfo : nullptr, T,
VK, OK);
ReadDeclarationNameLoc(F, cast<MemberExpr>(S)->MemberDNLoc,
MemberD->getDeclName(), Record, Idx);
if (HadMultipleCandidates)
cast<MemberExpr>(S)->setHadMultipleCandidates(true);
break;
}

View File

@ -550,13 +550,13 @@ void ASTStmtWriter::VisitMemberExpr(MemberExpr *E) {
Record.push_back(E->getValueKind());
Record.push_back(E->getObjectKind());
Writer.AddStmt(E->getBase());
Writer.AddDeclRef(E->getMemberDecl(), Record);
Writer.AddSourceLocation(E->getMemberLoc(), Record);
Record.push_back(E->isArrow());
Writer.AddSourceLocation(E->getOperatorLoc(), Record);
Writer.AddDeclarationNameLoc(E->MemberDNLoc,
E->getMemberDecl()->getDeclName(), Record);
Code = serialization::EXPR_MEMBER;
Writer.AddDeclRef(E->getMemberDecl(), Record);
Writer.AddSourceLocation(E->getMemberLoc(), Record);
Record.push_back(E->isArrow());
Writer.AddSourceLocation(E->getOperatorLoc(), Record);
Writer.AddDeclarationNameLoc(E->MemberDNLoc,
E->getMemberDecl()->getDeclName(), Record);
Code = serialization::EXPR_MEMBER;
}
void ASTStmtWriter::VisitObjCIsaExpr(ObjCIsaExpr *E) {

View File

@ -106,44 +106,44 @@ TEST(MemberExpr, ImplicitMemberRange) {
Verifier.expectRange(2, 30, 2, 30);
EXPECT_TRUE(Verifier.match("struct S { operator int() const; };\n"
"int foo(const S& s) { return s; }",
memberExpr()));
}
class MemberExprArrowLocVerifier : public RangeVerifier<MemberExpr> {
memberExpr()));
}
class MemberExprArrowLocVerifier : public RangeVerifier<MemberExpr> {
protected:
SourceRange getRange(const MemberExpr &Node) override {
return Node.getOperatorLoc();
}
};
TEST(MemberExpr, ArrowRange) {
MemberExprArrowLocVerifier Verifier;
Verifier.expectRange(2, 19, 2, 19);
EXPECT_TRUE(Verifier.match("struct S { int x; };\n"
"void foo(S *s) { s->x = 0; }",
memberExpr()));
}
TEST(MemberExpr, MacroArrowRange) {
MemberExprArrowLocVerifier Verifier;
Verifier.expectRange(1, 24, 1, 24);
EXPECT_TRUE(Verifier.match("#define MEMBER(a, b) (a->b)\n"
"struct S { int x; };\n"
"void foo(S *s) { MEMBER(s, x) = 0; }",
memberExpr()));
}
TEST(MemberExpr, ImplicitArrowRange) {
MemberExprArrowLocVerifier Verifier;
Verifier.expectRange(0, 0, 0, 0);
EXPECT_TRUE(Verifier.match("struct S { int x; void Test(); };\n"
"void S::Test() { x = 1; }",
memberExpr()));
}
TEST(VarDecl, VMTypeFixedVarDeclRange) {
RangeVerifier<VarDecl> Verifier;
Verifier.expectRange(1, 1, 1, 23);
return Node.getOperatorLoc();
}
};
TEST(MemberExpr, ArrowRange) {
MemberExprArrowLocVerifier Verifier;
Verifier.expectRange(2, 19, 2, 19);
EXPECT_TRUE(Verifier.match("struct S { int x; };\n"
"void foo(S *s) { s->x = 0; }",
memberExpr()));
}
TEST(MemberExpr, MacroArrowRange) {
MemberExprArrowLocVerifier Verifier;
Verifier.expectRange(1, 24, 1, 24);
EXPECT_TRUE(Verifier.match("#define MEMBER(a, b) (a->b)\n"
"struct S { int x; };\n"
"void foo(S *s) { MEMBER(s, x) = 0; }",
memberExpr()));
}
TEST(MemberExpr, ImplicitArrowRange) {
MemberExprArrowLocVerifier Verifier;
Verifier.expectRange(0, 0, 0, 0);
EXPECT_TRUE(Verifier.match("struct S { int x; void Test(); };\n"
"void S::Test() { x = 1; }",
memberExpr()));
}
TEST(VarDecl, VMTypeFixedVarDeclRange) {
RangeVerifier<VarDecl> Verifier;
Verifier.expectRange(1, 1, 1, 23);
EXPECT_TRUE(Verifier.match("int a[(int)(void*)1234];",
varDecl(), Lang_C89));
}