[lld] r281951 - Remove a use of std::list.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 19 17:02:07 PDT 2016


Author: ruiu
Date: Mon Sep 19 19:02:06 2016
New Revision: 281951

URL: http://llvm.org/viewvc/llvm-project?rev=281951&view=rev
Log:
Remove a use of std::list.

Modified:
    lld/trunk/ELF/LinkerScript.h

Modified: lld/trunk/ELF/LinkerScript.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/LinkerScript.h?rev=281951&r1=281950&r2=281951&view=diff
==============================================================================
--- lld/trunk/ELF/LinkerScript.h (original)
+++ lld/trunk/ELF/LinkerScript.h Mon Sep 19 19:02:06 2016
@@ -21,7 +21,6 @@
 #include "llvm/Support/MemoryBuffer.h"
 #include "llvm/Support/Regex.h"
 #include <functional>
-#include <list>
 
 namespace lld {
 namespace elf {
@@ -101,6 +100,15 @@ struct OutputSectionCommand : BaseComman
 // This struct represents one section match pattern in SECTIONS() command.
 // It can optionally have negative match pattern for EXCLUDED_FILE command.
 struct SectionPattern {
+  SectionPattern(llvm::Regex &&Re1, llvm::Regex &&Re2)
+      : ExcludedFileRe(std::forward<llvm::Regex>(Re1)),
+        SectionRe(std::forward<llvm::Regex>(Re2)) {}
+
+  SectionPattern(SectionPattern &&Other) {
+    std::swap(ExcludedFileRe, Other.ExcludedFileRe);
+    std::swap(SectionRe, Other.SectionRe);
+  }
+
   llvm::Regex ExcludedFileRe;
   llvm::Regex SectionRe;
 };
@@ -116,9 +124,7 @@ struct InputSectionDescription : BaseCom
 
   // Input sections that matches at least one of SectionPatterns
   // will be associated with this InputSectionDescription.
-  // We use std::list instead of std::vector because SectionPattern
-  // do not support move assignment.
-  std::list<SectionPattern> SectionPatterns;
+  std::vector<SectionPattern> SectionPatterns;
 
   std::vector<InputSectionData *> Sections;
 };




More information about the llvm-commits mailing list