[lld] r205564 - Expand 'auto' that's hard for human to deduce its real type.

Rui Ueyama ruiu at google.com
Thu Apr 3 13:47:51 PDT 2014


Author: ruiu
Date: Thu Apr  3 15:47:50 2014
New Revision: 205564

URL: http://llvm.org/viewvc/llvm-project?rev=205564&view=rev
Log:
Expand 'auto' that's hard for human to deduce its real type.

Modified:
    lld/trunk/include/lld/Core/InputGraph.h
    lld/trunk/include/lld/ReaderWriter/LinkerScript.h
    lld/trunk/lib/Core/InputGraph.cpp
    lld/trunk/lib/Core/PassManager.cpp
    lld/trunk/lib/Driver/Driver.cpp
    lld/trunk/lib/Driver/GnuLdInputGraph.cpp
    lld/trunk/lib/Driver/WinLinkDriver.cpp

Modified: lld/trunk/include/lld/Core/InputGraph.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/Core/InputGraph.h?rev=205564&r1=205563&r2=205564&view=diff
==============================================================================
--- lld/trunk/include/lld/Core/InputGraph.h (original)
+++ lld/trunk/include/lld/Core/InputGraph.h Thu Apr  3 15:47:50 2014
@@ -176,13 +176,13 @@ public:
     _madeProgress = false;
     _currentElementIndex = 0;
     _nextElementIndex = 0;
-    for (auto &elem : _elements)
+    for (std::unique_ptr<InputElement> &elem : _elements)
       elem->resetNextIndex();
   }
 
   /// \brief Parse the group members.
   error_code parse(const LinkingContext &ctx, raw_ostream &diag) override {
-    for (auto &ei : _elements)
+    for (std::unique_ptr<InputElement> &ei : _elements)
       if (error_code ec = ei->parse(ctx, diag))
         return ec;
     return error_code::success();
@@ -191,7 +191,7 @@ public:
   /// If Resolver made a progress using the current file, it's ok to revisit
   /// files in this group in future.
   void notifyProgress() override {
-    for (auto &elem : _elements)
+    for (std::unique_ptr<InputElement> &elem : _elements)
       elem->notifyProgress();
     _madeProgress = true;
   }
@@ -245,7 +245,7 @@ public:
 
   /// \brief add a file to the list of files
   virtual void addFiles(InputGraph::FileVectorT files) {
-    for (auto &ai : files)
+    for (std::unique_ptr<File> &ai : files)
       _files.push_back(std::move(ai));
   }
 

Modified: lld/trunk/include/lld/ReaderWriter/LinkerScript.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/ReaderWriter/LinkerScript.h?rev=205564&r1=205563&r2=205564&view=diff
==============================================================================
--- lld/trunk/include/lld/ReaderWriter/LinkerScript.h (original)
+++ lld/trunk/include/lld/ReaderWriter/LinkerScript.h Thu Apr  3 15:47:50 2014
@@ -165,7 +165,7 @@ public:
   void dump(raw_ostream &os) const override {
     os << "GROUP(";
     bool first = true;
-    for (const auto &path : getPaths()) {
+    for (const Path &path : getPaths()) {
       if (!first)
         os << " ";
       else
@@ -209,7 +209,7 @@ private:
 class LinkerScript {
 public:
   void dump(raw_ostream &os) const {
-    for (const auto &c : _commands)
+    for (const Command *c : _commands)
       c->dump(os);
   }
 

Modified: lld/trunk/lib/Core/InputGraph.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Core/InputGraph.cpp?rev=205564&r1=205563&r2=205564&view=diff
==============================================================================
--- lld/trunk/lib/Core/InputGraph.cpp (original)
+++ lld/trunk/lib/Core/InputGraph.cpp Thu Apr  3 15:47:50 2014
@@ -50,7 +50,7 @@ bool InputGraph::addInputElement(std::un
 }
 
 bool InputGraph::dump(raw_ostream &diagnostics) {
-  for (auto &ie : _inputArgs)
+  for (std::unique_ptr<InputElement> &ie : _inputArgs)
     if (!ie->dump(diagnostics))
       return false;
   return true;

Modified: lld/trunk/lib/Core/PassManager.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Core/PassManager.cpp?rev=205564&r1=205563&r2=205564&view=diff
==============================================================================
--- lld/trunk/lib/Core/PassManager.cpp (original)
+++ lld/trunk/lib/Core/PassManager.cpp Thu Apr  3 15:47:50 2014
@@ -16,7 +16,7 @@
 
 namespace lld {
 error_code PassManager::runOnFile(std::unique_ptr<MutableFile> &mf) {
-  for (auto &pass : _passes)
+  for (std::unique_ptr<Pass> &pass : _passes)
     pass->perform(mf);
   return error_code::success();
 }

Modified: lld/trunk/lib/Driver/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Driver/Driver.cpp?rev=205564&r1=205563&r2=205564&view=diff
==============================================================================
--- lld/trunk/lib/Driver/Driver.cpp (original)
+++ lld/trunk/lib/Driver/Driver.cpp Thu Apr  3 15:47:50 2014
@@ -54,7 +54,7 @@ bool Driver::link(LinkingContext &contex
   ScopedTask readTask(getDefaultDomain(), "Read Args");
   TaskGroup tg;
   std::mutex diagnosticsMutex;
-  for (auto &ie : inputGraph.inputElements()) {
+  for (std::unique_ptr<InputElement> &ie : inputGraph.inputElements()) {
     tg.spawn([&] {
       // Writes to the same output stream is not guaranteed to be thread-safe.
       // We buffer the diagnostics output to a separate string-backed output

Modified: lld/trunk/lib/Driver/GnuLdInputGraph.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Driver/GnuLdInputGraph.cpp?rev=205564&r1=205563&r2=205564&view=diff
==============================================================================
--- lld/trunk/lib/Driver/GnuLdInputGraph.cpp (original)
+++ lld/trunk/lib/Driver/GnuLdInputGraph.cpp Thu Apr  3 15:47:50 2014
@@ -77,10 +77,10 @@ error_code ELFGNULdScript::parse(const L
   ELFFileNode::Attributes attributes;
   if (error_code ec = GNULdScript::parse(ctx, diagnostics))
     return ec;
-  for (const auto &c : _linkerScript->_commands) {
+  for (const script::Command *c : _linkerScript->_commands) {
     if (auto group = dyn_cast<script::Group>(c)) {
       std::unique_ptr<Group> groupStart(new Group());
-      for (auto &path : group->getPaths()) {
+      for (const script::Path &path : group->getPaths()) {
         // TODO : Propagate Set WholeArchive/dashlPrefix
         attributes.setAsNeeded(path._asNeeded);
         auto inputNode = new ELFFileNode(

Modified: lld/trunk/lib/Driver/WinLinkDriver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Driver/WinLinkDriver.cpp?rev=205564&r1=205563&r2=205564&view=diff
==============================================================================
--- lld/trunk/lib/Driver/WinLinkDriver.cpp (original)
+++ lld/trunk/lib/Driver/WinLinkDriver.cpp Thu Apr  3 15:47:50 2014
@@ -1237,7 +1237,7 @@ bool WinLinkDriver::parse(int argc, cons
   // Add the input files to the input graph.
   if (!ctx.hasInputGraph())
     ctx.setInputGraph(std::unique_ptr<InputGraph>(new InputGraph()));
-  for (auto &file : files) {
+  for (std::unique_ptr<FileNode> &file : files) {
     if (isReadingDirectiveSection)
       if (file->parse(ctx, diag))
         return false;





More information about the llvm-commits mailing list