[llvm] r235090 - Make it obvious that we're iterating over a range of pointers.

Benjamin Kramer benny.kra at googlemail.com
Thu Apr 16 05:43:07 PDT 2015


Author: d0k
Date: Thu Apr 16 07:43:07 2015
New Revision: 235090

URL: http://llvm.org/viewvc/llvm-project?rev=235090&view=rev
Log:
Make it obvious that we're iterating over a range of pointers.

Found by -Wrange-loop-analysis.

Modified:
    llvm/trunk/include/llvm/Analysis/RegionInfoImpl.h
    llvm/trunk/lib/Target/CppBackend/CPPBackend.cpp

Modified: llvm/trunk/include/llvm/Analysis/RegionInfoImpl.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/RegionInfoImpl.h?rev=235090&r1=235089&r2=235090&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/RegionInfoImpl.h (original)
+++ llvm/trunk/include/llvm/Analysis/RegionInfoImpl.h Thu Apr 16 07:43:07 2015
@@ -487,7 +487,7 @@ void RegionBase<Tr>::print(raw_ostream &
     OS.indent(level * 2 + 2);
 
     if (Style == PrintBB) {
-      for (const auto &BB : blocks())
+      for (const auto *BB : blocks())
         OS << BB->getName() << ", "; // TODO: remove the last ","
     } else if (Style == PrintRN) {
       for (const_element_iterator I = element_begin(), E = element_end();

Modified: llvm/trunk/lib/Target/CppBackend/CPPBackend.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CppBackend/CPPBackend.cpp?rev=235090&r1=235089&r2=235090&view=diff
==============================================================================
--- llvm/trunk/lib/Target/CppBackend/CPPBackend.cpp (original)
+++ llvm/trunk/lib/Target/CppBackend/CPPBackend.cpp Thu Apr 16 07:43:07 2015
@@ -1724,7 +1724,7 @@ void CppWriter::printFunctionUses(const
   // initializers.
   if (GenerationType != GenFunction) {
     nl(Out) << "// Global Variable Definitions"; nl(Out);
-    for (const auto &GV : gvs) {
+    for (auto *GV : gvs) {
       if (GlobalVariable *Var = dyn_cast<GlobalVariable>(GV))
         printVariableBody(Var);
     }





More information about the llvm-commits mailing list