[llvm] 3d1200b - [llvm] Drop unnecessary const from return types (NFC)
Kazu Hirata via llvm-commits
llvm-commits at lists.llvm.org
Sun Jan 31 10:24:14 PST 2021
Author: Kazu Hirata
Date: 2021-01-31T10:23:43-08:00
New Revision: 3d1200b9f6e305ea66080bb93fd34753c46066a1
URL: https://github.com/llvm/llvm-project/commit/3d1200b9f6e305ea66080bb93fd34753c46066a1
DIFF: https://github.com/llvm/llvm-project/commit/3d1200b9f6e305ea66080bb93fd34753c46066a1.diff
LOG: [llvm] Drop unnecessary const from return types (NFC)
Identified with const-return-type.
Added:
Modified:
llvm/include/llvm/Analysis/DDG.h
llvm/include/llvm/Analysis/LoopCacheAnalysis.h
llvm/include/llvm/IR/DerivedTypes.h
llvm/include/llvm/MCA/Instruction.h
llvm/include/llvm/Object/WindowsResource.h
llvm/include/llvm/TableGen/DirectiveEmitter.h
llvm/include/llvm/Transforms/IPO/SampleContextTracker.h
llvm/lib/Target/X86/X86MachineFunctionInfo.h
llvm/lib/Transforms/IPO/SampleContextTracker.cpp
llvm/tools/dsymutil/DebugMap.h
llvm/tools/llvm-profgen/ProfiledBinary.h
llvm/tools/llvm-readobj/ELFDumper.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/Analysis/DDG.h b/llvm/include/llvm/Analysis/DDG.h
index e3bef33e55c3..5317b6e7877e 100644
--- a/llvm/include/llvm/Analysis/DDG.h
+++ b/llvm/include/llvm/Analysis/DDG.h
@@ -275,7 +275,7 @@ template <typename NodeType> class DependenceGraphInfo {
virtual ~DependenceGraphInfo() {}
/// Return the label that is used to name this graph.
- const StringRef getName() const { return Name; }
+ StringRef getName() const { return Name; }
/// Return the root node of the graph.
NodeType &getRoot() const {
diff --git a/llvm/include/llvm/Analysis/LoopCacheAnalysis.h b/llvm/include/llvm/Analysis/LoopCacheAnalysis.h
index e8f2205545eb..21882ebd0087 100644
--- a/llvm/include/llvm/Analysis/LoopCacheAnalysis.h
+++ b/llvm/include/llvm/Analysis/LoopCacheAnalysis.h
@@ -205,7 +205,7 @@ class CacheCost {
}
/// Return the estimated ordered loop costs.
- const ArrayRef<LoopCacheCostTy> getLoopCosts() const { return LoopCosts; }
+ ArrayRef<LoopCacheCostTy> getLoopCosts() const { return LoopCosts; }
private:
/// Calculate the cache footprint of each loop in the nest (when it is
diff --git a/llvm/include/llvm/IR/DerivedTypes.h b/llvm/include/llvm/IR/DerivedTypes.h
index 4c89fc089229..41814d5b50fe 100644
--- a/llvm/include/llvm/IR/DerivedTypes.h
+++ b/llvm/include/llvm/IR/DerivedTypes.h
@@ -318,7 +318,7 @@ class StructType : public Type {
element_iterator element_begin() const { return ContainedTys; }
element_iterator element_end() const { return &ContainedTys[NumContainedTys];}
- ArrayRef<Type *> const elements() const {
+ ArrayRef<Type *> elements() const {
return makeArrayRef(element_begin(), element_end());
}
diff --git a/llvm/include/llvm/MCA/Instruction.h b/llvm/include/llvm/MCA/Instruction.h
index c97cb463d0f5..1e089579f4f1 100644
--- a/llvm/include/llvm/MCA/Instruction.h
+++ b/llvm/include/llvm/MCA/Instruction.h
@@ -412,9 +412,9 @@ class InstructionBase {
InstructionBase(const InstrDesc &D) : Desc(D), IsOptimizableMove(false) {}
SmallVectorImpl<WriteState> &getDefs() { return Defs; }
- const ArrayRef<WriteState> getDefs() const { return Defs; }
+ ArrayRef<WriteState> getDefs() const { return Defs; }
SmallVectorImpl<ReadState> &getUses() { return Uses; }
- const ArrayRef<ReadState> getUses() const { return Uses; }
+ ArrayRef<ReadState> getUses() const { return Uses; }
const InstrDesc &getDesc() const { return Desc; }
unsigned getLatency() const { return Desc.MaxLatency; }
diff --git a/llvm/include/llvm/Object/WindowsResource.h b/llvm/include/llvm/Object/WindowsResource.h
index a0d658491cb9..788992814ab7 100644
--- a/llvm/include/llvm/Object/WindowsResource.h
+++ b/llvm/include/llvm/Object/WindowsResource.h
@@ -160,10 +160,8 @@ class WindowsResourceParser {
void cleanUpManifests(std::vector<std::string> &Duplicates);
void printTree(raw_ostream &OS) const;
const TreeNode &getTree() const { return Root; }
- const ArrayRef<std::vector<uint8_t>> getData() const { return Data; }
- const ArrayRef<std::vector<UTF16>> getStringTable() const {
- return StringTable;
- }
+ ArrayRef<std::vector<uint8_t>> getData() const { return Data; }
+ ArrayRef<std::vector<UTF16>> getStringTable() const { return StringTable; }
class TreeNode {
public:
diff --git a/llvm/include/llvm/TableGen/DirectiveEmitter.h b/llvm/include/llvm/TableGen/DirectiveEmitter.h
index 27ad0665a0e8..8f88802eea9d 100644
--- a/llvm/include/llvm/TableGen/DirectiveEmitter.h
+++ b/llvm/include/llvm/TableGen/DirectiveEmitter.h
@@ -93,7 +93,7 @@ class BaseRecord {
bool isDefault() const { return Def->getValueAsBit("isDefault"); }
// Returns the record name.
- const StringRef getRecordName() const { return Def->getName(); }
+ StringRef getRecordName() const { return Def->getName(); }
protected:
const llvm::Record *Def;
diff --git a/llvm/include/llvm/Transforms/IPO/SampleContextTracker.h b/llvm/include/llvm/Transforms/IPO/SampleContextTracker.h
index 5b2600144fa3..e35213449ada 100644
--- a/llvm/include/llvm/Transforms/IPO/SampleContextTracker.h
+++ b/llvm/include/llvm/Transforms/IPO/SampleContextTracker.h
@@ -53,7 +53,7 @@ class ContextTrieNode {
bool DeleteNode = true);
void removeChildContext(const LineLocation &CallSite, StringRef CalleeName);
std::map<uint32_t, ContextTrieNode> &getAllChildContext();
- const StringRef getFuncName() const;
+ StringRef getFuncName() const;
FunctionSamples *getFunctionSamples() const;
void setFunctionSamples(FunctionSamples *FSamples);
LineLocation getCallSiteLoc() const;
diff --git a/llvm/lib/Target/X86/X86MachineFunctionInfo.h b/llvm/lib/Target/X86/X86MachineFunctionInfo.h
index eedad952c3b9..ecb86bb9e8c1 100644
--- a/llvm/lib/Target/X86/X86MachineFunctionInfo.h
+++ b/llvm/lib/Target/X86/X86MachineFunctionInfo.h
@@ -219,7 +219,7 @@ class X86MachineFunctionInfo : public MachineFunctionInfo {
PreallocatedArgOffsets[Id].assign(AO.begin(), AO.end());
}
- const ArrayRef<size_t> getPreallocatedArgOffsets(const size_t Id) {
+ ArrayRef<size_t> getPreallocatedArgOffsets(const size_t Id) {
assert(!PreallocatedArgOffsets[Id].empty() && "arg offsets not set");
return PreallocatedArgOffsets[Id];
}
diff --git a/llvm/lib/Transforms/IPO/SampleContextTracker.cpp b/llvm/lib/Transforms/IPO/SampleContextTracker.cpp
index 660d79de667c..2327b93ece67 100644
--- a/llvm/lib/Transforms/IPO/SampleContextTracker.cpp
+++ b/llvm/lib/Transforms/IPO/SampleContextTracker.cpp
@@ -113,7 +113,7 @@ std::map<uint32_t, ContextTrieNode> &ContextTrieNode::getAllChildContext() {
return AllChildContext;
}
-const StringRef ContextTrieNode::getFuncName() const { return FuncName; }
+StringRef ContextTrieNode::getFuncName() const { return FuncName; }
FunctionSamples *ContextTrieNode::getFunctionSamples() const {
return FuncSamples;
diff --git a/llvm/tools/dsymutil/DebugMap.h b/llvm/tools/dsymutil/DebugMap.h
index ee552ed98379..e4fbaa81174b 100644
--- a/llvm/tools/dsymutil/DebugMap.h
+++ b/llvm/tools/dsymutil/DebugMap.h
@@ -114,9 +114,7 @@ class DebugMap {
const Triple &getTriple() const { return BinaryTriple; }
- const ArrayRef<uint8_t> getUUID() const {
- return ArrayRef<uint8_t>(BinaryUUID);
- }
+ ArrayRef<uint8_t> getUUID() const { return ArrayRef<uint8_t>(BinaryUUID); }
StringRef getBinaryPath() const { return BinaryPath; }
diff --git a/llvm/tools/llvm-profgen/ProfiledBinary.h b/llvm/tools/llvm-profgen/ProfiledBinary.h
index bb028da2b484..87fdf4b4f214 100644
--- a/llvm/tools/llvm-profgen/ProfiledBinary.h
+++ b/llvm/tools/llvm-profgen/ProfiledBinary.h
@@ -179,8 +179,8 @@ class ProfiledBinary {
uint64_t offsetToVirtualAddr(uint64_t Offset) const {
return Offset + BaseAddress;
}
- const StringRef getPath() const { return Path; }
- const StringRef getName() const { return llvm::sys::path::filename(Path); }
+ StringRef getPath() const { return Path; }
+ StringRef getName() const { return llvm::sys::path::filename(Path); }
uint64_t getBaseAddress() const { return BaseAddress; }
void setBaseAddress(uint64_t Address) { BaseAddress = Address; }
uint64_t getPreferredBaseAddress() const { return PreferredBaseAddress; }
diff --git a/llvm/tools/llvm-readobj/ELFDumper.cpp b/llvm/tools/llvm-readobj/ELFDumper.cpp
index 0f508f8dc0f2..4f6e984527e9 100644
--- a/llvm/tools/llvm-readobj/ELFDumper.cpp
+++ b/llvm/tools/llvm-readobj/ELFDumper.cpp
@@ -5141,8 +5141,7 @@ static const NoteType CoreNoteTypes[] = {
};
template <class ELFT>
-const StringRef getNoteTypeName(const typename ELFT::Note &Note,
- unsigned ELFType) {
+StringRef getNoteTypeName(const typename ELFT::Note &Note, unsigned ELFType) {
uint32_t Type = Note.getType();
auto FindNote = [&](ArrayRef<NoteType> V) -> StringRef {
for (const NoteType &N : V)
More information about the llvm-commits
mailing list