aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2011-10-17 17:42:19 +0000
committerJohn McCall <rjmccall@apple.com>2011-10-17 17:42:19 +0000
commit4919dfd54e2296ca997e3d1c9dab85976bba8e95 (patch)
tree66fdd06267e23228514daaa8bcf42539ac7daf4a
parenta2b4e5d9292688bc67b583592918dbeecae31ea3 (diff)
Add a helper function for determining whether an expression
has placeholder type. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142203 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/clang/AST/Expr.h12
-rw-r--r--lib/Sema/SemaCast.cpp2
2 files changed, 13 insertions, 1 deletions
diff --git a/include/clang/AST/Expr.h b/include/clang/AST/Expr.h
index 7c72b92e18..48682dc205 100644
--- a/include/clang/AST/Expr.h
+++ b/include/clang/AST/Expr.h
@@ -390,6 +390,18 @@ public:
/// \brief Returns whether this expression refers to a vector element.
bool refersToVectorElement() const;
+
+ /// \brief Returns whether this expression has a placeholder type.
+ bool hasPlaceholderType() const {
+ return getType()->isPlaceholderType();
+ }
+
+ /// \brief Returns whether this expression has a specific placeholder type.
+ bool hasPlaceholderType(BuiltinType::Kind K) const {
+ if (const BuiltinType *BT = dyn_cast<BuiltinType>(getType()))
+ return BT->getKind() == K;
+ return false;
+ }
/// isKnownToHaveBooleanValue - Return true if this is an integer expression
/// that is known to return 0 or 1. This happens for _Bool/bool expressions
diff --git a/lib/Sema/SemaCast.cpp b/lib/Sema/SemaCast.cpp
index 8bd9351e0b..b20732a5f7 100644
--- a/lib/Sema/SemaCast.cpp
+++ b/lib/Sema/SemaCast.cpp
@@ -1728,7 +1728,7 @@ void CastOperation::CheckCXXCStyleCast(bool FunctionalStyle) {
checkNonOverloadPlaceholders();
if (SrcExpr.isInvalid())
return;
- }
+ }
// C++ 5.2.9p4: Any expression can be explicitly converted to type "cv void".
// This test is outside everything else because it's the only case where