[cfe-commits] r76807 - in /cfe/trunk: lib/Sema/SemaExpr.cpp test/SemaTemplate/instantiate-expr-5.cpp
Eli Friedman
eli.friedman at gmail.com
Wed Jul 22 15:25:00 PDT 2009
Author: efriedma
Date: Wed Jul 22 17:25:00 2009
New Revision: 76807
URL: http://llvm.org/viewvc/llvm-project?rev=76807&view=rev
Log:
Slight code reorganization to allow instantiating post-inc/dec.
Added:
cfe/trunk/test/SemaTemplate/instantiate-expr-5.cpp
Modified:
cfe/trunk/lib/Sema/SemaExpr.cpp
Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=76807&r1=76806&r2=76807&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Wed Jul 22 17:25:00 2009
@@ -1703,12 +1703,7 @@
// build a built-in operation.
}
- QualType result = CheckIncrementDecrementOperand(Arg, OpLoc,
- Opc == UnaryOperator::PostInc);
- if (result.isNull())
- return ExprError();
- Input.release();
- return Owned(new (Context) UnaryOperator(Arg, Opc, result, OpLoc));
+ return CreateBuiltinUnaryOp(OpLoc, Opc, move(Input));
}
Action::OwningExprResult
@@ -5014,16 +5009,17 @@
Expr *Input = (Expr *)InputArg.get();
QualType resultType;
switch (Opc) {
- case UnaryOperator::PostInc:
- case UnaryOperator::PostDec:
case UnaryOperator::OffsetOf:
assert(false && "Invalid unary operator");
break;
case UnaryOperator::PreInc:
case UnaryOperator::PreDec:
+ case UnaryOperator::PostInc:
+ case UnaryOperator::PostDec:
resultType = CheckIncrementDecrementOperand(Input, OpLoc,
- Opc == UnaryOperator::PreInc);
+ Opc == UnaryOperator::PreInc ||
+ Opc == UnaryOperator::PostInc);
break;
case UnaryOperator::AddrOf:
resultType = CheckAddressOfOperand(Input, OpLoc);
Added: cfe/trunk/test/SemaTemplate/instantiate-expr-5.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaTemplate/instantiate-expr-5.cpp?rev=76807&view=auto
==============================================================================
--- cfe/trunk/test/SemaTemplate/instantiate-expr-5.cpp (added)
+++ cfe/trunk/test/SemaTemplate/instantiate-expr-5.cpp Wed Jul 22 17:25:00 2009
@@ -0,0 +1,4 @@
+// RUN: clang-cc -fsyntax-only %s
+
+template <class A> int x(A x) { return x++; }
+int y() { return x<int>(1); }
More information about the cfe-commits
mailing list