[cfe-commits] r89717 - in /cfe/trunk: include/clang/AST/Stmt.h lib/CodeGen/CGStmt.cpp lib/Frontend/PCHReaderStmt.cpp lib/Frontend/PCHWriterStmt.cpp lib/Sema/Sema.h lib/Sema/SemaExprCXX.cpp lib/Sema/SemaStmt.cpp lib/Sema/TreeTransform.h

Anders Carlsson andersca at mac.com
Mon Nov 23 23:27:39 PST 2009

23 nov 2009 kl. 15.44 skrev Douglas Gregor:

> Author: dgregor
> Date: Mon Nov 23 17:44:04 2009
> New Revision: 89717
> URL: http://llvm.org/viewvc/llvm-project?rev=89717&view=rev
> Log:
> Explicitly track the condition variable within an "if" statement,
> rather than burying it in a CXXConditionDeclExpr (that occassionally
> hides behind implicit conversions). Similar changes for
> switch, while, and do-while will follow, then the removal of
> CXXConditionDeclExpr. This commit is the canary.

This broke the following test:

void *f();

template <typename T> T* g() {
  if (T* t = f())
    return t;
  return 0;

void h() {
  void *a = g<void>();

which is very common in clang (getAs<FooType>() :)

Also, if you're getting rid of CXXConditionDeclExpr, then how are you going to disambiguate between

if (void * f = foo()) { }


void *f = foo();

if (f) { }

Since both cond exprs in this case are going to be DeclRefExprs.


More information about the cfe-commits mailing list