summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorGeorge Rimar <grimar@accesssoftek.com>2017-11-22 07:53:48 +0000
committerGeorge Rimar <grimar@accesssoftek.com>2017-11-22 07:53:48 +0000
commit808577ca746ae2453cfbf6facc923efa4cbb8d4d (patch)
tree82336d9ccc50ff486f5d45f006cc9576aa548c4b /utils
parentfa5b169130d3175f4ae2e34d02ef81ae3ccd0d23 (diff)
[llvm-tblgen] - Stop using std::string in RecordKeeper.
RecordKeeper::getDef() is a hot place, it shows up in profiling and it creates std::string instance for each search in RecordMap though RecordKeeper::RecordMap can use StringRef as a key instead to avoid that. Patch do that change. Differential revision: https://reviews.llvm.org/D40170 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@318822 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils')
-rw-r--r--utils/TableGen/CTagsEmitter.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/utils/TableGen/CTagsEmitter.cpp b/utils/TableGen/CTagsEmitter.cpp
index 5213cd90446..e72430078ba 100644
--- a/utils/TableGen/CTagsEmitter.cpp
+++ b/utils/TableGen/CTagsEmitter.cpp
@@ -28,18 +28,17 @@ namespace {
class Tag {
private:
- const std::string *Id;
+ StringRef Id;
SMLoc Loc;
public:
- Tag(const std::string &Name, const SMLoc Location)
- : Id(&Name), Loc(Location) {}
- int operator<(const Tag &B) const { return *Id < *B.Id; }
+ Tag(StringRef Name, const SMLoc Location) : Id(Name), Loc(Location) {}
+ int operator<(const Tag &B) const { return Id < B.Id; }
void emit(raw_ostream &OS) const {
const MemoryBuffer *CurMB =
SrcMgr.getMemoryBuffer(SrcMgr.FindBufferContainingLoc(Loc));
auto BufferName = CurMB->getBufferIdentifier();
std::pair<unsigned, unsigned> LineAndColumn = SrcMgr.getLineAndColumn(Loc);
- OS << *Id << "\t" << BufferName << "\t" << LineAndColumn.first << "\n";
+ OS << Id << "\t" << BufferName << "\t" << LineAndColumn.first << "\n";
}
};