forked from OSchip/llvm-project
Obective-C. Patch to fix the incorrect ObjcMessageExpr argument source ranges,
when arguments are structures or classes. PR16392. patch by Karlis Senko llvm-svn: 214409
This commit is contained in:
parent
be39a87e11
commit
a1db7df243
|
@ -1402,7 +1402,7 @@ bool Sema::CheckMessageArgumentTypes(QualType ReceiverType,
|
|||
|
||||
InitializedEntity Entity = InitializedEntity::InitializeParameter(Context,
|
||||
param);
|
||||
ExprResult ArgE = PerformCopyInitialization(Entity, SelLoc, argExpr);
|
||||
ExprResult ArgE = PerformCopyInitialization(Entity, SourceLocation(), argExpr);
|
||||
if (ArgE.isInvalid())
|
||||
IsError = true;
|
||||
else
|
||||
|
|
|
@ -25,7 +25,14 @@
|
|||
namespace clang {
|
||||
namespace ast_matchers {
|
||||
|
||||
enum Language { Lang_C, Lang_C89, Lang_CXX, Lang_CXX11, Lang_OpenCL };
|
||||
enum Language {
|
||||
Lang_C,
|
||||
Lang_C89,
|
||||
Lang_CXX,
|
||||
Lang_CXX11,
|
||||
Lang_OpenCL,
|
||||
Lang_OBJCXX
|
||||
};
|
||||
|
||||
/// \brief Base class for verifying some property of nodes found by a matcher.
|
||||
template <typename NodeType>
|
||||
|
@ -102,6 +109,10 @@ testing::AssertionResult MatchVerifier<NodeType>::match(
|
|||
break;
|
||||
case Lang_OpenCL:
|
||||
FileName = "input.cl";
|
||||
break;
|
||||
case Lang_OBJCXX:
|
||||
FileName = "input.mm";
|
||||
break;
|
||||
}
|
||||
|
||||
// Default to failure in case callback is never called
|
||||
|
|
|
@ -486,5 +486,17 @@ TEST(FriendDecl, InstantiationSourceRange) {
|
|||
friendDecl(hasParent(recordDecl(isTemplateInstantiation())))));
|
||||
}
|
||||
|
||||
TEST(ObjCMessageExpr, CXXConstructExprRange) {
|
||||
RangeVerifier<CXXConstructExpr> Verifier;
|
||||
Verifier.expectRange(5, 25, 5, 27);
|
||||
EXPECT_TRUE(Verifier.match(
|
||||
"struct A { int a; };\n"
|
||||
"@interface B {}\n"
|
||||
"+ (void) f1: (A)arg;\n"
|
||||
"@end\n"
|
||||
"void f2() { A a; [B f1: (a)]; }\n",
|
||||
constructExpr(), Lang_OBJCXX));
|
||||
}
|
||||
|
||||
} // end namespace ast_matchers
|
||||
} // end namespace clang
|
||||
|
|
Loading…
Reference in New Issue