[PATCH] D37652: Remove unneccessary string copies from method invocations.
Vlad Tsyrklevich via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 11 19:29:10 PDT 2017
This revision was automatically updated to reflect the committed changes.
Closed by commit rL312994: Remove unneccessary string copies from method invocations. (authored by vlad.tsyrklevich).
Changed prior to commit:
https://reviews.llvm.org/D37652?vs=114721&id=114755#toc
Repository:
rL LLVM
https://reviews.llvm.org/D37652
Files:
llvm/trunk/tools/llvm-objdump/llvm-objdump.cpp
Index: llvm/trunk/tools/llvm-objdump/llvm-objdump.cpp
===================================================================
--- llvm/trunk/tools/llvm-objdump/llvm-objdump.cpp
+++ llvm/trunk/tools/llvm-objdump/llvm-objdump.cpp
@@ -418,30 +418,30 @@
class SourcePrinter {
protected:
DILineInfo OldLineInfo;
- const ObjectFile *Obj;
+ const ObjectFile *Obj = nullptr;
std::unique_ptr<symbolize::LLVMSymbolizer> Symbolizer;
// File name to file contents of source
std::unordered_map<std::string, std::unique_ptr<MemoryBuffer>> SourceCache;
// Mark the line endings of the cached source
std::unordered_map<std::string, std::vector<StringRef>> LineCache;
private:
- bool cacheSource(std::string File);
+ bool cacheSource(const std::string& File);
public:
- virtual ~SourcePrinter() {}
- SourcePrinter() : Obj(nullptr), Symbolizer(nullptr) {}
+ SourcePrinter() = default;
SourcePrinter(const ObjectFile *Obj, StringRef DefaultArch) : Obj(Obj) {
symbolize::LLVMSymbolizer::Options SymbolizerOpts(
DILineInfoSpecifier::FunctionNameKind::None, true, false, false,
DefaultArch);
Symbolizer.reset(new symbolize::LLVMSymbolizer(SymbolizerOpts));
}
+ virtual ~SourcePrinter() = default;
virtual void printSourceLine(raw_ostream &OS, uint64_t Address,
StringRef Delimiter = "; ");
};
-bool SourcePrinter::cacheSource(std::string File) {
+bool SourcePrinter::cacheSource(const std::string& File) {
auto BufferOrError = MemoryBuffer::getFile(File);
if (!BufferOrError)
return false;
@@ -509,7 +509,7 @@
class PrettyPrinter {
public:
- virtual ~PrettyPrinter(){}
+ virtual ~PrettyPrinter() = default;
virtual void printInst(MCInstPrinter &IP, const MCInst *MI,
ArrayRef<uint8_t> Bytes, uint64_t Address,
raw_ostream &OS, StringRef Annot,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D37652.114755.patch
Type: text/x-patch
Size: 1896 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170912/02aa1f37/attachment.bin>
More information about the llvm-commits
mailing list