[llvm] r236990 - Replacing a range-based for loop with an old-style for loop. This code was previously causing a warning with MSVC about a compiler-generated local variable because TargetRegistry::begin() and end() are static member functions. NFC.

Aaron Ballman aaron at aaronballman.com
Mon May 11 06:10:17 PDT 2015


Author: aaronballman
Date: Mon May 11 08:10:17 2015
New Revision: 236990

URL: http://llvm.org/viewvc/llvm-project?rev=236990&view=rev
Log:
Replacing a range-based for loop with an old-style for loop. This code was previously causing a warning with MSVC about a compiler-generated local variable because TargetRegistry::begin() and end() are static member functions. NFC.

Modified:
    llvm/trunk/unittests/Support/TargetRegistry.cpp

Modified: llvm/trunk/unittests/Support/TargetRegistry.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/Support/TargetRegistry.cpp?rev=236990&r1=236989&r2=236990&view=diff
==============================================================================
--- llvm/trunk/unittests/Support/TargetRegistry.cpp (original)
+++ llvm/trunk/unittests/Support/TargetRegistry.cpp Mon May 11 08:10:17 2015
@@ -23,8 +23,9 @@ TEST(TargetRegistry, TargetHasArchType)
   llvm::InitializeAllTargetInfos();
 
   llvm::TargetRegistry RegistryRoot;
-  for (const auto &Target : RegistryRoot) {
-    StringRef Name = Target.getName();
+  for (auto &I = TargetRegistry::begin(), &E = TargetRegistry::end();
+       I != E; ++I) {
+    StringRef Name = I->getName();
     // There is really no way (at present) to ask a Target whether it targets
     // a specific architecture, because the logic for that is buried in a
     // predicate.





More information about the llvm-commits mailing list