diff options
author | Matthias Braun <matze@braunis.de> | 2016-12-04 05:48:03 +0000 |
---|---|---|
committer | Matthias Braun <matze@braunis.de> | 2016-12-04 05:48:03 +0000 |
commit | 5ce905766623bc0039fd5ae158ac99ae990acae5 (patch) | |
tree | a7b7bdf2fbb68ac4d22394afc0673564d537f362 /llvm/lib/TableGen/TGParser.h | |
parent | 28f22ae15eb3df52138b5d15cfb435debf7a144f (diff) | |
download | bcm5719-llvm-5ce905766623bc0039fd5ae158ac99ae990acae5.tar.gz bcm5719-llvm-5ce905766623bc0039fd5ae158ac99ae990acae5.zip |
TableGen: Use StringRef instead of const std::string& for parameters
This avoid an extra construction of a std::string (and a heap
allocation) when the caller only has a StringRef but no std::string at
hand.
llvm-svn: 288610
Diffstat (limited to 'llvm/lib/TableGen/TGParser.h')
-rw-r--r-- | llvm/lib/TableGen/TGParser.h | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/llvm/lib/TableGen/TGParser.h b/llvm/lib/TableGen/TGParser.h index 739d9a9c5f3..4b163e67bc1 100644 --- a/llvm/lib/TableGen/TGParser.h +++ b/llvm/lib/TableGen/TGParser.h @@ -36,8 +36,7 @@ namespace llvm { std::vector<unsigned> Bits; Init *Value; SMLoc Loc; - LetRecord(const std::string &N, const std::vector<unsigned> &B, Init *V, - SMLoc L) + LetRecord(StringRef N, const std::vector<unsigned> &B, Init *V, SMLoc L) : Name(N), Bits(B), Value(V), Loc(L) { } }; @@ -107,7 +106,7 @@ private: // Semantic analysis methods. bool SetValue(Record *TheRec, SMLoc Loc, Init *ValName, ArrayRef<unsigned> BitList, Init *V, bool AllowSelfAssignment = false); - bool SetValue(Record *TheRec, SMLoc Loc, const std::string &ValName, + bool SetValue(Record *TheRec, SMLoc Loc, StringRef ValName, ArrayRef<unsigned> BitList, Init *V, bool AllowSelfAssignment = false) { return SetValue(TheRec, Loc, StringInit::get(ValName), BitList, V, @@ -168,7 +167,7 @@ private: // Parser methods. SubClassReference ParseSubClassReference(Record *CurRec, bool isDefm); SubMultiClassReference ParseSubMultiClassReference(MultiClass *CurMC); - Init *ParseIDValue(Record *CurRec, const std::string &Name, SMLoc NameLoc, + Init *ParseIDValue(Record *CurRec, StringRef Name, SMLoc NameLoc, IDParseMode Mode = ParseValueMode); Init *ParseSimpleValue(Record *CurRec, RecTy *ItemType = nullptr, IDParseMode Mode = ParseValueMode); |