]> granicus.if.org Git - clang/commitdiff
Add a helper function for determining whether an expression
authorJohn McCall <rjmccall@apple.com>
Mon, 17 Oct 2011 17:42:19 +0000 (17:42 +0000)
committerJohn McCall <rjmccall@apple.com>
Mon, 17 Oct 2011 17:42:19 +0000 (17:42 +0000)
has placeholder type.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142203 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/AST/Expr.h
lib/Sema/SemaCast.cpp

index 7c72b92e18c6d1cc4b9705a5205f6725dc27f37c..48682dc20562a61f9353b2dbe825d38242bcb28a 100644 (file)
@@ -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
index 8bd9351e0bd4e238aaf4ae57f3a6d2078b26a47d..b20732a5f72b153e5fd7e22b093868cdb7b82e9d 100644 (file)
@@ -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