[llvm] r305537 - [BinaryFormat, Option, TableGen] Fix some Clang-tidy modernize-use-using and Include What You Use warnings; other minor fixes (NFC).

Eugene Zelenko via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 15 17:43:27 PDT 2017


Author: eugenezelenko
Date: Thu Jun 15 19:43:26 2017
New Revision: 305537

URL: http://llvm.org/viewvc/llvm-project?rev=305537&view=rev
Log:
[BinaryFormat, Option, TableGen] Fix some Clang-tidy modernize-use-using and Include What You Use warnings; other minor fixes (NFC).

Modified:
    llvm/trunk/include/llvm/BinaryFormat/ELF.h
    llvm/trunk/include/llvm/Option/Arg.h
    llvm/trunk/include/llvm/Option/ArgList.h
    llvm/trunk/include/llvm/Option/OptSpecifier.h
    llvm/trunk/include/llvm/Option/OptTable.h
    llvm/trunk/include/llvm/Option/Option.h
    llvm/trunk/include/llvm/TableGen/Main.h
    llvm/trunk/include/llvm/TableGen/Record.h
    llvm/trunk/include/llvm/TableGen/SetTheory.h
    llvm/trunk/include/llvm/TableGen/StringMatcher.h
    llvm/trunk/lib/Option/Arg.cpp
    llvm/trunk/lib/Option/ArgList.cpp
    llvm/trunk/lib/Option/OptTable.cpp
    llvm/trunk/lib/Option/Option.cpp
    llvm/trunk/lib/TableGen/Record.cpp
    llvm/trunk/lib/TableGen/SetTheory.cpp

Modified: llvm/trunk/include/llvm/BinaryFormat/ELF.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/BinaryFormat/ELF.h?rev=305537&r1=305536&r2=305537&view=diff
==============================================================================
--- llvm/trunk/include/llvm/BinaryFormat/ELF.h (original)
+++ llvm/trunk/include/llvm/BinaryFormat/ELF.h Thu Jun 15 19:43:26 2017
@@ -1,4 +1,4 @@
-//===-- llvm/BinaryFormat/ELF.h - ELF constants and structures --*- C++ -*-===//
+//===- llvm/BinaryFormat/ELF.h - ELF constants and structures ---*- C++ -*-===//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -20,27 +20,25 @@
 #ifndef LLVM_BINARYFORMAT_ELF_H
 #define LLVM_BINARYFORMAT_ELF_H
 
-#include "llvm/Support/Compiler.h"
-#include "llvm/Support/DataTypes.h"
+#include <cstdint>
 #include <cstring>
 
 namespace llvm {
-
 namespace ELF {
 
-typedef uint32_t Elf32_Addr; // Program address
-typedef uint32_t Elf32_Off;  // File offset
-typedef uint16_t Elf32_Half;
-typedef uint32_t Elf32_Word;
-typedef int32_t Elf32_Sword;
-
-typedef uint64_t Elf64_Addr;
-typedef uint64_t Elf64_Off;
-typedef uint16_t Elf64_Half;
-typedef uint32_t Elf64_Word;
-typedef int32_t Elf64_Sword;
-typedef uint64_t Elf64_Xword;
-typedef int64_t Elf64_Sxword;
+using Elf32_Addr = uint32_t; // Program address
+using Elf32_Off = uint32_t;  // File offset
+using Elf32_Half = uint16_t;
+using Elf32_Word = uint32_t;
+using Elf32_Sword = int32_t;
+
+using Elf64_Addr = uint64_t;
+using Elf64_Off = uint64_t;
+using Elf64_Half = uint16_t;
+using Elf64_Word = uint32_t;
+using Elf64_Sword = int32_t;
+using Elf64_Xword = uint64_t;
+using Elf64_Sxword = int64_t;
 
 // Object file magic string.
 static const char ElfMagic[] = {0x7f, 'E', 'L', 'F', '\0'};
@@ -75,9 +73,11 @@ struct Elf32_Ehdr {
   Elf32_Half e_shentsize; // Size of an entry in the section header table
   Elf32_Half e_shnum;     // Number of entries in the section header table
   Elf32_Half e_shstrndx;  // Sect hdr table index of sect name string table
+
   bool checkMagic() const {
     return (memcmp(e_ident, ElfMagic, strlen(ElfMagic))) == 0;
   }
+
   unsigned char getFileClass() const { return e_ident[EI_CLASS]; }
   unsigned char getDataEncoding() const { return e_ident[EI_DATA]; }
 };
@@ -99,9 +99,11 @@ struct Elf64_Ehdr {
   Elf64_Half e_shentsize;
   Elf64_Half e_shnum;
   Elf64_Half e_shstrndx;
+
   bool checkMagic() const {
     return (memcmp(e_ident, ElfMagic, strlen(ElfMagic))) == 0;
   }
+
   unsigned char getFileClass() const { return e_ident[EI_CLASS]; }
   unsigned char getDataEncoding() const { return e_ident[EI_DATA]; }
 };
@@ -1357,7 +1359,6 @@ enum {
 };
 
 } // end namespace ELF
-
 } // end namespace llvm
 
-#endif
+#endif // LLVM_BINARYFORMAT_ELF_H

Modified: llvm/trunk/include/llvm/Option/Arg.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Option/Arg.h?rev=305537&r1=305536&r2=305537&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Option/Arg.h (original)
+++ llvm/trunk/include/llvm/Option/Arg.h Thu Jun 15 19:43:26 2017
@@ -1,4 +1,4 @@
-//===--- Arg.h - Parsed Argument Classes ------------------------*- C++ -*-===//
+//===- Arg.h - Parsed Argument Classes --------------------------*- C++ -*-===//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -21,7 +21,11 @@
 #include <string>
 
 namespace llvm {
+
+class raw_ostream;
+
 namespace opt {
+
 class ArgList;
 
 /// \brief A concrete instance of a particular driver option.
@@ -29,9 +33,6 @@ class ArgList;
 /// The Arg class encodes just enough information to be able to
 /// derive the argument values efficiently.
 class Arg {
-  Arg(const Arg &) = delete;
-  void operator=(const Arg &) = delete;
-
 private:
   /// \brief The option this argument is an instance of.
   const Option Opt;
@@ -65,6 +66,8 @@ public:
       const char *Value0, const Arg *BaseArg = nullptr);
   Arg(const Option Opt, StringRef Spelling, unsigned Index,
       const char *Value0, const char *Value1, const Arg *BaseArg = nullptr);
+  Arg(const Arg &) = delete;
+  Arg &operator=(const Arg &) = delete;
   ~Arg();
 
   const Option &getOption() const { return Opt; }
@@ -89,6 +92,7 @@ public:
   void claim() const { getBaseArg().Claimed = true; }
 
   unsigned getNumValues() const { return Values.size(); }
+
   const char *getValue(unsigned N = 0) const {
     return Values[N];
   }
@@ -122,6 +126,7 @@ public:
 };
 
 } // end namespace opt
+
 } // end namespace llvm
 
-#endif
+#endif // LLVM_OPTION_ARG_H

Modified: llvm/trunk/include/llvm/Option/ArgList.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Option/ArgList.h?rev=305537&r1=305536&r2=305537&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Option/ArgList.h (original)
+++ llvm/trunk/include/llvm/Option/ArgList.h Thu Jun 15 19:43:26 2017
@@ -1,4 +1,4 @@
-//===--- ArgList.h - Argument List Management -------------------*- C++ -*-===//
+//===- ArgList.h - Argument List Management ---------------------*- C++ -*-===//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -10,7 +10,9 @@
 #ifndef LLVM_OPTION_ARGLIST_H
 #define LLVM_OPTION_ARGLIST_H
 
+#include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/DenseMap.h"
+#include "llvm/ADT/iterator_range.h"
 #include "llvm/ADT/SmallString.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/StringRef.h"
@@ -18,15 +20,21 @@
 #include "llvm/Option/Arg.h"
 #include "llvm/Option/OptSpecifier.h"
 #include "llvm/Option/Option.h"
