[llvm] r294685 - [MC] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).
Eugene Zelenko via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 9 17:33:55 PST 2017
Author: eugenezelenko
Date: Thu Feb 9 19:33:54 2017
New Revision: 294685
URL: http://llvm.org/viewvc/llvm-project?rev=294685&view=rev
Log:
[MC] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).
Modified:
llvm/trunk/include/llvm/MC/MCParser/AsmCond.h
llvm/trunk/include/llvm/MC/MCParser/AsmLexer.h
llvm/trunk/include/llvm/MC/MCParser/MCAsmLexer.h
llvm/trunk/include/llvm/MC/MCParser/MCAsmParserExtension.h
llvm/trunk/include/llvm/MC/MCParser/MCAsmParserUtils.h
llvm/trunk/include/llvm/MC/MCParser/MCParsedAsmOperand.h
llvm/trunk/include/llvm/MC/MCParser/MCTargetAsmParser.h
llvm/trunk/include/llvm/MC/MCRegisterInfo.h
llvm/trunk/include/llvm/MC/MCSectionCOFF.h
llvm/trunk/include/llvm/MC/MCSymbolCOFF.h
llvm/trunk/include/llvm/MC/MCTargetOptions.h
llvm/trunk/include/llvm/MC/MachineLocation.h
llvm/trunk/lib/MC/MCParser/AsmLexer.cpp
llvm/trunk/lib/MC/MCParser/AsmParser.cpp
llvm/trunk/lib/MC/MCParser/COFFAsmParser.cpp
llvm/trunk/lib/MC/MCParser/DarwinAsmParser.cpp
llvm/trunk/lib/MC/MCParser/MCAsmLexer.cpp
llvm/trunk/lib/MC/MCParser/MCAsmParserExtension.cpp
llvm/trunk/lib/MC/MCParser/MCTargetAsmParser.cpp
llvm/trunk/lib/MC/MCRegisterInfo.cpp
llvm/trunk/lib/MC/MCSectionCOFF.cpp
llvm/trunk/lib/MC/MCTargetOptions.cpp
Modified: llvm/trunk/include/llvm/MC/MCParser/AsmCond.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCParser/AsmCond.h?rev=294685&r1=294684&r2=294685&view=diff
==============================================================================
--- llvm/trunk/include/llvm/MC/MCParser/AsmCond.h (original)
+++ llvm/trunk/include/llvm/MC/MCParser/AsmCond.h Thu Feb 9 19:33:54 2017
@@ -28,13 +28,13 @@ public:
ElseCond // inside else conditional
};
- ConditionalAssemblyType TheCond;
- bool CondMet;
- bool Ignore;
+ ConditionalAssemblyType TheCond = NoCond;
+ bool CondMet = false;
+ bool Ignore = false;
- AsmCond() : TheCond(NoCond), CondMet(false), Ignore(false) {}
+ AsmCond() = default;
};
} // end namespace llvm
-#endif
+#endif // LLVM_MC_MCPARSER_ASMCOND_H
Modified: llvm/trunk/include/llvm/MC/MCParser/AsmLexer.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCParser/AsmLexer.h?rev=294685&r1=294684&r2=294685&view=diff
==============================================================================
--- llvm/trunk/include/llvm/MC/MCParser/AsmLexer.h (original)
+++ llvm/trunk/include/llvm/MC/MCParser/AsmLexer.h Thu Feb 9 19:33:54 2017
@@ -16,25 +16,22 @@
#include "llvm/ADT/StringRef.h"
#include "llvm/MC/MCParser/MCAsmLexer.h"
-#include "llvm/Support/DataTypes.h"
#include <string>
namespace llvm {
-class MemoryBuffer;
+
class MCAsmInfo;
/// AsmLexer - Lexer class for assembly files.
class AsmLexer : public MCAsmLexer {
const MCAsmInfo &MAI;
- const char *CurPtr;
+ const char *CurPtr = nullptr;
StringRef CurBuf;
- bool IsAtStartOfLine;
- bool IsAtStartOfStatement;
- bool IsParsingMSInlineAsm;
- bool IsPeeking;
- void operator=(const AsmLexer&) = delete;
- AsmLexer(const AsmLexer&) = delete;
+ bool IsAtStartOfLine = true;
+ bool IsAtStartOfStatement = true;
+ bool IsParsingMSInlineAsm = false;
+ bool IsPeeking = false;
protected:
/// LexToken - Read the next token and return its code.
@@ -42,6 +39,8 @@ protected:
public:
AsmLexer(const MCAsmInfo &MAI);
+ AsmLexer(const AsmLexer &) = delete;
+ AsmLexer &operator=(const AsmLexer &) = delete;
~AsmLexer() override;
void setBuffer(StringRef Buf, const char *ptr = nullptr);
@@ -74,4 +73,4 @@ private:
} // end namespace llvm
-#endif
+#endif // LLVM_MC_MCPARSER_ASMLEXER_H
Modified: llvm/trunk/include/llvm/MC/MCParser/MCAsmLexer.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCParser/MCAsmLexer.h?rev=294685&r1=294684&r2=294685&view=diff
==============================================================================
--- llvm/trunk/include/llvm/MC/MCParser/MCAsmLexer.h (original)
+++ llvm/trunk/include/llvm/MC/MCParser/MCAsmLexer.h Thu Feb 9 19:33:54 2017
@@ -1,4 +1,4 @@
-//===-- llvm/MC/MCAsmLexer.h - Abstract Asm Lexer Interface -----*- C++ -*-===//
+//===- llvm/MC/MCAsmLexer.h - Abstract Asm Lexer Interface ------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -14,10 +14,12 @@
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringRef.h"
-#include "llvm/Support/Compiler.h"
-#include "llvm/Support/DataTypes.h"
#include "llvm/Support/SMLoc.h"
-#include <utility>
+#include <algorithm>
+#include <cassert>
+#include <cstddef>
+#include <cstdint>
+#include <string>
namespace llvm {
@@ -76,7 +78,7 @@ private:
APInt IntVal;
public:
- AsmToken() {}
+ AsmToken() = default;
AsmToken(TokenKind Kind, StringRef Str, APInt IntVal)
: Kind(Kind), Str(Str), IntVal(std::move(IntVal)) {}
AsmToken(TokenKind Kind, StringRef Str, int64_t IntVal = 0)
@@ -132,7 +134,7 @@ public:
/// it is lexed.
class AsmCommentConsumer {
public:
- virtual ~AsmCommentConsumer() {};
+ virtual ~AsmCommentConsumer() = default;
/// Callback function for when a comment is lexed. Loc is the start of the
/// comment text (excluding the comment-start marker). CommentText is the text
@@ -152,14 +154,12 @@ class MCAsmLexer {
SMLoc ErrLoc;
std::string Err;
- MCAsmLexer(const MCAsmLexer &) = delete;
- void operator=(const MCAsmLexer &) = delete;
protected: // Can only create subclasses.
- const char *TokStart;
- bool SkipSpace;
+ const char *TokStart = nullptr;
+ bool SkipSpace = true;
bool AllowAtInIdentifier;
- bool IsAtStartOfStatement;
- AsmCommentConsumer *CommentConsumer;
+ bool IsAtStartOfStatement = true;
+ AsmCommentConsumer *CommentConsumer = nullptr;
MCAsmLexer();
@@ -171,6 +171,8 @@ protected: // Can only create subclasses
}
public:
+ MCAsmLexer(const MCAsmLexer &) = delete;
+ MCAsmLexer &operator=(const MCAsmLexer &) = delete;
virtual ~MCAsmLexer();
/// Consume the next token from the input stream and return it.
@@ -255,6 +257,6 @@ public:
}
};
-} // End llvm namespace
+} // end namespace llvm
-#endif
+#endif // LLVM_MC_MCPARSER_MCASMLEXER_H
Modified: llvm/trunk/include/llvm/MC/MCParser/MCAsmParserExtension.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCParser/MCAsmParserExtension.h?rev=294685&r1=294684&r2=294685&view=diff
==============================================================================
--- llvm/trunk/include/llvm/MC/MCParser/MCAsmParserExtension.h (original)
+++ llvm/trunk/include/llvm/MC/MCParser/MCAsmParserExtension.h Thu Feb 9 19:33:54 2017
@@ -1,4 +1,4 @@
-//===-- llvm/MC/MCAsmParserExtension.h - Asm Parser Hooks -------*- C++ -*-===//
+//===- llvm/MC/MCAsmParserExtension.h - Asm Parser Hooks --------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -10,20 +10,20 @@
#ifndef LLVM_MC_MCPARSER_MCASMPARSEREXTENSION_H
#define LLVM_MC_MCPARSER_MCASMPARSEREXTENSION_H
+#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/StringRef.h"
+#include "llvm/MC/MCParser/MCAsmLexer.h"
#include "llvm/MC/MCParser/MCAsmParser.h"
#include "llvm/Support/SMLoc.h"
namespace llvm {
+
class Twine;
/// \brief Generic interface for extending the MCAsmParser,
/// which is implemented by target and object file assembly parser
/// implementations.
class MCAsmParserExtension {
- MCAsmParserExtension(const MCAsmParserExtension &) = delete;
- void operator=(const MCAsmParserExtension &) = delete;
-
MCAsmParser *Parser;
protected:
@@ -38,9 +38,11 @@ protected:
return (Obj->*Handler)(Directive, DirectiveLoc);
}
- bool BracketExpressionsSupported;
+ bool BracketExpressionsSupported = false;
public:
+ MCAsmParserExtension(const MCAsmParserExtension &) = delete;
+ MCAsmParserExtension &operator=(const MCAsmParserExtension &) = delete;
virtual ~MCAsmParserExtension();
/// \brief Initialize the extension for parsing using the given \p Parser.
@@ -65,15 +67,19 @@ public:
SourceMgr &getSourceManager() { return getParser().getSourceManager(); }
MCStreamer &getStreamer() { return getParser().getStreamer(); }
+
bool Warning(SMLoc L, const Twine &Msg) {
return getParser().Warning(L, Msg);
}
+
bool Error(SMLoc L, const Twine &Msg, SMRange Range = SMRange()) {
return getParser().Error(L, Msg, Range);
}
+
void Note(SMLoc L, const Twine &Msg) {
getParser().Note(L, Msg);
}
+
bool TokError(const Twine &Msg) {
return getParser().TokError(Msg);
}
@@ -93,11 +99,11 @@ public:
return getParser().parseOptionalToken(T);
}
- bool check(bool P, const llvm::Twine &Msg) {
+ bool check(bool P, const Twine &Msg) {
return getParser().check(P, Msg);
}
- bool check(bool P, SMLoc Loc, const llvm::Twine &Msg) {
+ bool check(bool P, SMLoc Loc, const Twine &Msg) {
return getParser().check(P, Loc, Msg);
}
@@ -110,6 +116,6 @@ public:
/// @}
};
-} // End llvm namespace
+} // end namespace llvm
-#endif
+#endif // LLVM_MC_MCPARSER_MCASMPARSEREXTENSION_H
Modified: llvm/trunk/include/llvm/MC/MCParser/MCAsmParserUtils.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCParser/MCAsmParserUtils.h?rev=294685&r1=294684&r2=294685&view=diff
==============================================================================
--- llvm/trunk/include/llvm/MC/MCParser/MCAsmParserUtils.h (original)
+++ llvm/trunk/include/llvm/MC/MCParser/MCAsmParserUtils.h Thu Feb 9 19:33:54 2017
@@ -1,4 +1,4 @@
-//===------ llvm/MC/MCAsmParserUtils.h - Asm Parser Utilities ---*- C++ -*-===//
+//===- llvm/MC/MCAsmParserUtils.h - Asm Parser Utilities --------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -28,6 +28,7 @@ bool parseAssignmentExpression(StringRef
const MCExpr *&Value);
} // namespace MCParserUtils
+
} // namespace llvm
-#endif
+#endif // LLVM_MC_MCPARSER_MCASMPARSERUTILS_H
Modified: llvm/trunk/include/llvm/MC/MCParser/MCParsedAsmOperand.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCParser/MCParsedAsmOperand.h?rev=294685&r1=294684&r2=294685&view=diff
==============================================================================
--- llvm/trunk/include/llvm/MC/MCParser/MCParsedAsmOperand.h (original)
+++ llvm/trunk/include/llvm/MC/MCParser/MCParsedAsmOperand.h Thu Feb 9 19:33:54 2017
@@ -1,4 +1,4 @@
-//===-- llvm/MC/MCParsedAsmOperand.h - Asm Parser Operand -------*- C++ -*-===//
+//===- llvm/MC/MCParsedAsmOperand.h - Asm Parser Operand --------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -10,11 +10,12 @@
#ifndef LLVM_MC_MCPARSER_MCPARSEDASMOPERAND_H
#define LLVM_MC_MCPARSER_MCPARSEDASMOPERAND_H
-#include <string>
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/SMLoc.h"
+#include <string>
namespace llvm {
+
class raw_ostream;
/// MCParsedAsmOperand - This abstract class represents a source-level assembly
@@ -35,12 +36,12 @@ protected:
// lots of members and MSVC doesn't support defaulted move ops, so to avoid
// that verbosity, just rely on defaulted copy ops. It's only the Constraint
// string member that would benefit from movement anyway.
+ MCParsedAsmOperand() = default;
MCParsedAsmOperand(const MCParsedAsmOperand &RHS) = default;
MCParsedAsmOperand &operator=(const MCParsedAsmOperand &) = default;
- MCParsedAsmOperand() = default;
public:
- virtual ~MCParsedAsmOperand() {}
+ virtual ~MCParsedAsmOperand() = default;
void setConstraint(StringRef C) { Constraint = C.str(); }
StringRef getConstraint() { return Constraint; }
@@ -81,6 +82,7 @@ public:
/// print - Print a debug representation of the operand to the given stream.
virtual void print(raw_ostream &OS) const = 0;
+
/// dump - Print to the debug stream.
virtual void dump() const;
};
@@ -93,6 +95,6 @@ inline raw_ostream& operator<<(raw_ostre
return OS;
}
-} // end namespace llvm.
+} // end namespace llvm
-#endif
+#endif // LLVM_MC_MCPARSER_MCPARSEDASMOPERAND_H
Modified: llvm/trunk/include/llvm/MC/MCParser/MCTargetAsmParser.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCParser/MCTargetAsmParser.h?rev=294685&r1=294684&r2=294685&view=diff
==============================================================================
--- llvm/trunk/include/llvm/MC/MCParser/MCTargetAsmParser.h (original)
+++ llvm/trunk/include/llvm/MC/MCParser/MCTargetAsmParser.h Thu Feb 9 19:33:54 2017
@@ -1,4 +1,4 @@
-//===-- llvm/MC/MCTargetAsmParser.h - Target Assembly Parser ----*- C++ -*-===//
+//===- llvm/MC/MCTargetAsmParser.h - Target Assembly Parser -----*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -10,19 +10,21 @@
#ifndef LLVM_MC_MCPARSER_MCTARGETASMPARSER_H
#define LLVM_MC_MCPARSER_MCTARGETASMPARSER_H
+#include "llvm/ADT/StringRef.h"
#include "llvm/MC/MCExpr.h"
+#include "llvm/MC/MCParser/MCAsmLexer.h"
#include "llvm/MC/MCParser/MCAsmParserExtension.h"
#include "llvm/MC/MCTargetOptions.h"
+#include "llvm/Support/SMLoc.h"
+#include <cstdint>
#include <memory>
namespace llvm {
-class AsmToken;
+
class MCInst;
class MCParsedAsmOperand;
class MCStreamer;
class MCSubtargetInfo;
-class SMLoc;
-class StringRef;
template <typename T> class SmallVectorImpl;
typedef SmallVectorImpl<std::unique_ptr<MCParsedAsmOperand>> OperandVector;
@@ -66,6 +68,7 @@ struct AsmRewrite {
unsigned Len;
unsigned Val;
StringRef Label;
+
public:
AsmRewrite(AsmRewriteKind kind, SMLoc loc, unsigned len = 0, unsigned val = 0)
: Kind(kind), Loc(loc), Len(len), Val(val) {}
@@ -74,10 +77,9 @@ public:
};
struct ParseInstructionInfo {
+ SmallVectorImpl<AsmRewrite> *AsmRewrites = nullptr;
- SmallVectorImpl<AsmRewrite> *AsmRewrites;
-
- ParseInstructionInfo() : AsmRewrites(nullptr) {}
+ ParseInstructionInfo() = default;
ParseInstructionInfo(SmallVectorImpl<AsmRewrite> *rewrites)
: AsmRewrites(rewrites) {}
};
@@ -99,9 +101,6 @@ public:
FIRST_TARGET_MATCH_RESULT_TY
};
-private:
- MCTargetAsmParser(const MCTargetAsmParser &) = delete;
- void operator=(const MCTargetAsmParser &) = delete;
protected: // Can only create subclasses.
MCTargetAsmParser(MCTargetOptions const &, const MCSubtargetInfo &STI);
@@ -109,10 +108,10 @@ protected: // Can only create subclasses
MCSubtargetInfo ©STI();
/// AvailableFeatures - The current set of available features.
- uint64_t AvailableFeatures;
+ uint64_t AvailableFeatures = 0;
/// ParsingInlineAsm - Are we parsing ms-style inline assembly?
- bool ParsingInlineAsm;
+ bool ParsingInlineAsm = false;
/// SemaCallback - The Sema callback implementation. Must be set when parsing
/// ms-style inline assembly.
@@ -125,6 +124,9 @@ protected: // Can only create subclasses
const MCSubtargetInfo *STI;
public:
+ MCTargetAsmParser(const MCTargetAsmParser &) = delete;
+ MCTargetAsmParser &operator=(const MCTargetAsmParser &) = delete;
+
~MCTargetAsmParser() override;
const MCSubtargetInfo &getSTI() const;
@@ -229,11 +231,11 @@ public:
return nullptr;
}
- virtual void onLabelParsed(MCSymbol *Symbol) { }
+ virtual void onLabelParsed(MCSymbol *Symbol) {}
/// Ensure that all previously parsed instructions have been emitted to the
/// output streamer, if the target does not emit them immediately.
- virtual void flushPendingInstructions(MCStreamer &Out) { }
+ virtual void flushPendingInstructions(MCStreamer &Out) {}
virtual const MCExpr *createTargetUnaryExpr(const MCExpr *E,
AsmToken::TokenKind OperatorToken,
@@ -242,6 +244,6 @@ public:
}
};
-} // End llvm namespace
+} // end namespace llvm
-#endif
+#endif // LLVM_MC_MCPARSER_MCTARGETASMPARSER_H
Modified: llvm/trunk/include/llvm/MC/MCRegisterInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCRegisterInfo.h?rev=294685&r1=294684&r2=294685&view=diff
==============================================================================
--- llvm/trunk/include/llvm/MC/MCRegisterInfo.h (original)
+++ llvm/trunk/include/llvm/MC/MCRegisterInfo.h Thu Feb 9 19:33:54 2017
@@ -1,4 +1,4 @@
-//=== MC/MCRegisterInfo.h - Target Register Description ---------*- C++ -*-===//
+//===- MC/MCRegisterInfo.h - Target Register Description --------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -17,9 +17,11 @@
#define LLVM_MC_MCREGISTERINFO_H
#include "llvm/ADT/DenseMap.h"
+#include "llvm/ADT/iterator_range.h"
#include "llvm/MC/LaneBitmask.h"
-#include "llvm/Support/ErrorHandling.h"
#include <cassert>
+#include <cstdint>
+#include <utility>
namespace llvm {
@@ -152,6 +154,7 @@ public:
uint16_t Offset;
uint16_t Size;
};
+
private:
const MCRegisterDesc *Desc; // Pointer to the descriptor array
unsigned NumRegs; // Number of entries in the array
@@ -191,12 +194,12 @@ public:
/// Don't use this class directly, use one of the specialized sub-classes
/// defined below.
class DiffListIterator {
- uint16_t Val;
- const MCPhysReg *List;
+ uint16_t Val = 0;
+ const MCPhysReg *List = nullptr;
protected:
/// Create an invalid iterator. Call init() to point to something useful.
- DiffListIterator() : Val(0), List(nullptr) {}
+ DiffListIterator() = default;
/// init - Point the iterator to InitVal, decoding subsequent values from
/// DiffList. The iterator will initially point to InitVal, sub-classes are
@@ -217,7 +220,6 @@ public:
}
public:
-
/// isValid - returns true if this iterator is not yet at the end.
bool isValid() const { return List; }
@@ -495,6 +497,7 @@ public:
class MCSubRegIndexIterator {
MCSubRegIterator SRIter;
const uint16_t *SRIndex;
+
public:
/// Constructs an iterator that traverses subregisters and their
/// associated subregister indices.
@@ -507,6 +510,7 @@ public:
unsigned getSubReg() const {
return *SRIter;
}
+
/// Returns sub-register index of the current sub-register.
unsigned getSubRegIndex() const {
return *SRIndex;
@@ -526,7 +530,8 @@ public:
/// If IncludeSelf is set, Reg itself is included in the list.
class MCSuperRegIterator : public MCRegisterInfo::DiffListIterator {
public:
- MCSuperRegIterator() {}
+ MCSuperRegIterator() = default;
+
MCSuperRegIterator(unsigned Reg, const MCRegisterInfo *MCRI,
bool IncludeSelf = false) {
init(Reg, MCRI->DiffLists + MCRI->get(Reg).SuperRegs);
@@ -563,7 +568,8 @@ class MCRegUnitIterator : public MCRegis
public:
/// MCRegUnitIterator - Create an iterator that traverses the register units
/// in Reg.
- MCRegUnitIterator() {}
+ MCRegUnitIterator() = default;
+
MCRegUnitIterator(unsigned Reg, const MCRegisterInfo *MCRI) {
assert(Reg && "Null register has no regunits");
// Decode the RegUnits MCRegisterDesc field.
@@ -589,8 +595,10 @@ public:
class MCRegUnitMaskIterator {
MCRegUnitIterator RUIter;
const LaneBitmask *MaskListIter;
+
public:
- MCRegUnitMaskIterator() {}
+ MCRegUnitMaskIterator() = default;
+
/// Constructs an iterator that traverses the register units and their
/// associated LaneMasks in Reg.
MCRegUnitMaskIterator(unsigned Reg, const MCRegisterInfo *MCRI)
@@ -625,10 +633,12 @@ public:
/// MCRegUnitRootIterator enumerates the root registers of a register unit.
class MCRegUnitRootIterator {
- uint16_t Reg0;
- uint16_t Reg1;
+ uint16_t Reg0 = 0;
+ uint16_t Reg1 = 0;
+
public:
- MCRegUnitRootIterator() : Reg0(0), Reg1(0) {}
+ MCRegUnitRootIterator() = default;
+
MCRegUnitRootIterator(unsigned RegUnit, const MCRegisterInfo *MCRI) {
assert(RegUnit < MCRI->getNumRegUnits() && "Invalid register unit");
Reg0 = MCRI->RegUnitRoots[RegUnit][0];
@@ -665,11 +675,11 @@ private:
MCRegUnitIterator RI;
MCRegUnitRootIterator RRI;
MCSuperRegIterator SI;
+
public:
MCRegAliasIterator(unsigned Reg, const MCRegisterInfo *MCRI,
bool IncludeSelf)
: Reg(Reg), MCRI(MCRI), IncludeSelf(IncludeSelf) {
-
// Initialize the iterators.
for (RI = MCRegUnitIterator(Reg, MCRI); RI.isValid(); ++RI) {
for (RRI = MCRegUnitRootIterator(*RI, MCRI); RRI.isValid(); ++RRI) {
@@ -684,7 +694,7 @@ public:
bool isValid() const { return RI.isValid(); }
unsigned operator*() const {
- assert (SI.isValid() && "Cannot dereference an invalid iterator.");
+ assert(SI.isValid() && "Cannot dereference an invalid iterator.");
return *SI;
}
@@ -713,6 +723,6 @@ public:
}
};
-} // End llvm namespace
+} // end namespace llvm
-#endif
+#endif // LLVM_MC_MCREGISTERINFO_H
Modified: llvm/trunk/include/llvm/MC/MCSectionCOFF.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCSectionCOFF.h?rev=294685&r1=294684&r2=294685&view=diff
==============================================================================
--- llvm/trunk/include/llvm/MC/MCSectionCOFF.h (original)
+++ llvm/trunk/include/llvm/MC/MCSectionCOFF.h Thu Feb 9 19:33:54 2017
@@ -16,8 +16,11 @@
#include "llvm/ADT/StringRef.h"
#include "llvm/MC/MCSection.h"
+#include "llvm/MC/SectionKind.h"
+#include <cassert>
namespace llvm {
+
class MCSymbol;
/// This represents a section on Windows
@@ -94,4 +97,4 @@ public:
} // end namespace llvm
-#endif
+#endif // LLVM_MC_MCSECTIONCOFF_H
Modified: llvm/trunk/include/llvm/MC/MCSymbolCOFF.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCSymbolCOFF.h?rev=294685&r1=294684&r2=294685&view=diff
==============================================================================
--- llvm/trunk/include/llvm/MC/MCSymbolCOFF.h (original)
+++ llvm/trunk/include/llvm/MC/MCSymbolCOFF.h Thu Feb 9 19:33:54 2017
@@ -6,16 +6,18 @@
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
+
#ifndef LLVM_MC_MCSYMBOLCOFF_H
#define LLVM_MC_MCSYMBOLCOFF_H
#include "llvm/MC/MCSymbol.h"
+#include <cstdint>
namespace llvm {
-class MCSymbolCOFF : public MCSymbol {
+class MCSymbolCOFF : public MCSymbol {
/// This corresponds to the e_type field of the COFF symbol.
- mutable uint16_t Type;
+ mutable uint16_t Type = 0;
enum SymbolFlags : uint16_t {
SF_ClassMask = 0x00FF,
@@ -27,7 +29,7 @@ class MCSymbolCOFF : public MCSymbol {
public:
MCSymbolCOFF(const StringMapEntry<bool> *Name, bool isTemporary)
- : MCSymbol(SymbolKindCOFF, Name, isTemporary), Type(0) {}
+ : MCSymbol(SymbolKindCOFF, Name, isTemporary) {}
uint16_t getType() const {
return Type;
@@ -59,6 +61,7 @@ public:
static bool classof(const MCSymbol *S) { return S->isCOFF(); }
};
-}
-#endif
+} // end namespace llvm
+
+#endif // LLVM_MC_MCSYMBOLCOFF_H
Modified: llvm/trunk/include/llvm/MC/MCTargetOptions.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCTargetOptions.h?rev=294685&r1=294684&r2=294685&view=diff
==============================================================================
--- llvm/trunk/include/llvm/MC/MCTargetOptions.h (original)
+++ llvm/trunk/include/llvm/MC/MCTargetOptions.h Thu Feb 9 19:33:54 2017
@@ -1,4 +1,4 @@
-//===- MCTargetOptions.h - MC Target Options -------------------*- C++ -*-===//
+//===- MCTargetOptions.h - MC Target Options --------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -51,12 +51,8 @@ public:
/// Preserve Comments in Assembly.
bool PreserveAsmComments : 1;
- int DwarfVersion;
+ int DwarfVersion = 0;
- /// getABIName - If this returns a non-empty string this represents the
- /// textual name of the ABI that we want the backend to use, e.g. o32, or
- /// aapcs-linux.
- StringRef getABIName() const;
std::string ABIName;
/// Additional paths to search for `.include` directives when using the
@@ -64,6 +60,11 @@ public:
std::vector<std::string> IASSearchPaths;
MCTargetOptions();
+
+ /// getABIName - If this returns a non-empty string this represents the
+ /// textual name of the ABI that we want the backend to use, e.g. o32, or
+ /// aapcs-linux.
+ StringRef getABIName() const;
};
inline bool operator==(const MCTargetOptions &LHS, const MCTargetOptions &RHS) {
@@ -93,4 +94,4 @@ inline bool operator!=(const MCTargetOpt
} // end namespace llvm
-#endif
+#endif // LLVM_MC_MCTARGETOPTIONS_H
Modified: llvm/trunk/include/llvm/MC/MachineLocation.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MachineLocation.h?rev=294685&r1=294684&r2=294685&view=diff
==============================================================================
--- llvm/trunk/include/llvm/MC/MachineLocation.h (original)
+++ llvm/trunk/include/llvm/MC/MachineLocation.h Thu Feb 9 19:33:54 2017
@@ -1,4 +1,4 @@
-//===-- llvm/MC/MachineLocation.h -------------------------------*- C++ -*-===//
+//===- llvm/MC/MachineLocation.h --------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -12,35 +12,31 @@
// explicitly passing an offset to the constructor.
//===----------------------------------------------------------------------===//
-
#ifndef LLVM_MC_MACHINELOCATION_H
#define LLVM_MC_MACHINELOCATION_H
-#include "llvm/Support/Compiler.h"
-#include "llvm/Support/DataTypes.h"
+#include <cstdint>
namespace llvm {
- class MCSymbol;
class MachineLocation {
private:
- bool IsRegister; // True if location is a register.
- unsigned Register; // gcc/gdb register number.
- int Offset; // Displacement if not register.
+ bool IsRegister = false; // True if location is a register.
+ unsigned Register = 0; // gcc/gdb register number.
+ int Offset = 0; // Displacement if not register.
+
public:
enum : uint32_t {
// The target register number for an abstract frame pointer. The value is
// an arbitrary value that doesn't collide with any real target register.
VirtualFP = ~0U
};
- MachineLocation()
- : IsRegister(false), Register(0), Offset(0) {}
+
+ MachineLocation() = default;
/// Create a direct register location.
- explicit MachineLocation(unsigned R)
- : IsRegister(true), Register(R), Offset(0) {}
+ explicit MachineLocation(unsigned R) : IsRegister(true), Register(R) {}
/// Create a register-indirect location with an offset.
- MachineLocation(unsigned R, int O)
- : IsRegister(false), Register(R), Offset(O) {}
+ MachineLocation(unsigned R, int O) : Register(R) {}
bool operator==(const MachineLocation &Other) const {
return IsRegister == Other.IsRegister && Register == Other.Register &&
@@ -56,12 +52,14 @@ public:
void setIsRegister(bool Is) { IsRegister = Is; }
void setRegister(unsigned R) { Register = R; }
void setOffset(int O) { Offset = O; }
+
/// Make this location a direct register location.
void set(unsigned R) {
IsRegister = true;
Register = R;
Offset = 0;
}
+
/// Make this location a register-indirect+offset location.
void set(unsigned R, int O) {
IsRegister = false;
@@ -74,6 +72,6 @@ inline bool operator!=(const MachineLoca
return !(LHS == RHS);
}
-} // End llvm namespace
+} // end namespace llvm
-#endif
+#endif // LLVM_MC_MACHINELOCATION_H
Modified: llvm/trunk/lib/MC/MCParser/AsmLexer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCParser/AsmLexer.cpp?rev=294685&r1=294684&r2=294685&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCParser/AsmLexer.cpp (original)
+++ llvm/trunk/lib/MC/MCParser/AsmLexer.cpp Thu Feb 9 19:33:54 2017
@@ -11,12 +11,12 @@
//
//===----------------------------------------------------------------------===//
-#include "llvm/MC/MCParser/AsmLexer.h"
#include "llvm/ADT/APInt.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/StringSwitch.h"
#include "llvm/MC/MCAsmInfo.h"
+#include "llvm/MC/MCParser/AsmLexer.h"
#include "llvm/MC/MCParser/MCAsmLexer.h"
#include "llvm/Support/SMLoc.h"
#include "llvm/Support/SaveAndRestore.h"
@@ -30,15 +30,11 @@
using namespace llvm;
-AsmLexer::AsmLexer(const MCAsmInfo &MAI)
- : MAI(MAI), CurPtr(nullptr), IsAtStartOfLine(true),
- IsAtStartOfStatement(true), IsParsingMSInlineAsm(false),
- IsPeeking(false) {
+AsmLexer::AsmLexer(const MCAsmInfo &MAI) : MAI(MAI) {
AllowAtInIdentifier = !StringRef(MAI.getCommentString()).startswith("@");
}
-AsmLexer::~AsmLexer() {
-}
+AsmLexer::~AsmLexer() = default;
void AsmLexer::setBuffer(StringRef Buf, const char *ptr) {
CurBuf = Buf;
Modified: llvm/trunk/lib/MC/MCParser/AsmParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCParser/AsmParser.cpp?rev=294685&r1=294684&r2=294685&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCParser/AsmParser.cpp (original)
+++ llvm/trunk/lib/MC/MCParser/AsmParser.cpp Thu Feb 9 19:33:54 2017
@@ -35,6 +35,7 @@
#include "llvm/MC/MCParser/AsmLexer.h"
#include "llvm/MC/MCParser/MCAsmLexer.h"
#include "llvm/MC/MCParser/MCAsmParser.h"
+#include "llvm/MC/MCParser/MCAsmParserExtension.h"
#include "llvm/MC/MCParser/MCAsmParserUtils.h"
#include "llvm/MC/MCParser/MCParsedAsmOperand.h"
#include "llvm/MC/MCParser/MCTargetAsmParser.h"
@@ -42,6 +43,7 @@
#include "llvm/MC/MCSection.h"
#include "llvm/MC/MCStreamer.h"
#include "llvm/MC/MCSymbol.h"
+#include "llvm/MC/MCTargetOptions.h"
#include "llvm/MC/MCValue.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/CommandLine.h"
@@ -55,6 +57,7 @@
#include <algorithm>
#include <cassert>
#include <cctype>
+#include <climits>
#include <cstddef>
#include <cstdint>
#include <deque>
@@ -67,7 +70,7 @@
using namespace llvm;
-MCAsmParserSemaCallback::~MCAsmParserSemaCallback() {}
+MCAsmParserSemaCallback::~MCAsmParserSemaCallback() = default;
static cl::opt<unsigned> AsmMacroMaxNestingDepth(
"asm-macro-max-nesting-depth", cl::init(20), cl::Hidden,
@@ -82,10 +85,10 @@ typedef std::vector<MCAsmMacroArgument>
struct MCAsmMacroParameter {
StringRef Name;
MCAsmMacroArgument Value;
- bool Required;
- bool Vararg;
+ bool Required = false;
+ bool Vararg = false;
- MCAsmMacroParameter() : Required(false), Vararg(false) {}
+ MCAsmMacroParameter() = default;
};
typedef std::vector<MCAsmMacroParameter> MCAsmMacroParameters;
@@ -124,23 +127,20 @@ struct ParseStatementInfo {
SmallVector<std::unique_ptr<MCParsedAsmOperand>, 8> ParsedOperands;
/// \brief The opcode from the last parsed instruction.
- unsigned Opcode;
+ unsigned Opcode = ~0U;
/// \brief Was there an error parsing the inline assembly?
- bool ParseError;
+ bool ParseError = false;
- SmallVectorImpl<AsmRewrite> *AsmRewrites;
+ SmallVectorImpl<AsmRewrite> *AsmRewrites = nullptr;
- ParseStatementInfo() : Opcode(~0U), ParseError(false), AsmRewrites(nullptr) {}
+ ParseStatementInfo() = default;
ParseStatementInfo(SmallVectorImpl<AsmRewrite> *rewrites)
- : Opcode(~0), ParseError(false), AsmRewrites(rewrites) {}
+ : AsmRewrites(rewrites) {}
};
/// \brief The concrete assembly parser instance.
class AsmParser : public MCAsmParser {
- AsmParser(const AsmParser &) = delete;
- void operator=(const AsmParser &) = delete;
-
private:
AsmLexer Lexer;
MCContext &Ctx;
@@ -199,17 +199,19 @@ private:
unsigned LastQueryLine;
/// AssemblerDialect. ~OU means unset value and use value provided by MAI.
- unsigned AssemblerDialect;
+ unsigned AssemblerDialect = ~0U;
/// \brief is Darwin compatibility enabled?
- bool IsDarwin;
+ bool IsDarwin = false;
/// \brief Are we parsing ms-style inline assembly?
- bool ParsingInlineAsm;
+ bool ParsingInlineAsm = false;
public:
AsmParser(SourceMgr &SM, MCContext &Ctx, MCStreamer &Out,
const MCAsmInfo &MAI, unsigned CB);
+ AsmParser(const AsmParser &) = delete;
+ AsmParser &operator=(const AsmParser &) = delete;
~AsmParser() override;
bool Run(bool NoInitialTextSection, bool NoFinalize = false) override;
@@ -223,7 +225,6 @@ public:
DirectiveKindMap[Directive] = DirectiveKindMap[Alias];
}
-public:
/// @name MCAsmParser Interface
/// {
@@ -258,7 +259,7 @@ public:
bool parseMSInlineAsm(void *AsmLoc, std::string &AsmString,
unsigned &NumOutputs, unsigned &NumInputs,
- SmallVectorImpl<std::pair<void *,bool> > &OpDecls,
+ SmallVectorImpl<std::pair<void *,bool>> &OpDecls,
SmallVectorImpl<std::string> &Constraints,
SmallVectorImpl<std::string> &Clobbers,
const MCInstrInfo *MII, const MCInstPrinter *IP,
@@ -574,9 +575,7 @@ enum { DEFAULT_ADDRSPACE = 0 };
AsmParser::AsmParser(SourceMgr &SM, MCContext &Ctx, MCStreamer &Out,
const MCAsmInfo &MAI, unsigned CB = 0)
: Lexer(MAI), Ctx(Ctx), Out(Out), MAI(MAI), SrcMgr(SM),
- PlatformParser(nullptr), CurBuffer(CB ? CB : SM.getMainFileID()),
- MacrosEnabledFlag(true), CppHashInfo(), AssemblerDialect(~0U),
- IsDarwin(false), ParsingInlineAsm(false) {
+ CurBuffer(CB ? CB : SM.getMainFileID()), MacrosEnabledFlag(true) {
HadError = false;
// Save the old handler.
SavedDiagHandler = SrcMgr.getDiagHandler();
@@ -983,7 +982,7 @@ bool AsmParser::parsePrimaryExpr(const M
MCSymbolRefExpr::VariantKind Variant = MCSymbolRefExpr::VK_None;
// Lookup the symbol variant if used.
- if (Split.second.size()) {
+ if (!Split.second.empty()) {
Variant = MCSymbolRefExpr::getVariantKindForName(Split.second);
if (Variant != MCSymbolRefExpr::VK_Invalid) {
SymbolName = Split.first;
@@ -1622,7 +1621,7 @@ bool AsmParser::parseStatement(ParseStat
if (ParsingInlineAsm && SI) {
StringRef RewrittenLabel =
SI->LookupInlineAsmLabel(IDVal, getSourceManager(), IDLoc, true);
- assert(RewrittenLabel.size() &&
+ assert(!RewrittenLabel.empty() &&
"We should have an internal name here.");
Info.AsmRewrites->emplace_back(AOK_Label, IDLoc, IDVal.size(),
RewrittenLabel);
@@ -2030,7 +2029,7 @@ bool AsmParser::parseStatement(ParseStat
// If we previously parsed a cpp hash file line comment then make sure the
// current Dwarf File is for the CppHashFilename if not then emit the
// Dwarf File table for it and adjust the line number for the .loc.
- if (CppHashInfo.Filename.size()) {
+ if (!CppHashInfo.Filename.empty()) {
unsigned FileNumber = getStreamer().EmitDwarfFileDirective(
0, StringRef(), CppHashInfo.Filename);
getContext().setGenDwarfFileNumber(FileNumber);
@@ -4196,7 +4195,6 @@ bool AsmParser::parseDirectiveBundleUnlo
/// parseDirectiveSpace
/// ::= (.skip | .space) expression [ , expression ]
bool AsmParser::parseDirectiveSpace(StringRef IDVal) {
-
SMLoc NumBytesLoc = Lexer.getLoc();
const MCExpr *NumBytes;
if (checkForValidSection() || parseExpression(NumBytes))
@@ -4292,7 +4290,6 @@ bool AsmParser::parseDirectiveRealDCB(St
/// parseDirectiveDS
/// ::= .ds.{b, d, l, p, s, w, x} expression
bool AsmParser::parseDirectiveDS(StringRef IDVal, unsigned Size) {
-
SMLoc NumValuesLoc = Lexer.getLoc();
int64_t NumValues;
if (checkForValidSection() || parseAbsoluteExpression(NumValues))
@@ -5214,7 +5211,7 @@ static int rewritesSort(const AsmRewrite
bool AsmParser::parseMSInlineAsm(
void *AsmLoc, std::string &AsmString, unsigned &NumOutputs,
- unsigned &NumInputs, SmallVectorImpl<std::pair<void *, bool> > &OpDecls,
+ unsigned &NumInputs, SmallVectorImpl<std::pair<void *, bool>> &OpDecls,
SmallVectorImpl<std::string> &Constraints,
SmallVectorImpl<std::string> &Clobbers, const MCInstrInfo *MII,
const MCInstPrinter *IP, MCAsmParserSemaCallback &SI) {
Modified: llvm/trunk/lib/MC/MCParser/COFFAsmParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCParser/COFFAsmParser.cpp?rev=294685&r1=294684&r2=294685&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCParser/COFFAsmParser.cpp (original)
+++ llvm/trunk/lib/MC/MCParser/COFFAsmParser.cpp Thu Feb 9 19:33:54 2017
@@ -7,19 +7,27 @@
//
//===----------------------------------------------------------------------===//
-#include "llvm/MC/MCParser/MCAsmParserExtension.h"
#include "llvm/ADT/StringSwitch.h"
+#include "llvm/ADT/StringRef.h"
+#include "llvm/ADT/Triple.h"
#include "llvm/ADT/Twine.h"
-#include "llvm/MC/MCAsmInfo.h"
#include "llvm/MC/MCContext.h"
-#include "llvm/MC/MCExpr.h"
+#include "llvm/MC/MCDirectives.h"
#include "llvm/MC/MCObjectFileInfo.h"
#include "llvm/MC/MCParser/MCAsmLexer.h"
+#include "llvm/MC/MCParser/MCAsmParserExtension.h"
#include "llvm/MC/MCParser/MCTargetAsmParser.h"
#include "llvm/MC/MCRegisterInfo.h"
#include "llvm/MC/MCSectionCOFF.h"
#include "llvm/MC/MCStreamer.h"
+#include "llvm/MC/SectionKind.h"
#include "llvm/Support/COFF.h"
+#include "llvm/Support/SMLoc.h"
+#include <cassert>
+#include <cstdint>
+#include <limits>
+#include <utility>
+
using namespace llvm;
namespace {
@@ -98,12 +106,14 @@ class COFFAsmParser : public MCAsmParser
| COFF::IMAGE_SCN_MEM_READ,
SectionKind::getText());
}
+
bool ParseSectionDirectiveData(StringRef, SMLoc) {
return ParseSectionSwitch(".data", COFF::IMAGE_SCN_CNT_INITIALIZED_DATA |
COFF::IMAGE_SCN_MEM_READ |
COFF::IMAGE_SCN_MEM_WRITE,
SectionKind::getData());
}
+
bool ParseSectionDirectiveBSS(StringRef, SMLoc) {
return ParseSectionSwitch(".bss",
COFF::IMAGE_SCN_CNT_UNINITIALIZED_DATA
@@ -141,8 +151,9 @@ class COFFAsmParser : public MCAsmParser
bool ParseAtUnwindOrAtExcept(bool &unwind, bool &except);
bool ParseSEHRegisterNumber(unsigned &RegNo);
bool ParseDirectiveSymbolAttribute(StringRef Directive, SMLoc);
+
public:
- COFFAsmParser() {}
+ COFFAsmParser() = default;
};
} // end annonomous namespace.
@@ -277,7 +288,7 @@ bool COFFAsmParser::ParseDirectiveSymbol
.Default(MCSA_Invalid);
assert(Attr != MCSA_Invalid && "unexpected symbol attribute directive!");
if (getLexer().isNot(AsmToken::EndOfStatement)) {
- for (;;) {
+ while (true) {
StringRef Name;
if (getParser().parseIdentifier(Name))
@@ -466,10 +477,11 @@ bool COFFAsmParser::ParseDirectiveSecRel
if (getLexer().isNot(AsmToken::EndOfStatement))
return TokError("unexpected token in directive");
- if (Offset < 0 || Offset > UINT32_MAX)
- return Error(OffsetLoc,
- "invalid '.secrel32' directive offset, can't be less "
- "than zero or greater than UINT32_MAX");
+ if (Offset < 0 || Offset > std::numeric_limits<uint32_t>::max())
+ return Error(
+ OffsetLoc,
+ "invalid '.secrel32' directive offset, can't be less "
+ "than zero or greater than std::numeric_limits<uint32_t>::max()");
MCSymbol *Symbol = getContext().getOrCreateSymbol(SymbolID);
@@ -817,4 +829,4 @@ MCAsmParserExtension *createCOFFAsmParse
return new COFFAsmParser;
}
-}
+} // end namespace llvm
Modified: llvm/trunk/lib/MC/MCParser/DarwinAsmParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCParser/DarwinAsmParser.cpp?rev=294685&r1=294684&r2=294685&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCParser/DarwinAsmParser.cpp (original)
+++ llvm/trunk/lib/MC/MCParser/DarwinAsmParser.cpp Thu Feb 9 19:33:54 2017
@@ -7,22 +7,35 @@
//
//===----------------------------------------------------------------------===//
-#include "llvm/MC/MCParser/MCAsmParserExtension.h"
+#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/StringSwitch.h"
#include "llvm/ADT/Triple.h"
#include "llvm/ADT/Twine.h"
#include "llvm/MC/MCContext.h"
+#include "llvm/MC/MCDirectives.h"
#include "llvm/MC/MCObjectFileInfo.h"
#include "llvm/MC/MCParser/MCAsmLexer.h"
#include "llvm/MC/MCParser/MCAsmParser.h"
+#include "llvm/MC/MCParser/MCAsmParserExtension.h"
#include "llvm/MC/MCSectionMachO.h"
#include "llvm/MC/MCStreamer.h"
#include "llvm/MC/MCSymbol.h"
+#include "llvm/MC/SectionKind.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/MemoryBuffer.h"
+#include "llvm/Support/MachO.h"
+#include "llvm/Support/raw_ostream.h"
+#include "llvm/Support/SMLoc.h"
#include "llvm/Support/SourceMgr.h"
+#include <algorithm>
+#include <cstddef>
+#include <cstdint>
+#include <string>
+#include <system_error>
+#include <utility>
+
using namespace llvm;
namespace {
@@ -44,7 +57,7 @@ class DarwinAsmParser : public MCAsmPars
SMLoc LastVersionMinDirective;
public:
- DarwinAsmParser() {}
+ DarwinAsmParser() = default;
void Initialize(MCAsmParser &Parser) override {
// Call the base implementation.
@@ -209,37 +222,47 @@ public:
bool parseSectionDirectiveConst(StringRef, SMLoc) {
return parseSectionSwitch("__TEXT", "__const");
}
+
bool parseSectionDirectiveStaticConst(StringRef, SMLoc) {
return parseSectionSwitch("__TEXT", "__static_const");
}
+
bool parseSectionDirectiveCString(StringRef, SMLoc) {
return parseSectionSwitch("__TEXT","__cstring",
MachO::S_CSTRING_LITERALS);
}
+
bool parseSectionDirectiveLiteral4(StringRef, SMLoc) {
return parseSectionSwitch("__TEXT", "__literal4",
MachO::S_4BYTE_LITERALS, 4);
}
+
bool parseSectionDirectiveLiteral8(StringRef, SMLoc) {
return parseSectionSwitch("__TEXT", "__literal8",
MachO::S_8BYTE_LITERALS, 8);
}
+
bool parseSectionDirectiveLiteral16(StringRef, SMLoc) {
return parseSectionSwitch("__TEXT","__literal16",
MachO::S_16BYTE_LITERALS, 16);
}
+
bool parseSectionDirectiveConstructor(StringRef, SMLoc) {
return parseSectionSwitch("__TEXT","__constructor");
}
+
bool parseSectionDirectiveDestructor(StringRef, SMLoc) {
return parseSectionSwitch("__TEXT","__destructor");
}
+
bool parseSectionDirectiveFVMLibInit0(StringRef, SMLoc) {
return parseSectionSwitch("__TEXT","__fvmlib_init0");
}
+
bool parseSectionDirectiveFVMLibInit1(StringRef, SMLoc) {
return parseSectionSwitch("__TEXT","__fvmlib_init1");
}
+
bool parseSectionDirectiveSymbolStub(StringRef, SMLoc) {
return parseSectionSwitch("__TEXT","__symbol_stub",
MachO::S_SYMBOL_STUBS |
@@ -247,144 +270,178 @@ public:
// FIXME: Different on PPC and ARM.
0, 16);
}
+
bool parseSectionDirectivePICSymbolStub(StringRef, SMLoc) {
return parseSectionSwitch("__TEXT","__picsymbol_stub",
MachO::S_SYMBOL_STUBS |
MachO::S_ATTR_PURE_INSTRUCTIONS, 0, 26);
}
+
bool parseSectionDirectiveData(StringRef, SMLoc) {
return parseSectionSwitch("__DATA", "__data");
}
+
bool parseSectionDirectiveStaticData(StringRef, SMLoc) {
return parseSectionSwitch("__DATA", "__static_data");
}
+
bool parseSectionDirectiveNonLazySymbolPointers(StringRef, SMLoc) {
return parseSectionSwitch("__DATA", "__nl_symbol_ptr",
MachO::S_NON_LAZY_SYMBOL_POINTERS, 4);
}
+
bool parseSectionDirectiveLazySymbolPointers(StringRef, SMLoc) {
return parseSectionSwitch("__DATA", "__la_symbol_ptr",
MachO::S_LAZY_SYMBOL_POINTERS, 4);
}
+
bool parseSectionDirectiveThreadLocalVariablePointers(StringRef, SMLoc) {
return parseSectionSwitch("__DATA", "__thread_ptr",
MachO::S_THREAD_LOCAL_VARIABLE_POINTERS, 4);
}
+
bool parseSectionDirectiveDyld(StringRef, SMLoc) {
return parseSectionSwitch("__DATA", "__dyld");
}
+
bool parseSectionDirectiveModInitFunc(StringRef, SMLoc) {
return parseSectionSwitch("__DATA", "__mod_init_func",
MachO::S_MOD_INIT_FUNC_POINTERS, 4);
}
+
bool parseSectionDirectiveModTermFunc(StringRef, SMLoc) {
return parseSectionSwitch("__DATA", "__mod_term_func",
MachO::S_MOD_TERM_FUNC_POINTERS, 4);
}
+
bool parseSectionDirectiveConstData(StringRef, SMLoc) {
return parseSectionSwitch("__DATA", "__const");
}
+
bool parseSectionDirectiveObjCClass(StringRef, SMLoc) {
return parseSectionSwitch("__OBJC", "__class",
MachO::S_ATTR_NO_DEAD_STRIP);
}
+
bool parseSectionDirectiveObjCMetaClass(StringRef, SMLoc) {
return parseSectionSwitch("__OBJC", "__meta_class",
MachO::S_ATTR_NO_DEAD_STRIP);
}
+
bool parseSectionDirectiveObjCCatClsMeth(StringRef, SMLoc) {
return parseSectionSwitch("__OBJC", "__cat_cls_meth",
MachO::S_ATTR_NO_DEAD_STRIP);
}
+
bool parseSectionDirectiveObjCCatInstMeth(StringRef, SMLoc) {
return parseSectionSwitch("__OBJC", "__cat_inst_meth",
MachO::S_ATTR_NO_DEAD_STRIP);
}
+
bool parseSectionDirectiveObjCProtocol(StringRef, SMLoc) {
return parseSectionSwitch("__OBJC", "__protocol",
MachO::S_ATTR_NO_DEAD_STRIP);
}
+
bool parseSectionDirectiveObjCStringObject(StringRef, SMLoc) {
return parseSectionSwitch("__OBJC", "__string_object",
MachO::S_ATTR_NO_DEAD_STRIP);
}
+
bool parseSectionDirectiveObjCClsMeth(StringRef, SMLoc) {
return parseSectionSwitch("__OBJC", "__cls_meth",
MachO::S_ATTR_NO_DEAD_STRIP);
}
+
bool parseSectionDirectiveObjCInstMeth(StringRef, SMLoc) {
return parseSectionSwitch("__OBJC", "__inst_meth",
MachO::S_ATTR_NO_DEAD_STRIP);
}
+
bool parseSectionDirectiveObjCClsRefs(StringRef, SMLoc) {
return parseSectionSwitch("__OBJC", "__cls_refs",
MachO::S_ATTR_NO_DEAD_STRIP |
MachO::S_LITERAL_POINTERS, 4);
}
+
bool parseSectionDirectiveObjCMessageRefs(StringRef, SMLoc) {
return parseSectionSwitch("__OBJC", "__message_refs",
MachO::S_ATTR_NO_DEAD_STRIP |
MachO::S_LITERAL_POINTERS, 4);
}
+
bool parseSectionDirectiveObjCSymbols(StringRef, SMLoc) {
return parseSectionSwitch("__OBJC", "__symbols",
MachO::S_ATTR_NO_DEAD_STRIP);
}
+
bool parseSectionDirectiveObjCCategory(StringRef, SMLoc) {
return parseSectionSwitch("__OBJC", "__category",
MachO::S_ATTR_NO_DEAD_STRIP);
}
+
bool parseSectionDirectiveObjCClassVars(StringRef, SMLoc) {
return parseSectionSwitch("__OBJC", "__class_vars",
MachO::S_ATTR_NO_DEAD_STRIP);
}
+
bool parseSectionDirectiveObjCInstanceVars(StringRef, SMLoc) {
return parseSectionSwitch("__OBJC", "__instance_vars",
MachO::S_ATTR_NO_DEAD_STRIP);
}
+
bool parseSectionDirectiveObjCModuleInfo(StringRef, SMLoc) {
return parseSectionSwitch("__OBJC", "__module_info",
MachO::S_ATTR_NO_DEAD_STRIP);
}
+
bool parseSectionDirectiveObjCClassNames(StringRef, SMLoc) {
return parseSectionSwitch("__TEXT", "__cstring",
MachO::S_CSTRING_LITERALS);
}
+
bool parseSectionDirectiveObjCMethVarTypes(StringRef, SMLoc) {
return parseSectionSwitch("__TEXT", "__cstring",
MachO::S_CSTRING_LITERALS);
}
+
bool parseSectionDirectiveObjCMethVarNames(StringRef, SMLoc) {
return parseSectionSwitch("__TEXT", "__cstring",
MachO::S_CSTRING_LITERALS);
}
+
bool parseSectionDirectiveObjCSelectorStrs(StringRef, SMLoc) {
return parseSectionSwitch("__OBJC", "__selector_strs",
MachO::S_CSTRING_LITERALS);
}
+
bool parseSectionDirectiveTData(StringRef, SMLoc) {
return parseSectionSwitch("__DATA", "__thread_data",
MachO::S_THREAD_LOCAL_REGULAR);
}
+
bool parseSectionDirectiveText(StringRef, SMLoc) {
return parseSectionSwitch("__TEXT", "__text",
MachO::S_ATTR_PURE_INSTRUCTIONS);
}
+
bool parseSectionDirectiveTLV(StringRef, SMLoc) {
return parseSectionSwitch("__DATA", "__thread_vars",
MachO::S_THREAD_LOCAL_VARIABLES);
}
+
bool parseSectionDirectiveIdent(StringRef, SMLoc) {
// Darwin silently ignores the .ident directive.
getParser().eatToEndOfStatement();
return false;
}
+
bool parseSectionDirectiveThreadInitFunc(StringRef, SMLoc) {
return parseSectionSwitch("__DATA", "__thread_init",
MachO::S_THREAD_LOCAL_INIT_FUNCTION_POINTERS);
}
- bool parseVersionMin(StringRef, SMLoc);
+ bool parseVersionMin(StringRef, SMLoc);
};
} // end anonymous namespace
@@ -526,7 +583,7 @@ bool DarwinAsmParser::parseDirectiveDump
/// ::= .linker_option "string" ( , "string" )*
bool DarwinAsmParser::parseDirectiveLinkerOption(StringRef IDVal, SMLoc) {
SmallVector<std::string, 4> Args;
- for (;;) {
+ while (true) {
if (getLexer().isNot(AsmToken::String))
return TokError("expected string in '" + Twine(IDVal) + "' directive");
@@ -604,7 +661,6 @@ bool DarwinAsmParser::parseDirectiveSect
return TokError("unexpected token in '.section' directive");
Lex();
-
StringRef Segment, Section;
unsigned StubSize;
unsigned TAA;
Modified: llvm/trunk/lib/MC/MCParser/MCAsmLexer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCParser/MCAsmLexer.cpp?rev=294685&r1=294684&r2=294685&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCParser/MCAsmLexer.cpp (original)
+++ llvm/trunk/lib/MC/MCParser/MCAsmLexer.cpp Thu Feb 9 19:33:54 2017
@@ -1,4 +1,4 @@
-//===-- MCAsmLexer.cpp - Abstract Asm Lexer Interface ---------------------===//
+//===- MCAsmLexer.cpp - Abstract Asm Lexer Interface ----------------------===//
//
// The LLVM Compiler Infrastructure
//
@@ -7,19 +7,17 @@
//
//===----------------------------------------------------------------------===//
+#include "llvm/ADT/StringRef.h"
#include "llvm/MC/MCParser/MCAsmLexer.h"
-#include "llvm/Support/SourceMgr.h"
+#include "llvm/Support/SMLoc.h"
using namespace llvm;
-MCAsmLexer::MCAsmLexer()
- : TokStart(nullptr), SkipSpace(true), IsAtStartOfStatement(true),
- CommentConsumer(nullptr) {
+MCAsmLexer::MCAsmLexer() {
CurTok.emplace_back(AsmToken::Space, StringRef());
}
-MCAsmLexer::~MCAsmLexer() {
-}
+MCAsmLexer::~MCAsmLexer() = default;
SMLoc MCAsmLexer::getLoc() const {
return SMLoc::getFromPointer(TokStart);
Modified: llvm/trunk/lib/MC/MCParser/MCAsmParserExtension.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCParser/MCAsmParserExtension.cpp?rev=294685&r1=294684&r2=294685&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCParser/MCAsmParserExtension.cpp (original)
+++ llvm/trunk/lib/MC/MCParser/MCAsmParserExtension.cpp Thu Feb 9 19:33:54 2017
@@ -1,4 +1,4 @@
-//===-- MCAsmParserExtension.cpp - Asm Parser Hooks -----------------------===//
+//===- MCAsmParserExtension.cpp - Asm Parser Hooks ------------------------===//
//
// The LLVM Compiler Infrastructure
//
@@ -8,14 +8,12 @@
//===----------------------------------------------------------------------===//
#include "llvm/MC/MCParser/MCAsmParserExtension.h"
+
using namespace llvm;
-MCAsmParserExtension::MCAsmParserExtension() :
- BracketExpressionsSupported(false) {
-}
+MCAsmParserExtension::MCAsmParserExtension() = default;
-MCAsmParserExtension::~MCAsmParserExtension() {
-}
+MCAsmParserExtension::~MCAsmParserExtension() = default;
void MCAsmParserExtension::Initialize(MCAsmParser &Parser) {
this->Parser = &Parser;
Modified: llvm/trunk/lib/MC/MCParser/MCTargetAsmParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCParser/MCTargetAsmParser.cpp?rev=294685&r1=294684&r2=294685&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCParser/MCTargetAsmParser.cpp (original)
+++ llvm/trunk/lib/MC/MCParser/MCTargetAsmParser.cpp Thu Feb 9 19:33:54 2017
@@ -1,4 +1,4 @@
-//===-- MCTargetAsmParser.cpp - Target Assembly Parser ---------------------==//
+//===-- MCTargetAsmParser.cpp - Target Assembly Parser --------------------===//
//
// The LLVM Compiler Infrastructure
//
@@ -7,19 +7,16 @@
//
//===----------------------------------------------------------------------===//
-#include "llvm/MC/MCParser/MCTargetAsmParser.h"
#include "llvm/MC/MCContext.h"
+#include "llvm/MC/MCParser/MCTargetAsmParser.h"
+
using namespace llvm;
MCTargetAsmParser::MCTargetAsmParser(MCTargetOptions const &MCOptions,
const MCSubtargetInfo &STI)
- : AvailableFeatures(0), ParsingInlineAsm(false), MCOptions(MCOptions),
- STI(&STI)
-{
-}
+ : MCOptions(MCOptions), STI(&STI) {}
-MCTargetAsmParser::~MCTargetAsmParser() {
-}
+MCTargetAsmParser::~MCTargetAsmParser() = default;
MCSubtargetInfo &MCTargetAsmParser::copySTI() {
MCSubtargetInfo &STICopy = getContext().getSubtargetCopy(getSTI());
Modified: llvm/trunk/lib/MC/MCRegisterInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCRegisterInfo.cpp?rev=294685&r1=294684&r2=294685&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCRegisterInfo.cpp (original)
+++ llvm/trunk/lib/MC/MCRegisterInfo.cpp Thu Feb 9 19:33:54 2017
@@ -1,4 +1,4 @@
-//=== MC/MCRegisterInfo.cpp - Target Register Description -------*- C++ -*-===//
+//===- MC/MCRegisterInfo.cpp - Target Register Description ----------------===//
//
// The LLVM Compiler Infrastructure
//
@@ -11,9 +11,12 @@
//
//===----------------------------------------------------------------------===//
+#include "llvm/ADT/DenseMap.h"
#include "llvm/MC/MCRegisterInfo.h"
-#include "llvm/Support/Format.h"
-#include "llvm/Support/raw_ostream.h"
+#include "llvm/Support/ErrorHandling.h"
+#include <algorithm>
+#include <cassert>
+#include <cstdint>
using namespace llvm;
Modified: llvm/trunk/lib/MC/MCSectionCOFF.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCSectionCOFF.cpp?rev=294685&r1=294684&r2=294685&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCSectionCOFF.cpp (original)
+++ llvm/trunk/lib/MC/MCSectionCOFF.cpp Thu Feb 9 19:33:54 2017
@@ -8,14 +8,14 @@
//===----------------------------------------------------------------------===//
#include "llvm/MC/MCSectionCOFF.h"
-#include "llvm/MC/MCAsmInfo.h"
-#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCSymbol.h"
#include "llvm/Support/COFF.h"
#include "llvm/Support/raw_ostream.h"
+#include <cassert>
+
using namespace llvm;
-MCSectionCOFF::~MCSectionCOFF() {} // anchor.
+MCSectionCOFF::~MCSectionCOFF() = default; // anchor.
// ShouldOmitSectionDirective - Decides whether a '.section' directive
// should be printed before the section name
@@ -40,7 +40,6 @@ void MCSectionCOFF::setSelection(int Sel
void MCSectionCOFF::PrintSwitchToSection(const MCAsmInfo &MAI, const Triple &T,
raw_ostream &OS,
const MCExpr *Subsection) const {
-
// standard sections don't require the '.section'
if (ShouldOmitSectionDirective(SectionName, MAI)) {
OS << '\t' << getSectionName() << '\n';
@@ -94,7 +93,7 @@ void MCSectionCOFF::PrintSwitchToSection
OS << "newest,";
break;
default:
- assert (0 && "unsupported COFF selection type");
+ assert(false && "unsupported COFF selection type");
break;
}
assert(COMDATSymbol);
Modified: llvm/trunk/lib/MC/MCTargetOptions.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCTargetOptions.cpp?rev=294685&r1=294684&r2=294685&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCTargetOptions.cpp (original)
+++ llvm/trunk/lib/MC/MCTargetOptions.cpp Thu Feb 9 19:33:54 2017
@@ -1,4 +1,4 @@
-//===- lib/MC/MCTargetOptions.cpp - MC Target Options --------------------===//
+//===- lib/MC/MCTargetOptions.cpp - MC Target Options ---------------------===//
//
// The LLVM Compiler Infrastructure
//
@@ -10,19 +10,16 @@
#include "llvm/ADT/StringRef.h"
#include "llvm/MC/MCTargetOptions.h"
-namespace llvm {
+using namespace llvm;
MCTargetOptions::MCTargetOptions()
: SanitizeAddress(false), MCRelaxAll(false), MCNoExecStack(false),
MCFatalWarnings(false), MCNoWarn(false), MCNoDeprecatedWarn(false),
- MCSaveTempLabels(false),
- MCUseDwarfDirectory(false), MCIncrementalLinkerCompatible(false),
- MCPIECopyRelocations(false), ShowMCEncoding(false),
- ShowMCInst(false), AsmVerbose(false),
- PreserveAsmComments(true), DwarfVersion(0), ABIName() {}
+ MCSaveTempLabels(false), MCUseDwarfDirectory(false),
+ MCIncrementalLinkerCompatible(false), MCPIECopyRelocations(false),
+ ShowMCEncoding(false), ShowMCInst(false), AsmVerbose(false),
+ PreserveAsmComments(true) {}
StringRef MCTargetOptions::getABIName() const {
return ABIName;
}
-
-} // end namespace llvm
More information about the llvm-commits
mailing list