[cfe-commits] r142203 - in /cfe/trunk: include/clang/AST/Expr.h lib/Sema/SemaCast.cpp

John McCall rjmccall at apple.com
Mon Oct 17 10:42:19 PDT 2011


Author: rjmccall
Date: Mon Oct 17 12:42:19 2011
New Revision: 142203

URL: http://llvm.org/viewvc/llvm-project?rev=142203&view=rev
Log:
Add a helper function for determining whether an expression
has placeholder type.


Modified:
    cfe/trunk/include/clang/AST/Expr.h
    cfe/trunk/lib/Sema/SemaCast.cpp

Modified: cfe/trunk/include/clang/AST/Expr.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Expr.h?rev=142203&r1=142202&r2=142203&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/Expr.h (original)
+++ cfe/trunk/include/clang/AST/Expr.h Mon Oct 17 12:42:19 2011
@@ -390,6 +390,18 @@
 
   /// \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

Modified: cfe/trunk/lib/Sema/SemaCast.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaCast.cpp?rev=142203&r1=142202&r2=142203&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaCast.cpp (original)
+++ cfe/trunk/lib/Sema/SemaCast.cpp Mon Oct 17 12:42:19 2011
@@ -1728,7 +1728,7 @@
     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





More information about the cfe-commits mailing list