+#include <algorithm>
+#include <cstddef>
+#include <initializer_list>
+#include <iterator>
 #include <list>
 #include <memory>
 #include <string>
+#include <utility>
 #include <vector>
 
 namespace llvm {
+
+class raw_ostream;
+
 namespace opt {
-class ArgList;
-class Option;
 
 /// arg_iterator - Iterates through arguments stored inside an ArgList.
 template<typename BaseIter, unsigned NumOptSpecifiers = 0>
@@ -59,14 +67,14 @@ class arg_iterator {
     }
   }
 
-  typedef std::iterator_traits<BaseIter> Traits;
+  using Traits = std::iterator_traits<BaseIter>;
 
 public:
-  typedef typename Traits::value_type  value_type;
-  typedef typename Traits::reference   reference;
-  typedef typename Traits::pointer     pointer;
-  typedef std::forward_iterator_tag    iterator_category;
-  typedef std::ptrdiff_t               difference_type;
+  using value_type = typename Traits::value_type;
+  using reference = typename Traits::reference;
+  using pointer = typename Traits::pointer;
+  using iterator_category = std::forward_iterator_tag;
+  using difference_type = std::ptrdiff_t;
 
   arg_iterator(
       BaseIter Current, BaseIter End,
@@ -111,12 +119,12 @@ public:
 /// and to iterate over groups of arguments.
 class ArgList {
 public:
-  typedef SmallVector<Arg*, 16> arglist_type;
-  typedef arg_iterator<arglist_type::iterator> iterator;
-  typedef arg_iterator<arglist_type::const_iterator> const_iterator;
-  typedef arg_iterator<arglist_type::reverse_iterator> reverse_iterator;
-  typedef arg_iterator<arglist_type::const_reverse_iterator>
-      const_reverse_iterator;
+  using arglist_type = SmallVector<Arg *, 16>;
+  using iterator = arg_iterator<arglist_type::iterator>;
+  using const_iterator = arg_iterator<arglist_type::const_iterator>;
+  using reverse_iterator = arg_iterator<arglist_type::reverse_iterator>;
+  using const_reverse_iterator =
+      arg_iterator<arglist_type::const_reverse_iterator>;
 
   template<unsigned N> using filtered_iterator =
       arg_iterator<arglist_type::const_iterator, N>;
@@ -127,7 +135,7 @@ private:
   /// The internal list of arguments.
   arglist_type Args;
 
-  typedef std::pair<unsigned, unsigned> OptRange;
+  using OptRange = std::pair<unsigned, unsigned>;
   static OptRange emptyRange() { return {-1u, 0u}; }
 
   /// The first and last index of each different OptSpecifier ID.
@@ -142,6 +150,7 @@ protected:
   // derived objects, but can still be used by derived objects to implement
   // their own special members.
   ArgList() = default;
+
   // Explicit move operations to ensure the container is cleared post-move
   // otherwise it could lead to a double-delete in the case of moving of an
   // InputArgList which deletes the contents of the container. If we could fix
@@ -152,6 +161,7 @@ protected:
     RHS.Args.clear();
     RHS.OptRanges.clear();
   }
+
   ArgList &operator=(ArgList &&RHS) {
     Args = std::move(RHS.Args);
     RHS.Args.clear();
@@ -159,6 +169,7 @@ protected:
     RHS.OptRanges.clear();
     return *this;
   }
+
   // Protect the dtor to ensure this type is never destroyed polymorphically.
   ~ArgList() = default;
 
@@ -380,10 +391,12 @@ private:
 
 public:
   InputArgList(const char* const *ArgBegin, const char* const *ArgEnd);
+
   InputArgList(InputArgList &&RHS)
       : ArgList(std::move(RHS)), ArgStrings(std::move(RHS.ArgStrings)),
         SynthesizedStrings(std::move(RHS.SynthesizedStrings)),
         NumInputArgStrings(RHS.NumInputArgStrings) {}
+
   InputArgList &operator=(InputArgList &&RHS) {
     releaseMemory();
     ArgList::operator=(std::move(RHS));
@@ -392,6 +405,7 @@ public:
     NumInputArgStrings = RHS.NumInputArgStrings;
     return *this;
   }
+
   ~InputArgList() { releaseMemory(); }
 
   const char *getArgString(unsigned Index) const override {
@@ -464,7 +478,6 @@ public:
     append(MakePositionalArg(BaseArg, Opt, Value));
   }
 
-
   /// AddSeparateArg - Construct a new Positional arg for the given option
   /// \p Id, with the provided \p Value and append it to the argument
   /// list.
@@ -473,7 +486,6 @@ public:
     append(MakeSeparateArg(BaseArg, Opt, Value));
   }
 
-
   /// AddJoinedArg - Construct a new Positional arg for the given option
   /// \p Id, with the provided \p Value and append it to the argument list.
   void AddJoinedArg(const Arg *BaseArg, const Option Opt,
@@ -481,7 +493,6 @@ public:
     append(MakeJoinedArg(BaseArg, Opt, Value));
   }
 
-
   /// MakeFlagArg - Construct a new FlagArg for the given option \p Id.
   Arg *MakeFlagArg(const Arg *BaseArg, const Option Opt) const;
 
@@ -504,6 +515,7 @@ public:
 };
 
 } // end namespace opt
+
 } // end namespace llvm
 
-#endif
+#endif // LLVM_OPTION_ARGLIST_H

Modified: llvm/trunk/include/llvm/Option/OptSpecifier.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Option/OptSpecifier.h?rev=305537&r1=305536&r2=305537&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Option/OptSpecifier.h (original)
+++ llvm/trunk/include/llvm/Option/OptSpecifier.h Thu Jun 15 19:43:26 2017
@@ -1,4 +1,4 @@
-//===--- OptSpecifier.h - Option Specifiers ---------------------*- C++ -*-===//
+//===- OptSpecifier.h - Option Specifiers -----------------------*- C++ -*-===//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -10,32 +10,30 @@
 #ifndef LLVM_OPTION_OPTSPECIFIER_H
 #define LLVM_OPTION_OPTSPECIFIER_H
 
-#include "llvm/Support/Compiler.h"
-
 namespace llvm {
 namespace opt {
-  class Option;
 
-  /// OptSpecifier - Wrapper class for abstracting references to option IDs.
-  class OptSpecifier {
-    unsigned ID;
+class Option;
+
+/// OptSpecifier - Wrapper class for abstracting references to option IDs.
+class OptSpecifier {
+  unsigned ID = 0;
 
-  private:
-    explicit OptSpecifier(bool) = delete;
+public:
+  OptSpecifier() = default;
+  explicit OptSpecifier(bool) = delete;
+  /*implicit*/ OptSpecifier(unsigned ID) : ID(ID) {}
+  /*implicit*/ OptSpecifier(const Option *Opt);
 
-  public:
-    OptSpecifier() : ID(0) {}
-    /*implicit*/ OptSpecifier(unsigned ID) : ID(ID) {}
-    /*implicit*/ OptSpecifier(const Option *Opt);
+  bool isValid() const { return ID != 0; }
 
-    bool isValid() const { return ID != 0; }
+  unsigned getID() const { return ID; }
 
-    unsigned getID() const { return ID; }
+  bool operator==(OptSpecifier Opt) const { return ID == Opt.getID(); }
+  bool operator!=(OptSpecifier Opt) const { return !(*this == Opt); }
+};
 
-    bool operator==(OptSpecifier Opt) const { return ID == Opt.getID(); }
-    bool operator!=(OptSpecifier Opt) const { return !(*this == Opt); }
-  };
-}
-}
+} // end namespace opt
+} // end namespace llvm
 
-#endif
+#endif // LLVM_OPTION_OPTSPECIFIER_H

