[CodeGen] Fix some Clang-tidy modernize-use-default-member-init and Include What You Use warnings; other minor fixes (NFC).
llvm-svn: 314363
diff --git a/llvm/lib/CodeGen/MIRParser/MILexer.cpp b/llvm/lib/CodeGen/MIRParser/MILexer.cpp
index 25f4836..0ba346c 100644
--- a/llvm/lib/CodeGen/MIRParser/MILexer.cpp
+++ b/llvm/lib/CodeGen/MIRParser/MILexer.cpp
@@ -1,4 +1,4 @@
-//===- MILexer.cpp - Machine instructions lexer implementation ----------===//
+//===- MILexer.cpp - Machine instructions lexer implementation ------------===//
//
// The LLVM Compiler Infrastructure
//
@@ -12,27 +12,33 @@
//===----------------------------------------------------------------------===//
#include "MILexer.h"
+#include "llvm/ADT/APSInt.h"
#include "llvm/ADT/None.h"
+#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/StringSwitch.h"
+#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/Twine.h"
+#include <algorithm>
+#include <cassert>
#include <cctype>
+#include <string>
using namespace llvm;
namespace {
-typedef function_ref<void(StringRef::iterator Loc, const Twine &)>
- ErrorCallbackType;
+using ErrorCallbackType =
+ function_ref<void(StringRef::iterator Loc, const Twine &)>;
/// This class provides a way to iterate and get characters from the source
/// string.
class Cursor {
- const char *Ptr;
- const char *End;
+ const char *Ptr = nullptr;
+ const char *End = nullptr;
public:
- Cursor(NoneType) : Ptr(nullptr), End(nullptr) {}
+ Cursor(NoneType) {}
explicit Cursor(StringRef Str) {
Ptr = Str.data();
diff --git a/llvm/lib/CodeGen/MIRParser/MILexer.h b/llvm/lib/CodeGen/MIRParser/MILexer.h
index c203d2c..886916b 100644
--- a/llvm/lib/CodeGen/MIRParser/MILexer.h
+++ b/llvm/lib/CodeGen/MIRParser/MILexer.h
@@ -1,4 +1,4 @@
-//===- MILexer.h - Lexer for machine instructions -------------------------===//
+//===- MILexer.h - Lexer for machine instructions ---------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -18,7 +18,7 @@
#include "llvm/ADT/APSInt.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/StringRef.h"
-#include <functional>
+#include <string>
namespace llvm {
@@ -133,14 +133,14 @@
};
private:
- TokenKind Kind;
+ TokenKind Kind = Error;
StringRef Range;
StringRef StringValue;
std::string StringValueStorage;
APSInt IntVal;
public:
- MIToken() : Kind(Error) {}
+ MIToken() = default;
MIToken &reset(TokenKind Kind, StringRef Range);
@@ -204,4 +204,4 @@
} // end namespace llvm
-#endif
+#endif // LLVM_LIB_CODEGEN_MIRPARSER_MILEXER_H