[PATCH] Stop LoopConvert removing DeclStmts from selection/iteration condition clauses

Edwin Vane edwin.vane at intel.com
Mon May 6 12:48:15 PDT 2013


Hi tareqsiraj,

If the LoopConvert Transform detects an alias for the loop variable, it
attempts to use that name in the resulting range-based for loop while
removing the original DeclStmt for the variable. That removal produced
bad code when the declaration was in the condition of an if, switch,
while, or for stmt. This revision fixes the problem by simply replacing
the declaration with a use of the alias variable.

Aliases declared in the init clause of a nested for loop are still
removed.

http://llvm-reviews.chandlerc.com/D752

Files:
  cpp11-migrate/LoopConvert/LoopActions.cpp
  cpp11-migrate/LoopConvert/LoopActions.h
  test/cpp11-migrate/LoopConvert/naming-alias.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D752.1.patch
Type: text/x-patch
Size: 7953 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130506/6b5b63f5/attachment.bin>


More information about the cfe-commits mailing list