[PATCH] D37652: Remove unneccessary string copies from method invocations.
Mitch Phillips via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 11 14:16:39 PDT 2017
hctim updated this revision to Diff 114697.
hctim marked 2 inline comments as done.
hctim added a comment.
Added = default for trivial constructors/destructors.
https://reviews.llvm.org/D37652
Files:
tools/llvm-objdump/llvm-objdump.cpp
Index: tools/llvm-objdump/llvm-objdump.cpp
===================================================================
--- tools/llvm-objdump/llvm-objdump.cpp
+++ tools/llvm-objdump/llvm-objdump.cpp
@@ -426,22 +426,22 @@
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() : Obj(nullptr), Symbolizer(nullptr) = 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.114697.patch
Type: text/x-patch
Size: 1546 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170911/c8fb6054/attachment.bin>
More information about the llvm-commits
mailing list