Skip to content

Added const reference for params wth size >= 16 bytes #125074

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
2 changes: 1 addition & 1 deletion llvm/include/llvm/Analysis/AliasSetTracker.h
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ class AliasSetTracker {
}
}

AliasSet &addMemoryLocation(MemoryLocation Loc, AliasSet::AccessLattice E);
AliasSet &addMemoryLocation(const MemoryLocation &Loc, AliasSet::AccessLattice E);
AliasSet *mergeAliasSetsForMemoryLocation(const MemoryLocation &MemLoc,
AliasSet *PtrAS,
bool &MustAliasAll);
Expand Down
6 changes: 3 additions & 3 deletions llvm/include/llvm/Analysis/AssumeBundleQueries.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,14 +100,14 @@ struct RetainedKnowledge {
Attribute::AttrKind AttrKind = Attribute::None;
uint64_t ArgValue = 0;
Value *WasOn = nullptr;
bool operator==(RetainedKnowledge Other) const {
bool operator==(const RetainedKnowledge &Other) const {
return AttrKind == Other.AttrKind && WasOn == Other.WasOn &&
ArgValue == Other.ArgValue;
}
bool operator!=(RetainedKnowledge Other) const { return !(*this == Other); }
bool operator!=(const RetainedKnowledge &Other) const { return !(*this == Other); }
/// This is only intended for use in std::min/std::max between attribute that
/// only differ in ArgValue.
bool operator<(RetainedKnowledge Other) const {
bool operator<(const RetainedKnowledge &Other) const {
assert(((AttrKind == Other.AttrKind && WasOn == Other.WasOn) ||
AttrKind == Attribute::None || Other.AttrKind == Attribute::None) &&
"This is only intend for use in min/max to select the best for "
Expand Down
4 changes: 2 additions & 2 deletions llvm/include/llvm/Analysis/SparsePropagation.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ template <class LatticeKey, class LatticeVal> class AbstractLatticeFunction {
SparseSolver<LatticeKey, LatticeVal> &SS) = 0;

/// PrintLatticeVal - Render the given LatticeVal to the specified stream.
virtual void PrintLatticeVal(LatticeVal LV, raw_ostream &OS);
virtual void PrintLatticeVal(const LatticeVal &LV, raw_ostream &OS);

/// PrintLatticeKey - Render the given LatticeKey to the specified stream.
virtual void PrintLatticeKey(LatticeKey Key, raw_ostream &OS);
Expand Down Expand Up @@ -203,7 +203,7 @@ class SparseSolver {

template <class LatticeKey, class LatticeVal>
void AbstractLatticeFunction<LatticeKey, LatticeVal>::PrintLatticeVal(
LatticeVal V, raw_ostream &OS) {
const LatticeVal &V, raw_ostream &OS) {
if (V == UndefVal)
OS << "undefined";
else if (V == OverdefinedVal)
Expand Down
34 changes: 17 additions & 17 deletions llvm/include/llvm/Bitcode/BitcodeReader.h
Original file line number Diff line number Diff line change
Expand Up @@ -119,12 +119,12 @@ struct ParserCallbacks {

// Calls the ctor.
friend Expected<BitcodeFileContents>
getBitcodeFileContents(MemoryBufferRef Buffer);
getBitcodeFileContents(const MemoryBufferRef &Buffer);

Expected<std::unique_ptr<Module>>
getModuleImpl(LLVMContext &Context, bool MaterializeAll,
bool ShouldLazyLoadMetadata, bool IsImporting,
ParserCallbacks Callbacks = {});
const ParserCallbacks &Callbacks = {});

public:
StringRef getBuffer() const {
Expand All @@ -141,11 +141,11 @@ struct ParserCallbacks {
/// importing into another module.
Expected<std::unique_ptr<Module>>
getLazyModule(LLVMContext &Context, bool ShouldLazyLoadMetadata,
bool IsImporting, ParserCallbacks Callbacks = {});
bool IsImporting, const ParserCallbacks &Callbacks = {});

/// Read the entire bitcode module and return it.
Expected<std::unique_ptr<Module>>
parseModule(LLVMContext &Context, ParserCallbacks Callbacks = {});
parseModule(LLVMContext &Context, const ParserCallbacks &Callbacks = {});

/// Returns information about the module to be used for LTO: whether to
/// compile with ThinLTO, and whether it has a summary.
Expand All @@ -171,21 +171,21 @@ struct ParserCallbacks {
/// symbol table should prefer to use irsymtab::read instead of this function
/// because it creates a reader for the irsymtab and handles upgrading bitcode
/// files without a symbol table or with an old symbol table.
Expected<BitcodeFileContents> getBitcodeFileContents(MemoryBufferRef Buffer);
Expected<BitcodeFileContents> getBitcodeFileContents(const MemoryBufferRef &Buffer);

/// Returns a list of modules in the specified bitcode buffer.
Expected<std::vector<BitcodeModule>>
getBitcodeModuleList(MemoryBufferRef Buffer);
getBitcodeModuleList(const MemoryBufferRef &Buffer);

/// Read the header of the specified bitcode buffer and prepare for lazy
/// deserialization of function bodies. If ShouldLazyLoadMetadata is true,
/// lazily load metadata as well. If IsImporting is true, this module is
/// being parsed for ThinLTO importing into another module.
Expected<std::unique_ptr<Module>>
getLazyBitcodeModule(MemoryBufferRef Buffer, LLVMContext &Context,
getLazyBitcodeModule(const MemoryBufferRef &Buffer, LLVMContext &Context,
bool ShouldLazyLoadMetadata = false,
bool IsImporting = false,
ParserCallbacks Callbacks = {});
const ParserCallbacks &Callbacks = {});

/// Like getLazyBitcodeModule, except that the module takes ownership of
/// the memory buffer if successful. If successful, this moves Buffer. On
Expand All @@ -194,36 +194,36 @@ struct ParserCallbacks {
Expected<std::unique_ptr<Module>> getOwningLazyBitcodeModule(
std::unique_ptr<MemoryBuffer> &&Buffer, LLVMContext &Context,
bool ShouldLazyLoadMetadata = false, bool IsImporting = false,
ParserCallbacks Callbacks = {});
const ParserCallbacks &Callbacks = {});

/// Read the header of the specified bitcode buffer and extract just the
/// triple information. If successful, this returns a string. On error, this
/// returns "".
Expected<std::string> getBitcodeTargetTriple(MemoryBufferRef Buffer);
Expected<std::string> getBitcodeTargetTriple(const MemoryBufferRef &Buffer);

/// Return true if \p Buffer contains a bitcode file with ObjC code (category
/// or class) in it.
Expected<bool> isBitcodeContainingObjCCategory(MemoryBufferRef Buffer);
Expected<bool> isBitcodeContainingObjCCategory(const MemoryBufferRef &Buffer);

/// Read the header of the specified bitcode buffer and extract just the
/// producer string information. If successful, this returns a string. On
/// error, this returns "".
Expected<std::string> getBitcodeProducerString(MemoryBufferRef Buffer);
Expected<std::string> getBitcodeProducerString(const MemoryBufferRef &Buffer);

/// Read the specified bitcode file, returning the module.
Expected<std::unique_ptr<Module>>
parseBitcodeFile(MemoryBufferRef Buffer, LLVMContext &Context,
ParserCallbacks Callbacks = {});
parseBitcodeFile(const MemoryBufferRef &Buffer, LLVMContext &Context,
const ParserCallbacks &Callbacks = {});

/// Returns LTO information for the specified bitcode file.
Expected<BitcodeLTOInfo> getBitcodeLTOInfo(MemoryBufferRef Buffer);
Expected<BitcodeLTOInfo> getBitcodeLTOInfo(const MemoryBufferRef &Buffer);

/// Parse the specified bitcode buffer, returning the module summary index.
Expected<std::unique_ptr<ModuleSummaryIndex>>
getModuleSummaryIndex(MemoryBufferRef Buffer);
getModuleSummaryIndex(const MemoryBufferRef &Buffer);

/// Parse the specified bitcode buffer and merge the index into CombinedIndex.
Error readModuleSummaryIndex(MemoryBufferRef Buffer,
Error readModuleSummaryIndex(const MemoryBufferRef &Buffer,
ModuleSummaryIndex &CombinedIndex);

/// Parse the module summary index out of an IR file and return the module
Expand Down
2 changes: 1 addition & 1 deletion llvm/include/llvm/Bitcode/BitcodeWriter.h
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ void writeIndexToFile(
/// If EmbedCmdline is set, the command line is also exported in
/// the corresponding section (__LLVM,_cmdline / .llvmcmd) - even if CmdArgs
/// were empty.
void embedBitcodeInModule(Module &M, MemoryBufferRef Buf, bool EmbedBitcode,
void embedBitcodeInModule(Module &M, const MemoryBufferRef &Buf, bool EmbedBitcode,
bool EmbedCmdline,
const std::vector<uint8_t> &CmdArgs);

Expand Down
2 changes: 1 addition & 1 deletion llvm/include/llvm/CGData/CodeGenData.h
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ std::unique_ptr<Module> loadModuleForTwoRounds(BitcodeModule &OrigModule,
Expected<stable_hash> mergeCodeGenData(ArrayRef<StringRef> ObjectFiles);

void warn(Error E, StringRef Whence = "");
void warn(Twine Message, std::string Whence = "", std::string Hint = "");
void warn(const Twine &Message, const std::string &Whence = "", const std::string &Hint = "");

} // end namespace cgdata

Expand Down
6 changes: 3 additions & 3 deletions llvm/include/llvm/CodeGen/AsmPrinter.h
Original file line number Diff line number Diff line change
Expand Up @@ -632,7 +632,7 @@ class AsmPrinter : public MachineFunctionPass {
StringRef Suffix) const;

/// Return the MCSymbol for the specified ExternalSymbol.
MCSymbol *GetExternalSymbolSymbol(Twine Sym) const;
MCSymbol *GetExternalSymbolSymbol(const Twine &Sym) const;

/// Return the symbol for the specified jump table entry.
MCSymbol *GetJTISymbol(unsigned JTID, bool isLinkerPrivate = false) const;
Expand Down Expand Up @@ -723,10 +723,10 @@ class AsmPrinter : public MachineFunctionPass {
/// emitDwarfSymbolReference().
///
/// The length of the emitted value depends on the DWARF format.
void emitDwarfStringOffset(DwarfStringPoolEntry S) const;
void emitDwarfStringOffset(const DwarfStringPoolEntry &S) const;

/// Emit the 4-or 8-byte offset of a string from the start of its section.
void emitDwarfStringOffset(DwarfStringPoolEntryRef S) const {
void emitDwarfStringOffset(const DwarfStringPoolEntryRef &S) const {
emitDwarfStringOffset(S.getEntry());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ class BasicBlockSectionsProfileReader {
}

// Returns a profile parsing error for the current line.
Error createProfileParseError(Twine Message) const {
Error createProfileParseError(const Twine &Message) const {
return make_error<StringError>(
Twine("invalid profile " + MBuf->getBufferIdentifier() + " at line " +
Twine(LineIt.line_number()) + ": " + Message),
Expand Down
2 changes: 1 addition & 1 deletion llvm/include/llvm/CodeGen/MachineFunction.h
Original file line number Diff line number Diff line change
Expand Up @@ -1059,7 +1059,7 @@ class LLVM_ABI MachineFunction {
AtomicOrdering Ordering = AtomicOrdering::NotAtomic,
AtomicOrdering FailureOrdering = AtomicOrdering::NotAtomic);
MachineMemOperand *getMachineMemOperand(
MachinePointerInfo PtrInfo, MachineMemOperand::Flags F, LocationSize Size,
const MachinePointerInfo &PtrInfo, MachineMemOperand::Flags F, LocationSize Size,
Align BaseAlignment, const AAMDNodes &AAInfo = AAMDNodes(),
const MDNode *Ranges = nullptr, SyncScope::ID SSID = SyncScope::System,
AtomicOrdering Ordering = AtomicOrdering::NotAtomic,
Expand Down
2 changes: 1 addition & 1 deletion llvm/include/llvm/CodeGen/SelectionDAG.h
Original file line number Diff line number Diff line change
Expand Up @@ -1408,7 +1408,7 @@ class SelectionDAG {
const MDNode *Ranges = nullptr);
inline SDValue getLoad(
ISD::MemIndexedMode AM, ISD::LoadExtType ExtType, EVT VT, const SDLoc &dl,
SDValue Chain, SDValue Ptr, SDValue Offset, MachinePointerInfo PtrInfo,
SDValue Chain, SDValue Ptr, SDValue Offset, const MachinePointerInfo &PtrInfo,
EVT MemVT, MaybeAlign Alignment = MaybeAlign(),
MachineMemOperand::Flags MMOFlags = MachineMemOperand::MONone,
const AAMDNodes &AAInfo = AAMDNodes(), const MDNode *Ranges = nullptr) {
Expand Down
4 changes: 2 additions & 2 deletions llvm/include/llvm/DWARFLinker/Classic/DWARFLinker.h
Original file line number Diff line number Diff line change
Expand Up @@ -665,7 +665,7 @@ class DWARFLinker : public DWARFLinkerBase {
CompileUnit &Unit);

/// Clone a DWARF expression that may be referencing another DIE.
void cloneExpression(DataExtractor &Data, DWARFExpression Expression,
void cloneExpression(DataExtractor &Data, const DWARFExpression &Expression,
const DWARFFile &File, CompileUnit &Unit,
SmallVectorImpl<uint8_t> &OutputBuffer,
int64_t AddrRelocAdjustment, bool IsLittleEndian);
Expand Down Expand Up @@ -709,7 +709,7 @@ class DWARFLinker : public DWARFLinkerBase {

/// Helper for cloneDIE.
void addObjCAccelerator(CompileUnit &Unit, const DIE *Die,
DwarfStringPoolEntryRef Name,
const DwarfStringPoolEntryRef &Name,
OffsetsStringPool &StringPool, bool SkipPubSection);

void rememberUnitForMacroOffset(CompileUnit &Unit);
Expand Down
8 changes: 4 additions & 4 deletions llvm/include/llvm/DWARFLinker/Classic/DWARFStreamer.h
Original file line number Diff line number Diff line change
Expand Up @@ -227,25 +227,25 @@ class DwarfStreamer : public DwarfEmitter {
/// Emit piece of .debug_ranges for \p LinkedRanges.
void emitDwarfDebugRangesTableFragment(const CompileUnit &Unit,
const AddressRanges &LinkedRanges,
PatchLocation Patch);
const PatchLocation &Patch);

/// Emit piece of .debug_rnglists for \p LinkedRanges.
void emitDwarfDebugRngListsTableFragment(const CompileUnit &Unit,
const AddressRanges &LinkedRanges,
PatchLocation Patch,
const PatchLocation &Patch,
DebugDieValuePool &AddrPool);

/// Emit piece of .debug_loc for \p LinkedRanges.
void emitDwarfDebugLocTableFragment(
const CompileUnit &Unit,
const DWARFLocationExpressionsVector &LinkedLocationExpression,
PatchLocation Patch);
const PatchLocation &Patch);

/// Emit piece of .debug_loclists for \p LinkedRanges.
void emitDwarfDebugLocListsTableFragment(
const CompileUnit &Unit,
const DWARFLocationExpressionsVector &LinkedLocationExpression,
PatchLocation Patch, DebugDieValuePool &AddrPool);
const PatchLocation &Patch, DebugDieValuePool &AddrPool);

/// \defgroup Line table emission
/// @{
Expand Down
4 changes: 2 additions & 2 deletions llvm/include/llvm/DebugInfo/CodeView/CVTypeVisitor.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@ enum VisitorDataSource {
// supply the bytes.
};

Error visitTypeRecord(CVType &Record, TypeIndex Index,
Error visitTypeRecord(CVType &Record, const TypeIndex &Index,
TypeVisitorCallbacks &Callbacks,
VisitorDataSource Source = VDS_BytesPresent);
Error visitTypeRecord(CVType &Record, TypeVisitorCallbacks &Callbacks,
VisitorDataSource Source = VDS_BytesPresent);

Error visitMemberRecord(CVMemberRecord Record, TypeVisitorCallbacks &Callbacks,
Error visitMemberRecord(const CVMemberRecord &Record, TypeVisitorCallbacks &Callbacks,
VisitorDataSource Source = VDS_BytesPresent);
Error visitMemberRecord(TypeLeafKind Kind, ArrayRef<uint8_t> Record,
TypeVisitorCallbacks &Callbacks);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class DebugInlineeLinesSubsectionRef final : public DebugSubsectionRef {
}

Error initialize(BinaryStreamReader Reader);
Error initialize(BinaryStreamRef Section) {
Error initialize(const BinaryStreamRef &Section) {
return initialize(BinaryStreamReader(Section));
}

Expand Down Expand Up @@ -101,7 +101,7 @@ class DebugInlineeLinesSubsection final : public DebugSubsection {
Error commit(BinaryStreamWriter &Writer) const override;
uint32_t calculateSerializedSize() const override;

void addInlineSite(TypeIndex FuncId, StringRef FileName, uint32_t SourceLine);
void addInlineSite(const TypeIndex &FuncId, StringRef FileName, uint32_t SourceLine);
void addExtraFile(StringRef FileName);

bool hasExtraFiles() const { return HasExtraFiles; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class DebugStringTableSubsectionRef : public DebugSubsectionRef {
return S->kind() == DebugSubsectionKind::StringTable;
}

Error initialize(BinaryStreamRef Contents);
Error initialize(const BinaryStreamRef &Contents);
Error initialize(BinaryStreamReader &Reader);

Expected<StringRef> getString(uint32_t Offset) const;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ class DWARFAbbreviationDeclaration {
getAttributeValueFromOffset(uint32_t AttrIndex, uint64_t Offset,
const DWARFUnit &U) const;

llvm::Expected<ExtractState> extract(DataExtractor Data, uint64_t *OffsetPtr);
llvm::Expected<ExtractState> extract(const DataExtractor &Data, uint64_t *OffsetPtr);
void dump(raw_ostream &OS) const;

// Return an optional byte size of all attribute data in this abbreviation
Expand Down
2 changes: 1 addition & 1 deletion llvm/include/llvm/DebugInfo/DWARF/DWARFAddressRange.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ struct DWARFAddressRange {
return true;
}

void dump(raw_ostream &OS, uint32_t AddressSize, DIDumpOptions DumpOpts = {},
void dump(raw_ostream &OS, uint32_t AddressSize, const DIDumpOptions &DumpOpts = {},
const DWARFObject *Obj = nullptr) const;
};

Expand Down
2 changes: 1 addition & 1 deletion llvm/include/llvm/DebugInfo/DWARF/DWARFDebugAbbrev.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class DWARFAbbreviationDeclarationSet {

uint64_t getOffset() const { return Offset; }
void dump(raw_ostream &OS) const;
Error extract(DataExtractor Data, uint64_t *OffsetPtr);
Error extract(const DataExtractor &Data, uint64_t *OffsetPtr);

const DWARFAbbreviationDeclaration *
getAbbreviationDeclaration(uint32_t AbbrCode) const;
Expand Down
2 changes: 1 addition & 1 deletion llvm/include/llvm/DebugInfo/DWARF/DWARFDebugAddr.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class DWARFDebugAddrTable {
Error extractPreStandard(const DWARFDataExtractor &Data, uint64_t *OffsetPtr,
uint16_t CUVersion, uint8_t CUAddrSize);

void dump(raw_ostream &OS, DIDumpOptions DumpOpts = {}) const;
void dump(raw_ostream &OS, const DIDumpOptions &DumpOpts = {}) const;

/// Return the address based on a given index.
Expected<uint64_t> getAddrEntry(uint32_t Index) const;
Expand Down
2 changes: 1 addition & 1 deletion llvm/include/llvm/DebugInfo/DWARF/DWARFDebugArangeSet.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class DWARFDebugArangeSet {
DWARFDebugArangeSet() { clear(); }

void clear();
Error extract(DWARFDataExtractor data, uint64_t *offset_ptr,
Error extract(const DWARFDataExtractor &data, uint64_t *offset_ptr,
function_ref<void(Error)> WarningHandler = nullptr);
void dump(raw_ostream &OS) const;

Expand Down
2 changes: 1 addition & 1 deletion llvm/include/llvm/DebugInfo/DWARF/DWARFDebugAranges.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class DWARFDebugAranges {

private:
void clear();
void extract(DWARFDataExtractor DebugArangesData,
void extract(const DWARFDataExtractor &DebugArangesData,
function_ref<void(Error)> RecoverableErrorHandler,
function_ref<void(Error)> WarningHandler);

Expand Down
Loading