diff options
| author | Edwin Vane <edwin.vane@intel.com> | 2013-03-07 16:22:05 +0000 |
|---|---|---|
| committer | Edwin Vane <edwin.vane@intel.com> | 2013-03-07 16:22:05 +0000 |
| commit | 4f05d7143f5cf831e39e5ed16d33a19dc6da9dcd (patch) | |
| tree | ac54e7b59594fe75c9df0e38e5ca4c98303343a5 /clang-tools-extra/cpp11-migrate/LoopConvert/LoopActions.h | |
| parent | 2a760d02f718751c76db2ed3058f3624ac6ed0d4 (diff) | |
| download | bcm5719-llvm-4f05d7143f5cf831e39e5ed16d33a19dc6da9dcd.tar.gz bcm5719-llvm-4f05d7143f5cf831e39e5ed16d33a19dc6da9dcd.zip | |
Have LoopConvert use 'auto &&' where necessary
For iterators where the dereference operator returns by value, LoopConvert
should use 'auto &&' in the range-based for loop expression.
If the dereference operator returns an rvalue reference, this is deemed too
strange and the for loop is not converted.
Moved test case from iterator_failing.cpp to iterator.cpp and added extra
tests.
Fixes PR15437.
Reviewer: gribozavr
llvm-svn: 176631
Diffstat (limited to 'clang-tools-extra/cpp11-migrate/LoopConvert/LoopActions.h')
| -rw-r--r-- | clang-tools-extra/cpp11-migrate/LoopConvert/LoopActions.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/clang-tools-extra/cpp11-migrate/LoopConvert/LoopActions.h b/clang-tools-extra/cpp11-migrate/LoopConvert/LoopActions.h index 504e6ab64d2..bd91a98f7bd 100644 --- a/clang-tools-extra/cpp11-migrate/LoopConvert/LoopActions.h +++ b/clang-tools-extra/cpp11-migrate/LoopConvert/LoopActions.h @@ -74,7 +74,8 @@ class LoopFixer : public clang::ast_matchers::MatchFinder::MatchCallback { const UsageResult &Usages, const clang::DeclStmt *AliasDecl, const clang::ForStmt *TheLoop, - bool ContainerNeedsDereference); + bool ContainerNeedsDereference, + bool DerefByValue); /// \brief Given a loop header that would be convertible, discover all usages /// of the index variable and convert the loop if possible. @@ -84,6 +85,7 @@ class LoopFixer : public clang::ast_matchers::MatchFinder::MatchCallback { const clang::Expr *ContainerExpr, const clang::Expr *BoundExpr, bool ContainerNeedsDereference, + bool DerefByValue, const clang::ForStmt *TheLoop, Confidence ConfidenceLevel); |

