From: Jim Grosbach Date: Fri, 15 May 2015 19:13:20 +0000 (+0000) Subject: MC: clang-format. NFC. X-Git-Url: http://plrg.eecs.uci.edu/git/?p=oota-llvm.git;a=commitdiff_plain;h=792476e6262b9e2f619894c931cdaf3b5baa5c92 MC: clang-format. NFC. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237470 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/llvm/MC/MCAsmLayout.h b/include/llvm/MC/MCAsmLayout.h index fbbb33ca20a..ae7fd7c2e29 100644 --- a/include/llvm/MC/MCAsmLayout.h +++ b/include/llvm/MC/MCAsmLayout.h @@ -29,19 +29,19 @@ class MCSymbolData; /// even during the relaxation process. class MCAsmLayout { public: - typedef llvm::SmallVectorImpl::const_iterator const_iterator; - typedef llvm::SmallVectorImpl::iterator iterator; + typedef llvm::SmallVectorImpl::const_iterator const_iterator; + typedef llvm::SmallVectorImpl::iterator iterator; private: MCAssembler &Assembler; /// List of sections in layout order. - llvm::SmallVector SectionOrder; + llvm::SmallVector SectionOrder; /// The last fragment which was laid out, or 0 if nothing has been laid /// out. Fragments are always laid out in order, so all fragments with a /// lower ordinal will be valid. - mutable DenseMap LastValidFragment; + mutable DenseMap LastValidFragment; /// \brief Make sure that the layout for the given fragment is valid, lazily /// computing it if necessary. @@ -69,10 +69,10 @@ public: /// \name Section Access (in layout order) /// @{ - llvm::SmallVectorImpl &getSectionOrder() { + llvm::SmallVectorImpl &getSectionOrder() { return SectionOrder; } - const llvm::SmallVectorImpl &getSectionOrder() const { + const llvm::SmallVectorImpl &getSectionOrder() const { return SectionOrder; } diff --git a/include/llvm/MC/MCAssembler.h b/include/llvm/MC/MCAssembler.h index d7547561c29..1fc45eedd84 100644 --- a/include/llvm/MC/MCAssembler.h +++ b/include/llvm/MC/MCAssembler.h @@ -47,8 +47,8 @@ class MCAsmBackend; class MCFragment : public ilist_node { friend class MCAsmLayout; - MCFragment(const MCFragment&) = delete; - void operator=(const MCFragment&) = delete; + MCFragment(const MCFragment &) = delete; + void operator=(const MCFragment &) = delete; public: enum FragmentType { @@ -112,21 +112,18 @@ public: /// \brief Should this fragment be placed at the end of an aligned bundle? virtual bool alignToBundleEnd() const { return false; } - virtual void setAlignToBundleEnd(bool V) { } + virtual void setAlignToBundleEnd(bool V) {} /// \brief Get the padding size that must be inserted before this fragment. /// Used for bundling. By default, no padding is inserted. /// Note that padding size is restricted to 8 bits. This is an optimization /// to reduce the amount of space used for each fragment. In practice, larger /// padding should never be required. - virtual uint8_t getBundlePadding() const { - return 0; - } + virtual uint8_t getBundlePadding() const { return 0; } /// \brief Set the padding size for this fragment. By default it's a no-op, /// and only some fragments have a meaningful implementation. - virtual void setBundlePadding(uint8_t N) { - } + virtual void setBundlePadding(uint8_t N) {} void dump(); }; @@ -138,33 +135,28 @@ class MCEncodedFragment : public MCFragment { virtual void anchor(); uint8_t BundlePadding; + public: MCEncodedFragment(MCFragment::FragmentType FType, MCSectionData *SD = nullptr) - : MCFragment(FType, SD), BundlePadding(0) - { - } + : MCFragment(FType, SD), BundlePadding(0) {} ~MCEncodedFragment() override; virtual SmallVectorImpl &getContents() = 0; virtual const SmallVectorImpl &getContents() const = 0; - uint8_t getBundlePadding() const override { - return BundlePadding; - } + uint8_t getBundlePadding() const override { return BundlePadding; } - void setBundlePadding(uint8_t N) override { - BundlePadding = N; - } + void setBundlePadding(uint8_t N) override { BundlePadding = N; } static bool classof(const MCFragment *F) { MCFragment::FragmentType Kind = F->getKind(); switch (Kind) { - default: - return false; - case MCFragment::FT_Relaxable: - case MCFragment::FT_CompactEncodedInst: - case MCFragment::FT_Data: - return true; + default: + return false; + case MCFragment::FT_Relaxable: + case MCFragment::FT_CompactEncodedInst: + case MCFragment::FT_Data: + return true; } } }; @@ -178,9 +170,7 @@ class MCEncodedFragmentWithFixups : public MCEncodedFragment { public: MCEncodedFragmentWithFixups(MCFragment::FragmentType FType, MCSectionData *SD = nullptr) - : MCEncodedFragment(FType, SD) - { - } + : MCEncodedFragment(FType, SD) {} ~MCEncodedFragmentWithFixups() override; @@ -191,7 +181,7 @@ public: virtual const SmallVectorImpl &getFixups() const = 0; virtual fixup_iterator fixup_begin() = 0; - virtual const_fixup_iterator fixup_begin() const = 0; + virtual const_fixup_iterator fixup_begin() const = 0; virtual fixup_iterator fixup_end() = 0; virtual const_fixup_iterator fixup_end() const = 0; @@ -216,25 +206,18 @@ class MCDataFragment : public MCEncodedFragmentWithFixups { /// Fixups - The list of fixups in this fragment. SmallVector Fixups; + public: MCDataFragment(MCSectionData *SD = nullptr) - : MCEncodedFragmentWithFixups(FT_Data, SD), - HasInstructions(false), AlignToBundleEnd(false) - { - } + : MCEncodedFragmentWithFixups(FT_Data, SD), HasInstructions(false), + AlignToBundleEnd(false) {} SmallVectorImpl &getContents() override { return Contents; } - const SmallVectorImpl &getContents() const override { - return Contents; - } + const SmallVectorImpl &getContents() const override { return Contents; } - SmallVectorImpl &getFixups() override { - return Fixups; - } + SmallVectorImpl &getFixups() override { return Fixups; } - const SmallVectorImpl &getFixups() const override { - return Fixups; - } + const SmallVectorImpl &getFixups() const override { return Fixups; } bool hasInstructions() const override { return HasInstructions; } virtual void setHasInstructions(bool V) { HasInstructions = V; } @@ -245,8 +228,8 @@ public: fixup_iterator fixup_begin() override { return Fixups.begin(); } const_fixup_iterator fixup_begin() const override { return Fixups.begin(); } - fixup_iterator fixup_end() override {return Fixups.end();} - const_fixup_iterator fixup_end() const override {return Fixups.end();} + fixup_iterator fixup_end() override { return Fixups.end(); } + const_fixup_iterator fixup_end() const override { return Fixups.end(); } static bool classof(const MCFragment *F) { return F->getKind() == MCFragment::FT_Data; @@ -265,15 +248,12 @@ class MCCompactEncodedInstFragment : public MCEncodedFragment { bool AlignToBundleEnd; SmallVector Contents; + public: MCCompactEncodedInstFragment(MCSectionData *SD = nullptr) - : MCEncodedFragment(FT_CompactEncodedInst, SD), AlignToBundleEnd(false) - { - } + : MCEncodedFragment(FT_CompactEncodedInst, SD), AlignToBundleEnd(false) {} - bool hasInstructions() const override { - return true; - } + bool hasInstructions() const override { return true; } SmallVectorImpl &getContents() override { return Contents; } const SmallVectorImpl &getContents() const override { return Contents; } @@ -315,25 +295,21 @@ public: const SmallVectorImpl &getContents() const override { return Contents; } const MCInst &getInst() const { return Inst; } - void setInst(const MCInst& Value) { Inst = Value; } + void setInst(const MCInst &Value) { Inst = Value; } const MCSubtargetInfo &getSubtargetInfo() { return STI; } - SmallVectorImpl &getFixups() override { - return Fixups; - } + SmallVectorImpl &getFixups() override { return Fixups; } - const SmallVectorImpl &getFixups() const override { - return Fixups; - } + const SmallVectorImpl &getFixups() const override { return Fixups; } bool hasInstructions() const override { return true; } fixup_iterator fixup_begin() override { return Fixups.begin(); } const_fixup_iterator fixup_begin() const override { return Fixups.begin(); } - fixup_iterator fixup_end() override {return Fixups.end();} - const_fixup_iterator fixup_end() const override {return Fixups.end();} + fixup_iterator fixup_end() override { return Fixups.end(); } + const_fixup_iterator fixup_end() const override { return Fixups.end(); } static bool classof(const MCFragment *F) { return F->getKind() == MCFragment::FT_Relaxable; @@ -463,11 +439,13 @@ class MCLEBFragment : public MCFragment { bool IsSigned; SmallString<8> Contents; + public: MCLEBFragment(const MCExpr &Value_, bool IsSigned_, MCSectionData *SD = nullptr) - : MCFragment(FT_LEB, SD), - Value(&Value_), IsSigned(IsSigned_) { Contents.push_back(0); } + : MCFragment(FT_LEB, SD), Value(&Value_), IsSigned(IsSigned_) { + Contents.push_back(0); + } /// \name Accessors /// @{ @@ -559,8 +537,8 @@ public: class MCSectionData : public ilist_node { friend class MCAsmLayout; - MCSectionData(const MCSectionData&) = delete; - void operator=(const MCSectionData&) = delete; + MCSectionData(const MCSectionData &) = delete; + void operator=(const MCSectionData &) = delete; public: typedef iplist FragmentListType; @@ -577,6 +555,7 @@ public: BundleLocked, BundleLockedAlignToEnd }; + private: FragmentListType Fragments; const MCSection *Section; @@ -658,13 +637,9 @@ public: iterator getSubsectionInsertionPoint(unsigned Subsection); - bool isBundleLocked() const { - return BundleLockState != NotBundleLocked; - } + bool isBundleLocked() const { return BundleLockState != NotBundleLocked; } - BundleLockStateType getBundleLockState() const { - return BundleLockState; - } + BundleLockStateType getBundleLockState() const { return BundleLockState; } void setBundleLockState(BundleLockStateType NewState); @@ -771,14 +746,9 @@ public: return CommonSize; } - void setSize(const MCExpr *SS) { - SymbolSize = SS; - } - - const MCExpr *getSize() const { - return SymbolSize; - } + void setSize(const MCExpr *SS) { SymbolSize = SS; } + const MCExpr *getSize() const { return SymbolSize; } /// getCommonAlignment - Return the alignment of a 'common' symbol. unsigned getCommonAlignment() const { @@ -844,11 +814,11 @@ public: typedef FileNameVectorType::const_iterator const_file_name_iterator; typedef std::vector::const_iterator - const_indirect_symbol_iterator; + const_indirect_symbol_iterator; typedef std::vector::iterator indirect_symbol_iterator; typedef std::vector::const_iterator - const_data_region_iterator; + const_data_region_iterator; typedef std::vector::iterator data_region_iterator; /// MachO specific deployment target version info. @@ -860,9 +830,10 @@ public: unsigned Minor; unsigned Update; } VersionMinInfoType; + private: - MCAssembler(const MCAssembler&) = delete; - void operator=(const MCAssembler&) = delete; + MCAssembler(const MCAssembler &) = delete; + void operator=(const MCAssembler &) = delete; MCContext &Context; @@ -883,19 +854,19 @@ private: /// The map of sections to their associated assembler backend data. // // FIXME: Avoid this indirection? - DenseMap SectionMap; + DenseMap SectionMap; /// The map of symbols to their associated assembler backend data. // // FIXME: Avoid this indirection? - DenseMap SymbolMap; + DenseMap SymbolMap; std::vector IndirectSymbols; std::vector DataRegions; /// The list of linker options to propagate into the object file. - std::vector > LinkerOptions; + std::vector> LinkerOptions; /// List of declared file names FileNameVectorType FileNames; @@ -907,7 +878,7 @@ private: // here. Maybe when the relocation stuff moves to target specific, // this can go with it? The streamer would need some target specific // refactoring too. - mutable SmallPtrSet ThumbFuncs; + mutable SmallPtrSet ThumbFuncs; /// \brief The bundle alignment size currently set in the assembler. /// @@ -929,6 +900,7 @@ private: MCLOHContainer LOHContainer; VersionMinInfoType VersionMinInfo; + private: /// Evaluate a fixup to a relocatable expression and the value which should be /// placed into the fixup. @@ -943,9 +915,9 @@ private: /// \return Whether the fixup value was fully resolved. This is true if the /// \p Value result is fixed, otherwise the value may change due to /// relocation. - bool evaluateFixup(const MCAsmLayout &Layout, - const MCFixup &Fixup, const MCFragment *DF, - MCValue &Target, uint64_t &Value) const; + bool evaluateFixup(const MCAsmLayout &Layout, const MCFixup &Fixup, + const MCFragment *DF, MCValue &Target, + uint64_t &Value) const; /// Check whether a fixup can be satisfied, or whether it needs to be relaxed /// (increased in size, in order to hold its value correctly). @@ -1008,8 +980,8 @@ public: void setIsThumbFunc(const MCSymbol *Func) { ThumbFuncs.insert(Func); } /// ELF e_header flags - unsigned getELFHeaderEFlags() const {return ELFHeaderEFlags;} - void setELFHeaderEFlags(unsigned Flags) { ELFHeaderEFlags = Flags;} + unsigned getELFHeaderEFlags() const { return ELFHeaderEFlags; } + void setELFHeaderEFlags(unsigned Flags) { ELFHeaderEFlags = Flags; } /// MachO deployment target version information. const VersionMinInfoType &getVersionMinInfo() const { return VersionMinInfo; } @@ -1053,26 +1025,18 @@ public: void Finish(); // FIXME: This does not belong here. - bool getSubsectionsViaSymbols() const { - return SubsectionsViaSymbols; - } - void setSubsectionsViaSymbols(bool Value) { - SubsectionsViaSymbols = Value; - } + bool getSubsectionsViaSymbols() const { return SubsectionsViaSymbols; } + void setSubsectionsViaSymbols(bool Value) { SubsectionsViaSymbols = Value; } bool getRelaxAll() const { return RelaxAll; } void setRelaxAll(bool Value) { RelaxAll = Value; } - bool isBundlingEnabled() const { - return BundleAlignSize != 0; - } + bool isBundlingEnabled() const { return BundleAlignSize != 0; } - unsigned getBundleAlignSize() const { - return BundleAlignSize; - } + unsigned getBundleAlignSize() const { return BundleAlignSize; } void setBundleAlignSize(unsigned Size) { - assert((Size == 0 || !(Size & (Size - 1))) && + assert((Size == 0 || !(Size & (Size - 1))) && "Expect a power-of-two bundle align size"); BundleAlignSize = Size; } @@ -1105,7 +1069,9 @@ public: const_symbol_iterator symbol_end() const { return Symbols.end(); } symbol_range symbols() { return make_range(symbol_begin(), symbol_end()); } - const_symbol_range symbols() const { return make_range(symbol_begin(), symbol_end()); } + const_symbol_range symbols() const { + return make_range(symbol_begin(), symbol_end()); + } size_t symbol_size() const { return Symbols.size(); } @@ -1140,7 +1106,7 @@ public: /// \name Linker Option List Access /// @{ - std::vector > &getLinkerOptions() { + std::vector> &getLinkerOptions() { return LinkerOptions; } @@ -1151,20 +1117,14 @@ public: // FIXME: This is a total hack, this should not be here. Once things are // factored so that the streamer has direct access to the .o writer, it can // disappear. - std::vector &getDataRegions() { - return DataRegions; - } + std::vector &getDataRegions() { return DataRegions; } - data_region_iterator data_region_begin() { - return DataRegions.begin(); - } + data_region_iterator data_region_begin() { return DataRegions.begin(); } const_data_region_iterator data_region_begin() const { return DataRegions.begin(); } - data_region_iterator data_region_end() { - return DataRegions.end(); - } + data_region_iterator data_region_end() { return DataRegions.end(); } const_data_region_iterator data_region_end() const { return DataRegions.end(); } @@ -1178,10 +1138,8 @@ public: // FIXME: This is a total hack, this should not be here. Once things are // factored so that the streamer has direct access to the .o writer, it can // disappear. - MCLOHContainer & getLOHContainer() { - return LOHContainer; - } - const MCLOHContainer & getLOHContainer() const { + MCLOHContainer &getLOHContainer() { return LOHContainer; } + const MCLOHContainer &getLOHContainer() const { return const_cast(this)->getLOHContainer(); } /// @} @@ -1198,7 +1156,8 @@ public: bool *Created = nullptr) { MCSectionData *&Entry = SectionMap[&Section]; - if (Created) *Created = !Entry; + if (Created) + *Created = !Entry; if (!Entry) Entry = new MCSectionData(Section, this); @@ -1224,7 +1183,8 @@ public: bool *Created = nullptr) { MCSymbolData *&Entry = SymbolMap[&Symbol]; - if (Created) *Created = !Entry; + if (Created) + *Created = !Entry; if (!Entry) Entry = new MCSymbolData(Symbol, nullptr, 0, this); @@ -1235,9 +1195,7 @@ public: return FileNames.begin(); } - const_file_name_iterator file_names_end() const { - return FileNames.end(); - } + const_file_name_iterator file_names_end() const { return FileNames.end(); } void addFileName(StringRef FileName) { if (std::find(file_names_begin(), file_names_end(), FileName) == @@ -1258,8 +1216,7 @@ public: /// \brief Compute the amount of padding required before the fragment \p F to /// obey bundling restrictions, where \p FOffset is the fragment's offset in /// its section and \p FSize is the fragment's size. -uint64_t computeBundlePadding(const MCAssembler &Assembler, - const MCFragment *F, +uint64_t computeBundlePadding(const MCAssembler &Assembler, const MCFragment *F, uint64_t FOffset, uint64_t FSize); } // end namespace llvm diff --git a/include/llvm/MC/MCCodeEmitter.h b/include/llvm/MC/MCCodeEmitter.h index ac8588bdf59..b6c19150c12 100644 --- a/include/llvm/MC/MCCodeEmitter.h +++ b/include/llvm/MC/MCCodeEmitter.h @@ -24,6 +24,7 @@ class MCCodeEmitter { private: MCCodeEmitter(const MCCodeEmitter &) = delete; void operator=(const MCCodeEmitter &) = delete; + protected: // Can only create subclasses. MCCodeEmitter(); @@ -31,7 +32,7 @@ public: virtual ~MCCodeEmitter(); /// Lifetime management - virtual void reset() { } + virtual void reset() {} /// EncodeInstruction - Encode the given \p Inst to bytes on the output /// stream \p OS. diff --git a/include/llvm/MC/MCCodeGenInfo.h b/include/llvm/MC/MCCodeGenInfo.h index 84ce934d822..095289ddad1 100644 --- a/include/llvm/MC/MCCodeGenInfo.h +++ b/include/llvm/MC/MCCodeGenInfo.h @@ -19,33 +19,33 @@ namespace llvm { - class MCCodeGenInfo { - /// RelocationModel - Relocation model: static, pic, etc. - /// - Reloc::Model RelocationModel; +class MCCodeGenInfo { + /// RelocationModel - Relocation model: static, pic, etc. + /// + Reloc::Model RelocationModel; - /// CMModel - Code model. - /// - CodeModel::Model CMModel; + /// CMModel - Code model. + /// + CodeModel::Model CMModel; - /// OptLevel - Optimization level. - /// - CodeGenOpt::Level OptLevel; + /// OptLevel - Optimization level. + /// + CodeGenOpt::Level OptLevel; - public: - void InitMCCodeGenInfo(Reloc::Model RM = Reloc::Default, - CodeModel::Model CM = CodeModel::Default, - CodeGenOpt::Level OL = CodeGenOpt::Default); +public: + void InitMCCodeGenInfo(Reloc::Model RM = Reloc::Default, + CodeModel::Model CM = CodeModel::Default, + CodeGenOpt::Level OL = CodeGenOpt::Default); - Reloc::Model getRelocationModel() const { return RelocationModel; } + Reloc::Model getRelocationModel() const { return RelocationModel; } - CodeModel::Model getCodeModel() const { return CMModel; } + CodeModel::Model getCodeModel() const { return CMModel; } - CodeGenOpt::Level getOptLevel() const { return OptLevel; } + CodeGenOpt::Level getOptLevel() const { return OptLevel; } - // Allow overriding OptLevel on a per-function basis. - void setOptLevel(CodeGenOpt::Level Level) { OptLevel = Level; } - }; + // Allow overriding OptLevel on a per-function basis. + void setOptLevel(CodeGenOpt::Level Level) { OptLevel = Level; } +}; } // namespace llvm #endif