[PATCH] Improve loop convert's variable aliasing
Edwin Vane
edwin.vane at intel.com
Thu Mar 28 20:06:59 PDT 2013
================
Comment at: cpp11-migrate/LoopConvert/LoopActions.cpp:780
@@ +779,3 @@
+ // declared as a reference.
+ if (!VarNameFromAlias || (VarNameFromAlias && AliasVarIsRef)) {
+ // If an iterator's operator*() returns a 'T&' we can bind that to 'auto&'.
----------------
This can be simplified to just !VarNameFromAlias || AliasVarIsRef
================
Comment at: cpp11-migrate/LoopConvert/LoopActions.cpp:740
@@ -739,1 +739,3 @@
std::string VarName;
+ bool VarNameFromAlias = Usages.size() == 1 && AliasDecl;
+ bool AliasVarIsRef = false;
----------------
I'm guessing this won't happen if a loop uses both an alias as well as the iterator other than to initialize the alias?
http://llvm-reviews.chandlerc.com/D588
More information about the cfe-commits
mailing list