Modified: llvm/trunk/include/llvm/Option/OptTable.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Option/OptTable.h?rev=305537&r1=305536&r2=305537&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Option/OptTable.h (original)
+++ llvm/trunk/include/llvm/Option/OptTable.h Thu Jun 15 19:43:26 2017
@@ -1,4 +1,4 @@
-//===--- OptTable.h - Option Table ------------------------------*- C++ -*-===//
+//===- OptTable.h - Option Table --------------------------------*- C++ -*-===//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -11,12 +11,19 @@
 #define LLVM_OPTION_OPTTABLE_H
 
 #include "llvm/ADT/ArrayRef.h"
+#include "llvm/ADT/StringRef.h"
 #include "llvm/ADT/StringSet.h"
 #include "llvm/Option/OptSpecifier.h"
+#include <cassert>
+#include <string>
+#include <vector>
 
 namespace llvm {
+
 class raw_ostream;
+
 namespace opt {
+
 class Arg;
 class ArgList;
 class InputArgList;
@@ -53,12 +60,12 @@ private:
   ArrayRef<Info> OptionInfos;
   bool IgnoreCase;
 
-  unsigned TheInputOptionID;
-  unsigned TheUnknownOptionID;
+  unsigned TheInputOptionID = 0;
+  unsigned TheUnknownOptionID = 0;
 
   /// The index of the first option which can be parsed (i.e., is not a
   /// special option like 'input' or 'unknown', and is not an option group).
-  unsigned FirstSearchableIndex;
+  unsigned FirstSearchableIndex = 0;
 
   /// The union of all option prefixes. If an argument does not begin with
   /// one of these, it is an input.
@@ -176,7 +183,9 @@ public:
   void PrintHelp(raw_ostream &OS, const char *Name,
                   const char *Title, bool ShowHidden = false) const;
 };
+
 } // end namespace opt
+
 } // end namespace llvm
 
-#endif
+#endif // LLVM_OPTION_OPTTABLE_H

Modified: llvm/trunk/include/llvm/Option/Option.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Option/Option.h?rev=305537&r1=305536&r2=305537&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Option/Option.h (original)
+++ llvm/trunk/include/llvm/Option/Option.h Thu Jun 15 19:43:26 2017
@@ -1,4 +1,4 @@
-//===--- Option.h - Abstract Driver Options ---------------------*- C++ -*-===//
+//===- Option.h - Abstract Driver Options -----------------------*- C++ -*-===//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -12,15 +12,23 @@
 
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/StringRef.h"
+#include "llvm/Option/OptSpecifier.h"
 #include "llvm/Option/OptTable.h"
 #include "llvm/Support/ErrorHandling.h"
+#include <cassert>
+#include <string>
 
 namespace llvm {
+
+class raw_ostream;
+
 namespace opt {
+
 class Arg;
 class ArgList;
+
 /// ArgStringList - Type used for constructing argv lists for subprocesses.
-typedef SmallVector<const char*, 16> ArgStringList;
+using ArgStringList = SmallVector<const char *, 16>;
 
 /// Base flags for all options. Custom flags may be added after.
 enum DriverFlag {
@@ -202,6 +210,7 @@ public:
 };
 
 } // end namespace opt
+
 } // end namespace llvm
 
-#endif
+#endif // LLVM_OPTION_OPTION_H

Modified: llvm/trunk/include/llvm/TableGen/Main.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/TableGen/Main.h?rev=305537&r1=305536&r2=305537&view=diff
==============================================================================
--- llvm/trunk/include/llvm/TableGen/Main.h (original)
+++ llvm/trunk/include/llvm/TableGen/Main.h Thu Jun 15 19:43:26 2017
@@ -16,13 +16,15 @@
 
 namespace llvm {
 
-class RecordKeeper;
 class raw_ostream;
+class RecordKeeper;
+
 /// \brief Perform the action using Records, and write output to OS.
 /// \returns true on error, false otherwise
-typedef bool TableGenMainFn(raw_ostream &OS, RecordKeeper &Records);
+using TableGenMainFn = bool (raw_ostream &OS, RecordKeeper &Records);
 
 int TableGenMain(char *argv0, TableGenMainFn *MainFn);
-}
 
-#endif
+} // end namespace llvm
+
+#endif // LLVM_TABLEGEN_MAIN_H

