summaryrefslogtreecommitdiffstats
path: root/lib/Parse
diff options
context:
space:
mode:
authordim <dim@FreeBSD.org>2016-01-06 20:02:26 +0000
committerdim <dim@FreeBSD.org>2016-01-06 20:02:26 +0000
commitfc74ff5a0792641885551a63d9ddf8cbfdf76e3c (patch)
tree955a1295c3fd4378a49478ad5835ca21b769417e /lib/Parse
parent3176e97f130184ece0e1a21352c8124cc83ff24a (diff)
downloadFreeBSD-src-fc74ff5a0792641885551a63d9ddf8cbfdf76e3c.zip
FreeBSD-src-fc74ff5a0792641885551a63d9ddf8cbfdf76e3c.tar.gz
Vendor import of clang trunk r256945:
https://llvm.org/svn/llvm-project/cfe/trunk@256945
Diffstat (limited to 'lib/Parse')
-rw-r--r--lib/Parse/ParseExpr.cpp17
-rw-r--r--lib/Parse/ParseStmtAsm.cpp5
2 files changed, 18 insertions, 4 deletions
diff --git a/lib/Parse/ParseExpr.cpp b/lib/Parse/ParseExpr.cpp
index 490bd5a..1fd98c1 100644
--- a/lib/Parse/ParseExpr.cpp
+++ b/lib/Parse/ParseExpr.cpp
@@ -1334,8 +1334,23 @@ ExprResult Parser::ParseCastExpression(bool isUnaryExpression,
return ExprError();
}
+ // Check to see whether Res is a function designator only. If it is and we
+ // are compiling for OpenCL, we need to return an error as this implies
+ // that the address of the function is being taken, which is illegal in CL.
+
// These can be followed by postfix-expr pieces.
- return ParsePostfixExpressionSuffix(Res);
+ Res = ParsePostfixExpressionSuffix(Res);
+ if (getLangOpts().OpenCL)
+ if (Expr *PostfixExpr = Res.get()) {
+ QualType Ty = PostfixExpr->getType();
+ if (!Ty.isNull() && Ty->isFunctionType()) {
+ Diag(PostfixExpr->getExprLoc(),
+ diag::err_opencl_taking_function_address_parser);
+ return ExprError();
+ }
+ }
+
+ return Res;
}
/// \brief Once the leading part of a postfix-expression is parsed, this
diff --git a/lib/Parse/ParseStmtAsm.cpp b/lib/Parse/ParseStmtAsm.cpp
index f469a064..142b473 100644
--- a/lib/Parse/ParseStmtAsm.cpp
+++ b/lib/Parse/ParseStmtAsm.cpp
@@ -241,9 +241,8 @@ ExprResult Parser::ParseMSAsmIdentifier(llvm::SmallVectorImpl<Token> &LineToks,
ConsumeToken(); // Consume the period.
IdentifierInfo *Id = Tok.getIdentifierInfo();
ConsumeToken(); // Consume the identifier.
- unsigned OffsetUnused;
- Result = Actions.LookupInlineAsmVarDeclField(
- Result.get(), Id->getName(), OffsetUnused, Info, Tok.getLocation());
+ Result = Actions.LookupInlineAsmVarDeclField(Result.get(), Id->getName(),
+ Info, Tok.getLocation());
}
// Figure out how many tokens we are into LineToks.
OpenPOWER on IntegriCloud