[cfe-commits] r91071 - in /cfe/trunk: lib/CodeGen/CGExprScalar.cpp test/CodeGenCXX/unary-type-trait.cpp
Eli Friedman
eli.friedman at gmail.com
Thu Dec 10 14:40:33 PST 2009
Author: efriedma
Date: Thu Dec 10 16:40:32 2009
New Revision: 91071
URL: http://llvm.org/viewvc/llvm-project?rev=91071&view=rev
Log:
Support unary type traits in a scalar context. Not that I've actually seen
this construct, but might as well for completeness.
Added:
cfe/trunk/test/CodeGenCXX/unary-type-trait.cpp
Modified:
cfe/trunk/lib/CodeGen/CGExprScalar.cpp
Modified: cfe/trunk/lib/CodeGen/CGExprScalar.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprScalar.cpp?rev=91071&r1=91070&r2=91071&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGExprScalar.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExprScalar.cpp Thu Dec 10 16:40:32 2009
@@ -263,6 +263,10 @@
CGF.EmitCXXDeleteExpr(E);
return 0;
}
+ Value *VisitUnaryTypeTraitExpr(const UnaryTypeTraitExpr *E) {
+ return llvm::ConstantInt::get(Builder.getInt1Ty(),
+ E->EvaluateTrait(CGF.getContext()));
+ }
Value *VisitCXXPseudoDestructorExpr(const CXXPseudoDestructorExpr *E) {
// C++ [expr.pseudo]p1:
Added: cfe/trunk/test/CodeGenCXX/unary-type-trait.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/unary-type-trait.cpp?rev=91071&view=auto
==============================================================================
--- cfe/trunk/test/CodeGenCXX/unary-type-trait.cpp (added)
+++ cfe/trunk/test/CodeGenCXX/unary-type-trait.cpp Thu Dec 10 16:40:32 2009
@@ -0,0 +1,3 @@
+// RUN: clang-cc -emit-llvm-only -verify %s
+
+bool a() { return __is_pod(int); }
More information about the cfe-commits
mailing list