Modified: llvm/trunk/include/llvm/TableGen/Record.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/TableGen/Record.h?rev=305537&r1=305536&r2=305537&view=diff
==============================================================================
--- llvm/trunk/include/llvm/TableGen/Record.h (original)
+++ llvm/trunk/include/llvm/TableGen/Record.h Thu Jun 15 19:43:26 2017
@@ -38,11 +38,11 @@
 namespace llvm {
 
 class ListRecTy;
+struct MultiClass;
 class Record;
 class RecordKeeper;
 class RecordVal;
 class StringInit;
-struct MultiClass;
 
 //===----------------------------------------------------------------------===//
 //  Type Classes
@@ -90,7 +90,6 @@ inline raw_ostream &operator<<(raw_ostre
 }
 
 /// 'bit' - Represent a single bit
-///
 class BitRecTy : public RecTy {
   static BitRecTy Shared;
 
@@ -109,7 +108,6 @@ public:
 };
 
 /// 'bits<n>' - Represent a fixed number of bits
-///
 class BitsRecTy : public RecTy {
   unsigned Size;
 
@@ -130,7 +128,6 @@ public:
 };
 
 /// 'code' - Represent a code fragment
-///
 class CodeRecTy : public RecTy {
   static CodeRecTy Shared;
 
@@ -147,7 +144,6 @@ public:
 };
 
 /// 'int' - Represent an integer value of no particular size
-///
 class IntRecTy : public RecTy {
   static IntRecTy Shared;
 
@@ -166,7 +162,6 @@ public:
 };
 
 /// 'string' - Represent an string value
-///
 class StringRecTy : public RecTy {
   static StringRecTy Shared;
 
@@ -185,14 +180,13 @@ public:
 
 /// 'list<Ty>' - Represent a list of values, all of which must be of
 /// the specified type.
-///
 class ListRecTy : public RecTy {
+  friend ListRecTy *RecTy::getListTy();
+
   RecTy *Ty;
 
   explicit ListRecTy(RecTy *T) : RecTy(ListRecTyKind), Ty(T) {}
 
-  friend ListRecTy *RecTy::getListTy();
-
 public:
   static bool classof(const RecTy *RT) {
     return RT->getRecTyKind() == ListRecTyKind;
@@ -207,7 +201,6 @@ public:
 };
 
 /// 'dag' - Represent a dag fragment
-///
 class DagRecTy : public RecTy {
   static DagRecTy Shared;
 
@@ -225,14 +218,13 @@ public:
 
 /// '[classname]' - Represent an instance of a class, such as:
 /// (R32 X = EAX).
-///
 class RecordRecTy : public RecTy {
+  friend class Record;
+
   Record *Rec;
 
   explicit RecordRecTy(Record *R) : RecTy(RecordRecTyKind), Rec(R) {}
 
-  friend class Record;
-
 public:
   static bool classof(const RecTy *RT) {
     return RT->getRecTyKind() == RecordRecTyKind;
@@ -249,7 +241,6 @@ public:
 
 /// Find a common type that T1 and T2 convert to.
 /// Return 0 if no such type exists.
-///
 RecTy *resolveTypes(RecTy *T1, RecTy *T2);
 
 //===----------------------------------------------------------------------===//
@@ -341,7 +332,6 @@ public:
   /// selection operator.  Given an initializer, it selects the specified bits
   /// out, returning them as a new init of bits type.  If it is not legal to use
   /// the bit subscript operator on this initializer, return null.
-  ///
   virtual Init *convertInitializerBitRange(ArrayRef<unsigned> Bits) const {
     return nullptr;
   }
@@ -350,7 +340,6 @@ public:
   /// selection operator.  Given an initializer, it selects the specified list
   /// elements, returning them as a new init of list type.  If it is not legal
   /// to take a slice of this, return null.
-  ///
   virtual Init *convertInitListSlice(ArrayRef<unsigned> Elements) const {
     return nullptr;
   }
@@ -358,7 +347,6 @@ public:
   /// This method is used to implement the FieldInit class.
   /// Implementors of this method should return the type of the named field if
   /// they are of record type.
-  ///
   virtual RecTy *getFieldType(StringInit *FieldName) const {
     return nullptr;
   }
@@ -366,7 +354,6 @@ public:
   /// This method complements getFieldType to return the
   /// initializer for the specified field.  If getFieldType returns non-null
   /// this method should return non-null, otherwise it returns null.
-  ///
   virtual Init *getFieldInit(Record &R, const RecordVal *RV,
                              StringInit *FieldName) const {
     return nullptr;
@@ -376,7 +363,6 @@ public:
   /// variables which may not be defined at the time the expression is formed.
   /// If a value is set for the variable later, this method will be called on
   /// users of the value to allow the value to propagate out.
-  ///
   virtual Init *resolveReferences(Record &R, const RecordVal *RV) const {
     return const_cast<Init *>(this);
   }
@@ -400,7 +386,6 @@ inline raw_ostream &operator<<(raw_ostre
 
 /// This is the common super-class of types that have a specific,
 /// explicit, type.
-///
 class TypedInit : public Init {
   RecTy *Ty;
 
@@ -409,8 +394,8 @@ protected:
     : Init(K, Opc), Ty(T) {}
 
 public:
-  TypedInit(const TypedInit &Other) = delete;
-  TypedInit &operator=(const TypedInit &Other) = delete;
+  TypedInit(const TypedInit &) = delete;
+  TypedInit &operator=(const TypedInit &) = delete;
 
   static bool classof(const Init *I) {
     return I->getKind() >= IK_FirstTypedInit &&
@@ -438,13 +423,12 @@ public:
 };
 
 /// '?' - Represents an uninitialized value
-///
 class UnsetInit : public Init {
   UnsetInit() : Init(IK_UnsetInit) {}
 
 public:
   UnsetInit(const UnsetInit &) = delete;
-  UnsetInit &operator=(const UnsetInit &Other) = delete;
+  UnsetInit &operator=(const UnsetInit &) = delete;
 
   static bool classof(const Init *I) {
     return I->getKind() == IK_UnsetInit;
@@ -463,15 +447,14 @@ public:
 };
 
 /// 'true'/'false' - Represent a concrete initializer for a bit.
-///
 class BitInit : public Init {
   bool Value;
 
   explicit BitInit(bool V) : Init(IK_BitInit), Value(V) {}
 
 public:
-  BitInit(const BitInit &Other) = delete;
-  BitInit &operator=(BitInit &Other) = delete;
+  BitInit(const BitInit &) = delete;
+  BitInit &operator=(BitInit &) = delete;
 
   static bool classof(const Init *I) {
     return I->getKind() == IK_BitInit;
@@ -493,7 +476,6 @@ public:
 
 /// '{ a, b, c }' - Represents an initializer for a BitsRecTy value.
 /// It contains a vector of bits, whose size is determined by the type.
-///
 class BitsInit final : public TypedInit, public FoldingSetNode,
                        public TrailingObjects<BitsInit, Init *> {
   unsigned NumBits;
@@ -502,8 +484,8 @@ class BitsInit final : public TypedInit,
     : TypedInit(IK_BitsInit, BitsRecTy::get(N)), NumBits(N) {}
 
 public:
-  BitsInit(const BitsInit &Other) = delete;
-  BitsInit &operator=(const BitsInit &Other) = delete;
+  BitsInit(const BitsInit &) = delete;
+  BitsInit &operator=(const BitsInit &) = delete;
 
   // Do not use sized deallocation due to trailing objects.
   void operator delete(void *p) { ::operator delete(p); }
@@ -552,7 +534,6 @@ public:
 };
 
 /// '7' - Represent an initialization by a literal integer value.
-///
 class IntInit : public TypedInit {
   int64_t Value;
 
@@ -560,8 +541,8 @@ class IntInit : public TypedInit {
     : TypedInit(IK_IntInit, IntRecTy::get()), Value(V) {}
 
 public:
-  IntInit(const IntInit &Other) = delete;
-  IntInit &operator=(const IntInit &Other) = delete;
+  IntInit(const IntInit &) = delete;
+  IntInit &operator=(const IntInit &) = delete;
 
   static bool classof(const Init *I) {
     return I->getKind() == IK_IntInit;
@@ -590,7 +571,6 @@ public:
 };
 
 /// "foo" - Represent an initialization by a string value.
-///
 class StringInit : public TypedInit {
   StringRef Value;
 
@@ -598,8 +578,8 @@ class StringInit : public TypedInit {
       : TypedInit(IK_StringInit, StringRecTy::get()), Value(V) {}
 
 public:
-  StringInit(const StringInit &Other) = delete;
-  StringInit &operator=(const StringInit &Other) = delete;
+  StringInit(const StringInit &) = delete;
+  StringInit &operator=(const StringInit &) = delete;
 
   static bool classof(const Init *I) {
     return I->getKind() == IK_StringInit;
@@ -636,8 +616,8 @@ class CodeInit : public TypedInit {
         Value(V) {}
 
 public:
-  CodeInit(const StringInit &Other) = delete;
-  CodeInit &operator=(const StringInit &Other) = delete;
+  CodeInit(const StringInit &) = delete;
+  CodeInit &operator=(const StringInit &) = delete;
 
   static bool classof(const Init *I) {
     return I->getKind() == IK_CodeInit;
@@ -675,15 +655,15 @@ class ListInit final : public TypedInit,
   unsigned NumValues;
 
 public:
-  typedef Init *const *const_iterator;
+  using const_iterator = Init *const *;
 
 private:
   explicit ListInit(unsigned N, RecTy *EltTy)
     : TypedInit(IK_ListInit, ListRecTy::get(EltTy)), NumValues(N) {}
 
 public:
-  ListInit(const ListInit &Other) = delete;
-  ListInit &operator=(const ListInit &Other) = delete;
+  ListInit(const ListInit &) = delete;
+  ListInit &operator=(const ListInit &) = delete;
 
   // Do not use sized deallocation due to trailing objects.
   void operator delete(void *p) { ::operator delete(p); }
@@ -744,8 +724,8 @@ protected:
     : TypedInit(K, Type, Opc) {}
 
 public:
-  OpInit(const OpInit &Other) = delete;
-  OpInit &operator=(OpInit &Other) = delete;
+  OpInit(const OpInit &) = delete;
+  OpInit &operator=(OpInit &) = delete;
 
   static bool classof(const Init *I) {
     return I->getKind() >= IK_FirstOpInit &&
@@ -781,8 +761,8 @@ private:
     : OpInit(IK_UnOpInit, Type, opc), LHS(lhs) {}
 
 public:
-  UnOpInit(const UnOpInit &Other) = delete;
-  UnOpInit &operator=(const UnOpInit &Other) = delete;
+  UnOpInit(const UnOpInit &) = delete;
+  UnOpInit &operator=(const UnOpInit &) = delete;
 
   static bool classof(const Init *I) {
     return I->getKind() == IK_UnOpInit;
@@ -819,7 +799,6 @@ public:
 };
 
 /// !op (X, Y) - Combine two inits.
-///
 class BinOpInit : public OpInit, public FoldingSetNode {
 public:
   enum BinaryOp : uint8_t { ADD, AND, OR, SHL, SRA, SRL, LISTCONCAT,
@@ -832,8 +811,8 @@ private:
       OpInit(IK_BinOpInit, Type, opc), LHS(lhs), RHS(rhs) {}
 
 public:
-  BinOpInit(const BinOpInit &Other) = delete;
-  BinOpInit &operator=(const BinOpInit &Other) = delete;
+  BinOpInit(const BinOpInit &) = delete;
+  BinOpInit &operator=(const BinOpInit &) = delete;
 
   static bool classof(const Init *I) {
     return I->getKind() == IK_BinOpInit;
@@ -874,7 +853,6 @@ public:
 };
 
 /// !op (X, Y, Z) - Combine two inits.
-///
 class TernOpInit : public OpInit, public FoldingSetNode {
 public:
   enum TernaryOp : uint8_t { SUBST, FOREACH, IF };
@@ -887,8 +865,8 @@ private:
       OpInit(IK_TernOpInit, Type, opc), LHS(lhs), MHS(mhs), RHS(rhs) {}
 
 public:
-  TernOpInit(const TernOpInit &Other) = delete;
-  TernOpInit &operator=(const TernOpInit &Other) = delete;
+  TernOpInit(const TernOpInit &) = delete;
+  TernOpInit &operator=(const TernOpInit &) = delete;
 
   static bool classof(const Init *I) {
     return I->getKind() == IK_TernOpInit;
@@ -935,7 +913,6 @@ public:
 };
 
 /// 'Opcode' - Represent a reference to an entire variable object.
-///
 class VarInit : public TypedInit {
   Init *VarName;
 
@@ -943,8 +920,8 @@ class VarInit : public TypedInit {
       : TypedInit(IK_VarInit, T), VarName(VN) {}
 
 public:
-  VarInit(const VarInit &Other) = delete;
-  VarInit &operator=(const VarInit &Other) = delete;
+  VarInit(const VarInit &) = delete;
+  VarInit &operator=(const VarInit &) = delete;
 
   static bool classof(const Init *I) {
     return I->getKind() == IK_VarInit;
@@ -980,7 +957,6 @@ public:
 };
 
 /// Opcode{0} - Represent access to one bit of a variable or field.
-///
 class VarBitInit : public Init {
   TypedInit *TI;
   unsigned Bit;
@@ -994,8 +970,8 @@ class VarBitInit : public Init {
   }
 
 public:
-  VarBitInit(const VarBitInit &Other) = delete;
-  VarBitInit &operator=(const VarBitInit &Other) = delete;
+  VarBitInit(const VarBitInit &) = delete;
+  VarBitInit &operator=(const VarBitInit &) = delete;
 
   static bool classof(const Init *I) {
     return I->getKind() == IK_VarBitInit;
@@ -1032,8 +1008,8 @@ class VarListElementInit : public TypedI
   }
 
 public:
-  VarListElementInit(const VarListElementInit &Other) = delete;
-  void operator=(const VarListElementInit &Other) = delete;
+  VarListElementInit(const VarListElementInit &) = delete;
+  VarListElementInit &operator=(const VarListElementInit &) = delete;
 
   static bool classof(const Init *I) {
     return I->getKind() == IK_VarListElementInit;
@@ -1057,17 +1033,16 @@ public:
 };
 
 /// AL - Represent a reference to a 'def' in the description
-///
 class DefInit : public TypedInit {
+  friend class Record;
+
   Record *Def;
 
   DefInit(Record *D, RecordRecTy *T) : TypedInit(IK_DefInit, T), Def(D) {}
 
-  friend class Record;
-
 public:
-  DefInit(const DefInit &Other) = delete;
-  DefInit &operator=(const DefInit &Other) = delete;
+  DefInit(const DefInit &) = delete;
+  DefInit &operator=(const DefInit &) = delete;
 
   static bool classof(const Init *I) {
     return I->getKind() == IK_DefInit;
@@ -1101,7 +1076,6 @@ public:
 };
 
 /// X.Y - Represent a reference to a subfield of a variable
-///
 class FieldInit : public TypedInit {
   Init *Rec;                // Record we are referring to
   StringInit *FieldName;    // Field we are accessing
@@ -1112,8 +1086,8 @@ class FieldInit : public TypedInit {
   }
 
 public:
-  FieldInit(const FieldInit &Other) = delete;
-  FieldInit &operator=(const FieldInit &Other) = delete;
+  FieldInit(const FieldInit &) = delete;
+  FieldInit &operator=(const FieldInit &) = delete;
 
   static bool classof(const Init *I) {
     return I->getKind() == IK_FieldInit;
@@ -1136,9 +1110,10 @@ public:
 /// (v a, b) - Represent a DAG tree value.  DAG inits are required
 /// to have at least one value then a (possibly empty) list of arguments.  Each
 /// argument can have a name associated with it.
-///
 class DagInit final : public TypedInit, public FoldingSetNode,
                       public TrailingObjects<DagInit, Init *, StringInit *> {
+  friend TrailingObjects;
+
   Init *Val;
   StringInit *ValName;
   unsigned NumArgs;
@@ -1148,12 +1123,11 @@ class DagInit final : public TypedInit,
       : TypedInit(IK_DagInit, DagRecTy::get()), Val(V), ValName(VN),
         NumArgs(NumArgs), NumArgNames(NumArgNames) {}
 
-  friend TrailingObjects;
   size_t numTrailingObjects(OverloadToken<Init *>) const { return NumArgs; }
 
 public:
-  DagInit(const DagInit &Other) = delete;
-  DagInit &operator=(const DagInit &Other) = delete;
+  DagInit(const DagInit &) = delete;
+  DagInit &operator=(const DagInit &) = delete;
 
   static bool classof(const Init *I) {
     return I->getKind() == IK_DagInit;
@@ -1171,19 +1145,23 @@ public:
   Init *getOperator() const { return Val; }
 
   StringInit *getName() const { return ValName; }
+
   StringRef getNameStr() const {
     return ValName ? ValName->getValue() : StringRef();
   }
 
   unsigned getNumArgs() const { return NumArgs; }
+
   Init *getArg(unsigned Num) const {
     assert(Num < NumArgs && "Arg number out of range!");
     return getTrailingObjects<Init *>()[Num];
   }
+
   StringInit *getArgName(unsigned Num) const {
     assert(Num < NumArgNames && "Arg number out of range!");
     return getTrailingObjects<StringInit *>()[Num];
   }
+
   StringRef getArgNameStr(unsigned Num) const {
     StringInit *Init = getArgName(Num);
     return Init ? Init->getValue() : StringRef();
@@ -1192,6 +1170,7 @@ public:
   ArrayRef<Init *> getArgs() const {
     return makeArrayRef(getTrailingObjects<Init *>(), NumArgs);
   }
+
   ArrayRef<StringInit *> getArgNames() const {
     return makeArrayRef(getTrailingObjects<StringInit *>(), NumArgNames);
   }
@@ -1200,8 +1179,8 @@ public:
 
   std::string getAsString() const override;
 
-  typedef SmallVectorImpl<Init*>::const_iterator       const_arg_iterator;
-  typedef SmallVectorImpl<StringInit*>::const_iterator const_name_iterator;
+  using const_arg_iterator = SmallVectorImpl<Init*>::const_iterator;
+  using const_name_iterator = SmallVectorImpl<StringInit*>::const_iterator;
 
   inline const_arg_iterator  arg_begin() const { return getArgs().begin(); }
   inline const_arg_iterator  arg_end  () const { return getArgs().end(); }
@@ -1231,6 +1210,7 @@ public:
 
 class RecordVal {
   friend class Record;
+
   Init *Name;
   PointerIntPair<RecTy *, 1, bool> TyAndPrefix;
   Init *Value;
@@ -1298,7 +1278,7 @@ class Record {
   // definitions that use them (e.g. Def).  However, inside a multiclass they
   // can't be immediately resolved so we mark them ResolveFirst to fully
   // resolve them later as soon as the multiclass is instantiated.
-  bool ResolveFirst;
+  bool ResolveFirst = false;
 
   void init();
   void checkName();
@@ -1308,7 +1288,7 @@ public:
   explicit Record(Init *N, ArrayRef<SMLoc> locs, RecordKeeper &records,
                   bool Anonymous = false) :
     Name(N), Locs(locs.begin(), locs.end()), TrackedRecords(records),
-    ID(LastID++), IsAnonymous(Anonymous), ResolveFirst(false) {
+    ID(LastID++), IsAnonymous(Anonymous) {
     init();
   }
 
@@ -1330,6 +1310,7 @@ public:
   unsigned getID() const { return ID; }
 
   StringRef getName() const;
+
   Init *getNameInit() const {
     return Name;
   }
@@ -1435,7 +1416,6 @@ public:
 
   /// If there are any field references that refer to fields
   /// that have been filled in, we can propagate the values now.
-  ///
   void resolveReferences() { resolveReferencesTo(nullptr); }
 
   /// If anything in this record refers to RV, replace the
@@ -1468,7 +1448,6 @@ public:
 
   /// Return the initializer for a value with the specified name,
   /// or throw an exception if the field does not exist.
-  ///
   Init *getValueInit(StringRef FieldName) const;
 
   /// Return true if the named field is unset.
@@ -1479,67 +1458,56 @@ public:
   /// This method looks up the specified field and returns
   /// its value as a string, throwing an exception if the field does not exist
   /// or if the value is not a string.
-  ///
   StringRef getValueAsString(StringRef FieldName) const;
 
   /// This method looks up the specified field and returns
   /// its value as a BitsInit, throwing an exception if the field does not exist
   /// or if the value is not the right type.
-  ///
   BitsInit *getValueAsBitsInit(StringRef FieldName) const;
 
   /// This method looks up the specified field and returns
   /// its value as a ListInit, throwing an exception if the field does not exist
   /// or if the value is not the right type.
-  ///
   ListInit *getValueAsListInit(StringRef FieldName) const;
 
   /// This method looks up the specified field and
   /// returns its value as a vector of records, throwing an exception if the
   /// field does not exist or if the value is not the right type.
-  ///
   std::vector<Record*> getValueAsListOfDefs(StringRef FieldName) const;
 
   /// This method looks up the specified field and
   /// returns its value as a vector of integers, throwing an exception if the
   /// field does not exist or if the value is not the right type.
-  ///
   std::vector<int64_t> getValueAsListOfInts(StringRef FieldName) const;
 
   /// This method looks up the specified field and
   /// returns its value as a vector of strings, throwing an exception if the
   /// field does not exist or if the value is not the right type.
-  ///
   std::vector<StringRef> getValueAsListOfStrings(StringRef FieldName) const;
 
   /// This method looks up the specified field and returns its
   /// value as a Record, throwing an exception if the field does not exist or if
   /// the value is not the right type.
-  ///
   Record *getValueAsDef(StringRef FieldName) const;
 
   /// This method looks up the specified field and returns its
   /// value as a bit, throwing an exception if the field does not exist or if
   /// the value is not the right type.
-  ///
   bool getValueAsBit(StringRef FieldName) const;
 
   /// This method looks up the specified field and
   /// returns its value as a bit. If the field is unset, sets Unset to true and
   /// returns false.
-  ///
   bool getValueAsBitOrUnset(StringRef FieldName, bool &Unset) const;
 
   /// This method looks up the specified field and returns its
   /// value as an int64_t, throwing an exception if the field does not exist or
   /// if the value is not the right type.
-  ///
   int64_t getValueAsInt(StringRef FieldName) const;
 
   /// This method looks up the specified field and returns its
   /// value as an Dag, throwing an exception if the field does not exist or if
   /// the value is not the right type.
-  ///
   DagInit *getValueAsDag(StringRef FieldName) const;
 };
 
@@ -1547,7 +1515,7 @@ raw_ostream &operator<<(raw_ostream &OS,
 
 struct MultiClass {
   Record Rec;  // Placeholder for template args and Name.
-  typedef std::vector<std::unique_ptr<Record>> RecordVector;
+  using RecordVector = std::vector<std::unique_ptr<Record>>;
   RecordVector DefPrototypes;
 
   void dump() const;
@@ -1557,7 +1525,7 @@ struct MultiClass {
 };
 
 class RecordKeeper {
-  typedef std::map<std::string, std::unique_ptr<Record>> RecordMap;
+  using RecordMap = std::map<std::string, std::unique_ptr<Record>>;
   RecordMap Classes, Defs;
 
 public:
@@ -1600,7 +1568,6 @@ public:
 };
 
 /// Sorting predicate to sort record pointers by name.
-///
 struct LessRecord {
   bool operator()(const Record *Rec1, const Record *Rec2) const {
     return StringRef(Rec1->getName()).compare_numeric(Rec2->getName()) < 0;
@@ -1619,7 +1586,6 @@ struct LessRecordByID {
 
 /// Sorting predicate to sort record pointers by their
 /// name field.
-///
 struct LessRecordFieldName {
   bool operator()(const Record *Rec1, const Record *Rec2) const {
     return Rec1->getValueAsString("Name") < Rec2->getValueAsString("Name");

Modified: llvm/trunk/include/llvm/TableGen/SetTheory.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/TableGen/SetTheory.h?rev=305537&r1=305536&r2=305537&view=diff
==============================================================================
--- llvm/trunk/include/llvm/TableGen/SetTheory.h (original)
+++ llvm/trunk/include/llvm/TableGen/SetTheory.h Thu Jun 15 19:43:26 2017
@@ -64,8 +64,8 @@ class Record;
 
 class SetTheory {
 public:
-  typedef std::vector<Record*> RecVec;
-  typedef SmallSetVector<Record*, 16> RecSet;
+  using RecVec = std::vector<Record *>;
+  using RecSet = SmallSetVector<Record *, 16>;
 
   /// Operator - A callback representing a DAG operator.
   class Operator {
@@ -95,7 +95,7 @@ public:
 private:
   // Map set defs to their fully expanded contents. This serves as a memoization
   // cache and it makes it possible to return const references on queries.
-  typedef std::map<Record*, RecVec> ExpandMap;
+  using ExpandMap = std::map<Record *, RecVec>;
   ExpandMap Expansions;
 
   // Known DAG operators by name.

Modified: llvm/trunk/include/llvm/TableGen/StringMatcher.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/TableGen/StringMatcher.h?rev=305537&r1=305536&r2=305537&view=diff
==============================================================================
--- llvm/trunk/include/llvm/TableGen/StringMatcher.h (original)
+++ llvm/trunk/include/llvm/TableGen/StringMatcher.h Thu Jun 15 19:43:26 2017
@@ -20,7 +20,8 @@
 #include <vector>
 
 namespace llvm {
-  class raw_ostream;
+
+class raw_ostream;
 
 /// StringMatcher - Given a list of strings and code to execute when they match,
 /// output a simple switch tree to classify the input string.
@@ -30,7 +31,7 @@ namespace llvm {
 ///
 class StringMatcher {
 public:
-  typedef std::pair<std::string, std::string> StringPair;
+  using StringPair = std::pair<std::string, std::string>;
 
 private:
   StringRef StrVariableName;
@@ -49,6 +50,6 @@ private:
                                 unsigned CharNo, unsigned IndentCount) const;
 };
 
-} // end llvm namespace.
+} // end namespace llvm
 
-#endif
+#endif // LLVM_TABLEGEN_STRINGMATCHER_H

Modified: llvm/trunk/lib/Option/Arg.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Option/Arg.cpp?rev=305537&r1=305536&r2=305537&view=diff
==============================================================================
--- llvm/trunk/lib/Option/Arg.cpp (original)
+++ llvm/trunk/lib/Option/Arg.cpp Thu Jun 15 19:43:26 2017
@@ -1,4 +1,4 @@
-//===--- Arg.cpp - Argument Implementations -------------------------------===//
+//===- Arg.cpp - Argument Implementations ---------------------------------===//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -7,11 +7,11 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "llvm/Option/Arg.h"
 #include "llvm/ADT/SmallString.h"
-#include "llvm/ADT/Twine.h"
+#include "llvm/Option/Arg.h"
 #include "llvm/Option/ArgList.h"
 #include "llvm/Option/Option.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/raw_ostream.h"
 
@@ -67,7 +67,7 @@ LLVM_DUMP_METHOD void Arg::dump() const
 
 std::string Arg::getAsString(const ArgList &Args) const {
   SmallString<256> Res;
-  llvm::raw_svector_ostream OS(Res);
+  raw_svector_ostream OS(Res);
 
   ArgStringList ASL;
   render(Args, ASL);
@@ -98,7 +98,7 @@ void Arg::render(const ArgList &Args, Ar
 
   case Option::RenderCommaJoinedStyle: {
     SmallString<256> Res;
-    llvm::raw_svector_ostream OS(Res);
+    raw_svector_ostream OS(Res);
     OS << getSpelling();
     for (unsigned i = 0, e = getNumValues(); i != e; ++i) {
       if (i) OS << ',';

Modified: llvm/trunk/lib/Option/ArgList.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Option/ArgList.cpp?rev=305537&r1=305536&r2=305537&view=diff
==============================================================================
--- llvm/trunk/lib/Option/ArgList.cpp (original)
+++ llvm/trunk/lib/Option/ArgList.cpp Thu Jun 15 19:43:26 2017
@@ -1,4 +1,4 @@
-//===--- ArgList.cpp - Argument List Management ---------------------------===//
+//===- ArgList.cpp - Argument List Management -----------------------------===//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -7,14 +7,25 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "llvm/Option/ArgList.h"
+#include "llvm/ADT/ArrayRef.h"
+#include "llvm/ADT/None.h"
+#include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/STLExtras.h"
-#include "llvm/ADT/SmallString.h"
+#include "llvm/ADT/StringRef.h"
 #include "llvm/ADT/Twine.h"
 #include "llvm/Option/Arg.h"
+#include "llvm/Option/ArgList.h"
 #include "llvm/Option/Option.h"
+#include "llvm/Option/OptSpecifier.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/raw_ostream.h"
+#include <algorithm>
+#include <cassert>
+#include <memory>
+#include <string>
+#include <utility>
+#include <vector>
 
 using namespace llvm;
 using namespace llvm::opt;
@@ -197,8 +208,6 @@ void ArgList::print(raw_ostream &O) cons
 LLVM_DUMP_METHOD void ArgList::dump() const { print(dbgs()); }
 #endif
 
-//
-
 void InputArgList::releaseMemory() {
   // An InputArgList always owns its arguments.
   for (Arg *A : *this)
@@ -234,8 +243,6 @@ const char *InputArgList::MakeArgStringR
   return getArgString(MakeIndex(Str));
 }
 
-//
-
 DerivedArgList::DerivedArgList(const InputArgList &BaseArgs)
     : BaseArgs(BaseArgs) {}
 

Modified: llvm/trunk/lib/Option/OptTable.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Option/OptTable.cpp?rev=305537&r1=305536&r2=305537&view=diff
==============================================================================
--- llvm/trunk/lib/Option/OptTable.cpp (original)
+++ llvm/trunk/lib/Option/OptTable.cpp Thu Jun 15 19:43:26 2017
@@ -1,4 +1,4 @@
-//===--- OptTable.cpp - Option Table Implementation -----------------------===//
+//===- OptTable.cpp - Option Table Implementation -------------------------===//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -7,16 +7,25 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "llvm/Option/OptTable.h"
 #include "llvm/ADT/STLExtras.h"
+#include "llvm/ADT/StringRef.h"
+#include "llvm/ADT/StringSet.h"
 #include "llvm/Option/Arg.h"
 #include "llvm/Option/ArgList.h"
 #include "llvm/Option/Option.h"
+#include "llvm/Option/OptSpecifier.h"
+#include "llvm/Option/OptTable.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/raw_ostream.h"
 #include <algorithm>
+#include <cassert>
 #include <cctype>
+#include <cstring>
 #include <map>
+#include <string>
+#include <utility>
+#include <vector>
 
 using namespace llvm;
 using namespace llvm::opt;
@@ -80,14 +89,14 @@ static inline bool operator<(const OptTa
 static inline bool operator<(const OptTable::Info &I, const char *Name) {
   return StrCmpOptionNameIgnoreCase(I.Name, Name) < 0;
 }
-}
-}
+
+} // end namespace opt
+} // end namespace llvm
 
 OptSpecifier::OptSpecifier(const Option *Opt) : ID(Opt->getID()) {}
 
 OptTable::OptTable(ArrayRef<Info> OptionInfos, bool IgnoreCase)
-    : OptionInfos(OptionInfos), IgnoreCase(IgnoreCase), TheInputOptionID(0),
-      TheUnknownOptionID(0), FirstSearchableIndex(0) {
+    : OptionInfos(OptionInfos), IgnoreCase(IgnoreCase) {
   // Explicitly zero initialize the error to work around a bug in array
   // value-initialization on MinGW with gcc 4.3.5.
 
@@ -138,8 +147,8 @@ OptTable::OptTable(ArrayRef<Info> Option
   }
 
   // Build prefix chars.
-  for (llvm::StringSet<>::const_iterator I = PrefixesUnion.begin(),
-                                         E = PrefixesUnion.end(); I != E; ++I) {
+  for (StringSet<>::const_iterator I = PrefixesUnion.begin(),
+                                   E = PrefixesUnion.end(); I != E; ++I) {
     StringRef Prefix = I->getKey();
     for (StringRef::const_iterator C = Prefix.begin(), CE = Prefix.end();
                                    C != CE; ++C)
@@ -148,8 +157,7 @@ OptTable::OptTable(ArrayRef<Info> Option
   }
 }
 
-OptTable::~OptTable() {
-}
+OptTable::~OptTable() = default;
 
 const Option OptTable::getOption(OptSpecifier Opt) const {
   unsigned id = Opt.getID();
@@ -159,11 +167,11 @@ const Option OptTable::getOption(OptSpec
   return Option(&getInfo(id), this);
 }
 
-static bool isInput(const llvm::StringSet<> &Prefixes, StringRef Arg) {
+static bool isInput(const StringSet<> &Prefixes, StringRef Arg) {
   if (Arg == "-")
     return true;
-  for (llvm::StringSet<>::const_iterator I = Prefixes.begin(),
-                                         E = Prefixes.end(); I != E; ++I)
+  for (StringSet<>::const_iterator I = Prefixes.begin(),
+                                   E = Prefixes.end(); I != E; ++I)
     if (Arg.startswith(I->getKey()))
       return false;
   return true;
@@ -346,7 +354,7 @@ static std::string getOptionHelpName(con
 
 static void PrintHelpOptionList(raw_ostream &OS, StringRef Title,
                                 std::vector<std::pair<std::string,
-                                const char*> > &OptionHelp) {
+                                const char*>> &OptionHelp) {
   OS << Title << ":\n";
 
   // Find the maximum option length.
@@ -412,8 +420,8 @@ void OptTable::PrintHelp(raw_ostream &OS
 
   // Render help text into a map of group-name to a list of (option, help)
   // pairs.
-  typedef std::map<std::string,
-                 std::vector<std::pair<std::string, const char*> > > helpmap_ty;
+  using helpmap_ty =
+      std::map<std::string, std::vector<std::pair<std::string, const char*>>>;
   helpmap_ty GroupedOptionHelp;
 
   for (unsigned i = 0, e = getNumOptions(); i != e; ++i) {

Modified: llvm/trunk/lib/Option/Option.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Option/Option.cpp?rev=305537&r1=305536&r2=305537&view=diff
==============================================================================
--- llvm/trunk/lib/Option/Option.cpp (original)
+++ llvm/trunk/lib/Option/Option.cpp Thu Jun 15 19:43:26 2017
@@ -1,4 +1,4 @@
-//===--- Option.cpp - Abstract Driver Options -----------------------------===//
+//===- Option.cpp - Abstract Driver Options -------------------------------===//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -7,22 +7,24 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "llvm/Option/Option.h"
+#include "llvm/ADT/StringRef.h"
 #include "llvm/ADT/Twine.h"
 #include "llvm/Option/Arg.h"
 #include "llvm/Option/ArgList.h"
+#include "llvm/Option/Option.h"
+#include "llvm/Option/OptTable.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/raw_ostream.h"
-#include <algorithm>
 #include <cassert>
+#include <cstring>
 
 using namespace llvm;
 using namespace llvm::opt;
 
 Option::Option(const OptTable::Info *info, const OptTable *owner)
   : Info(info), Owner(owner) {
-
   // Multi-level aliases are not supported. This just simplifies option
   // tracking, it is not an inherent limitation.
   assert((!Info || !getAlias().isValid() || !getAlias().getAlias().isValid()) &&

Modified: llvm/trunk/lib/TableGen/Record.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/TableGen/Record.cpp?rev=305537&r1=305536&r2=305537&view=diff
==============================================================================
--- llvm/trunk/lib/TableGen/Record.cpp (original)
+++ llvm/trunk/lib/TableGen/Record.cpp Thu Jun 15 19:43:26 2017
@@ -11,20 +11,28 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "llvm/TableGen/Record.h"
+#include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/FoldingSet.h"
-#include "llvm/ADT/Hashing.h"
 #include "llvm/ADT/SmallString.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/StringExtras.h"
 #include "llvm/ADT/StringMap.h"
+#include "llvm/ADT/StringRef.h"
+#include "llvm/Support/Allocator.h"
+#include "llvm/Support/Casting.h"
 #include "llvm/Support/Compiler.h"
 #include "llvm/Support/ErrorHandling.h"
+#include "llvm/Support/SMLoc.h"
+#include "llvm/Support/raw_ostream.h"
 #include "llvm/TableGen/Error.h"
+#include "llvm/TableGen/Record.h"
 #include <cassert>
 #include <cstdint>
-#include <new>
+#include <memory>
+#include <string>
+#include <utility>
+#include <vector>
 
 using namespace llvm;
 
@@ -162,7 +170,8 @@ RecTy *llvm::resolveTypes(RecTy *T1, Rec
 //    Initializer implementations
 //===----------------------------------------------------------------------===//
 
-void Init::anchor() { }
+void Init::anchor() {}
+
 #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
 LLVM_DUMP_METHOD void Init::dump() const { return print(errs()); }
 #endif
@@ -301,7 +310,6 @@ static Init *fixBitInit(const RecordVal
 
 // resolveReferences - If there are any field references that refer to fields
 // that have been filled in, we can propagate the values now.
-//
 Init *BitsInit::resolveReferences(Record &R, const RecordVal *RV) const {
   bool Changed = false;
   SmallVector<Init *, 16> NewBits(getNumBits());
@@ -615,7 +623,7 @@ void UnOpInit::Profile(FoldingSetNodeID
 
 Init *UnOpInit::Fold(Record *CurRec, MultiClass *CurMultiClass) const {
   switch (getOpcode()) {
-  case CAST: {
+  case CAST:
     if (isa<StringRecTy>(getType())) {
       if (StringInit *LHSs = dyn_cast<StringInit>(LHS))
         return LHSs;
@@ -680,15 +688,15 @@ Init *UnOpInit::Fold(Record *CurRec, Mul
       }
     }
     break;
-  }
-  case HEAD: {
+
+  case HEAD:
     if (ListInit *LHSl = dyn_cast<ListInit>(LHS)) {
       assert(!LHSl->empty() && "Empty list in head");
       return LHSl->getElement(0);
     }
     break;
-  }
-  case TAIL: {
+
+  case TAIL:
     if (ListInit *LHSl = dyn_cast<ListInit>(LHS)) {
       assert(!LHSl->empty() && "Empty list in tail");
       // Note the +1.  We can't just pass the result of getValues()
@@ -696,16 +704,14 @@ Init *UnOpInit::Fold(Record *CurRec, Mul
       return ListInit::get(LHSl->getValues().slice(1), LHSl->getType());
     }
     break;
-  }
-  case EMPTY: {
+
+  case EMPTY:
     if (ListInit *LHSl = dyn_cast<ListInit>(LHS))
       return IntInit::get(LHSl->empty());
     if (StringInit *LHSs = dyn_cast<StringInit>(LHS))
       return IntInit::get(LHSs->getValue().empty());
-
     break;
   }
-  }
   return const_cast<UnOpInit *>(this);
 }
 
@@ -948,7 +954,6 @@ static Init *EvaluateOperation(OpInit *R
 
 static Init *ForeachHelper(Init *LHS, Init *MHS, Init *RHS, RecTy *Type,
                            Record *CurRec, MultiClass *CurMultiClass) {
-
   OpInit *RHSo = dyn_cast<OpInit>(RHS);
 
   if (!RHSo)
@@ -1245,7 +1250,7 @@ VarInit *VarInit::get(StringRef VN, RecT
 }
 
 VarInit *VarInit::get(Init *VN, RecTy *T) {
-  typedef std::pair<RecTy *, Init *> Key;
+  using Key = std::pair<RecTy *, Init *>;
   static DenseMap<Key, VarInit*> ThePool;
 
   Key TheKey(std::make_pair(T, VN));
@@ -1320,7 +1325,7 @@ Init *VarInit::resolveReferences(Record
 }
 
 VarBitInit *VarBitInit::get(TypedInit *T, unsigned B) {
-  typedef std::pair<TypedInit *, unsigned> Key;
+  using Key = std::pair<TypedInit *, unsigned>;
   static DenseMap<Key, VarBitInit*> ThePool;
 
   Key TheKey(std::make_pair(T, B));
@@ -1352,7 +1357,7 @@ Init *VarBitInit::resolveReferences(Reco
 
 VarListElementInit *VarListElementInit::get(TypedInit *T,
                                             unsigned E) {
-  typedef std::pair<TypedInit *, unsigned> Key;
+  using Key = std::pair<TypedInit *, unsigned>;
   static DenseMap<Key, VarListElementInit*> ThePool;
 
   Key TheKey(std::make_pair(T, E));
@@ -1422,7 +1427,7 @@ std::string DefInit::getAsString() const
 }
 
 FieldInit *FieldInit::get(Init *R, StringInit *FN) {
-  typedef std::pair<Init *, StringInit *> Key;
+  using Key = std::pair<Init *, StringInit *>;
   static DenseMap<Key, FieldInit*> ThePool;
 
   Key TheKey(std::make_pair(R, FN));

Modified: llvm/trunk/lib/TableGen/SetTheory.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/TableGen/SetTheory.cpp?rev=305537&r1=305536&r2=305537&view=diff
==============================================================================
--- llvm/trunk/lib/TableGen/SetTheory.cpp (original)
+++ llvm/trunk/lib/TableGen/SetTheory.cpp Thu Jun 15 19:43:26 2017
@@ -12,18 +12,29 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "llvm/TableGen/SetTheory.h"
+#include "llvm/ADT/ArrayRef.h"
+#include "llvm/ADT/SmallVector.h"
+#include "llvm/ADT/STLExtras.h"
+#include "llvm/ADT/StringRef.h"
+#include "llvm/Support/Casting.h"
 #include "llvm/Support/Format.h"
+#include "llvm/Support/SMLoc.h"
+#include "llvm/Support/raw_ostream.h"
 #include "llvm/TableGen/Error.h"
 #include "llvm/TableGen/Record.h"
+#include "llvm/TableGen/SetTheory.h"
+#include <algorithm>
+#include <cstdint>
+#include <string>
+#include <utility>
 
 using namespace llvm;
 
 // Define the standard operators.
 namespace {
 
-typedef SetTheory::RecSet RecSet;
-typedef SetTheory::RecVec RecVec;
+using RecSet = SetTheory::RecSet;
+using RecVec = SetTheory::RecVec;
 
 // (add a, b, ...) Evaluate and union all arguments.
 struct AddOp : public SetTheory::Operator {
@@ -237,13 +248,13 @@ struct FieldExpander : public SetTheory:
     ST.evaluate(Def->getValueInit(FieldName), Elts, Def->getLoc());
   }
 };
+
 } // end anonymous namespace
 
 // Pin the vtables to this file.
 void SetTheory::Operator::anchor() {}
 void SetTheory::Expander::anchor() {}
 
-
 SetTheory::SetTheory() {
   addOperator("add", llvm::make_unique<AddOp>());
   addOperator("sub", llvm::make_unique<SubOp>());
@@ -321,4 +332,3 @@ const RecVec *SetTheory::expand(Record *
   // Set is not expandable.
   return nullptr;
 }
-




More information about the llvm-commits mailing list