Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit c95745f

Browse filesBrowse files
[llvm] Use StringRef::{starts_with,find} (NFC) (#139661)
Calling find/contains in the StringRef domain allows us to avoid creating temporary instances of std::string.
1 parent 294eb76 commit c95745f
Copy full SHA for c95745f

File tree

Expand file treeCollapse file tree

2 files changed

+5
-5
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+5
-5
lines changed

‎llvm/lib/DebugInfo/GSYM/DwarfTransformer.cpp

Copy file name to clipboardExpand all lines: llvm/lib/DebugInfo/GSYM/DwarfTransformer.cpp
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -780,7 +780,7 @@ llvm::Error DwarfTransformer::verify(StringRef GsymPath,
780780
const auto &dii = DwarfInlineInfos.getFrame(Idx);
781781
gsymFilename = LR->getSourceFile(Idx);
782782
// Verify function name
783-
if (dii.FunctionName.find(gii.Name.str()) != 0)
783+
if (!StringRef(dii.FunctionName).starts_with(gii.Name))
784784
Out << "error: address " << HEX64(Addr) << " DWARF function \""
785785
<< dii.FunctionName.c_str()
786786
<< "\" doesn't match GSYM function \"" << gii.Name << "\"\n";

‎llvm/lib/TableGen/Record.cpp

Copy file name to clipboardExpand all lines: llvm/lib/TableGen/Record.cpp
+4-4Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1796,11 +1796,11 @@ const Init *TernOpInit::Fold(const Record *CurRec) const {
17961796
if (LHSs && MHSs && RHSs) {
17971797
std::string Val = RHSs->getValue().str();
17981798

1799-
std::string::size_type found;
1800-
std::string::size_type idx = 0;
1799+
StringRef::size_type found;
1800+
StringRef::size_type idx = 0;
18011801
while (true) {
1802-
found = Val.find(LHSs->getValue().str(), idx);
1803-
if (found == std::string::npos)
1802+
found = StringRef(Val).find(LHSs->getValue(), idx);
1803+
if (found == StringRef::npos)
18041804
break;
18051805
Val.replace(found, LHSs->getValue().size(), MHSs->getValue().str());
18061806
idx = found + MHSs->getValue().size();

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.