mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-11-27 15:14:31 +00:00
GetPath() returns a std::string temporary. You can't reference just the c_str.
Found by the static analyzer.
This commit is contained in:
1 parent
08063f85a7
commit
1c1ffa6a30
1 file changed
+3
-3
@@ -1887,15 +1887,15 @@ public:
|
||||
m_section_infos[n_sect].vm_range.SetByteSize(
|
||||
section_sp->GetByteSize());
|
||||
} else {
|
||||
const char *filename = "<unknown>";
|
||||
std::string filename = "<unknown>";
|
||||
SectionSP first_section_sp(m_section_list->GetSectionAtIndex(0));
|
||||
if (first_section_sp)
|
||||
filename = first_section_sp->GetObjectFile()->GetFileSpec().GetPath().c_str();
|
||||
filename = first_section_sp->GetObjectFile()->GetFileSpec().GetPath();
|
||||
|
||||
Host::SystemLog(Host::eSystemLogError,
|
||||
"error: unable to find section %d for a symbol in %s, corrupt file?\n",
|
||||
n_sect,
|
||||
filename);
|
||||
filename.c_str());
|
||||
}
|
||||
}
|
||||
if (m_section_infos[n_sect].vm_range.Contains(file_addr)) {
|
||||
|
||||
Reference in new issue
Block a user