From: John McCall Date: Mon, 17 Oct 2011 17:42:19 +0000 (+0000) Subject: Add a helper function for determining whether an expression X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4919dfd54e2296ca997e3d1c9dab85976bba8e95;p=clang 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 --- 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(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