summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/Expr.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-02-24 22:18:39 +0000
committerChris Lattner <sabre@nondot.org>2009-02-24 22:18:39 +0000
commitd7e7b8e4115d34c42b3ba479ff7615a7efbf25fc (patch)
treefe3641cd6aca04382717ef836335d30d4cb8f98c /clang/lib/AST/Expr.cpp
parent9b15effcd1f3a9ea9dec0ba4a4447015196a85b3 (diff)
downloadbcm5719-llvm-d7e7b8e4115d34c42b3ba479ff7615a7efbf25fc.tar.gz
bcm5719-llvm-d7e7b8e4115d34c42b3ba479ff7615a7efbf25fc.zip
first wave of fixes for @encode sema support. This is part of PR3648.
The big difference here is that (like string literal) @encode has array type, not pointer type. llvm-svn: 65391
Diffstat (limited to 'clang/lib/AST/Expr.cpp')
-rw-r--r--clang/lib/AST/Expr.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/clang/lib/AST/Expr.cpp b/clang/lib/AST/Expr.cpp
index 3aea3e324ba..d551eac3006 100644
--- a/clang/lib/AST/Expr.cpp
+++ b/clang/lib/AST/Expr.cpp
@@ -478,7 +478,8 @@ Expr::isLvalueResult Expr::isLvalue(ASTContext &Ctx) const {
// the type looks fine, now check the expression
switch (getStmtClass()) {
- case StringLiteralClass: // C99 6.5.1p4
+ case StringLiteralClass: // C99 6.5.1p4
+ case ObjCEncodeExprClass: // @encode behaves like its string in every way.
return LV_Valid;
case ArraySubscriptExprClass: // C99 6.5.3p4 (e1[e2] == (*((e1)+(e2))))
// For vectors, make sure base is an lvalue (i.e. not a function call).
@@ -829,6 +830,7 @@ bool Expr::isConstantInitializer(ASTContext &Ctx) const {
switch (getStmtClass()) {
default: break;
case StringLiteralClass:
+ case ObjCEncodeExprClass:
return true;
case CompoundLiteralExprClass: {
// This handles gcc's extension that allows global initializers like
OpenPOWER on IntegriCloud