diff options
author | Alex Langford <alangford@apple.com> | 2023-05-02 10:48:53 -0700 |
---|---|---|
committer | Alex Langford <alangford@apple.com> | 2023-05-02 17:20:29 -0700 |
commit | 50e79d725c105344e292d1fe8044a69467c20346 (patch) | |
tree | aa4d38327cbabad41156cb6d1fd53a444bfbbb25 /lldb/source/Commands/CommandObjectTarget.cpp | |
parent | 79652fcdbbc6bc9bc0145447d07b947eace1f9cb (diff) | |
download | llvm-50e79d725c105344e292d1fe8044a69467c20346.zip llvm-50e79d725c105344e292d1fe8044a69467c20346.tar.gz llvm-50e79d725c105344e292d1fe8044a69467c20346.tar.bz2 |
[lldb] Minor cleanups at callsites of FileSpec::GetFileNameExtension
FileSpec::GetFileNameExtension returns a StringRef. In some cases we
are calling it and then storing the result in a local. To prevent
cases where we store the StringRef, mutate the Filespec, and then try to
use the stored StringRef afterwards, I've audited the callsites and made
adjustments to mitigate: Either marking the FileSpec it comes from as
const (to avoid mutations) or by not storing the StringRef in a local if
it makes sense not to.
Differential Revision: https://reviews.llvm.org/D149671
Diffstat (limited to 'lldb/source/Commands/CommandObjectTarget.cpp')
-rw-r--r-- | lldb/source/Commands/CommandObjectTarget.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lldb/source/Commands/CommandObjectTarget.cpp b/lldb/source/Commands/CommandObjectTarget.cpp index 6d63b30..0a1cacf 100644 --- a/lldb/source/Commands/CommandObjectTarget.cpp +++ b/lldb/source/Commands/CommandObjectTarget.cpp @@ -2161,7 +2161,7 @@ protected: } const char *pcm_path = command.GetArgumentAtIndex(0); - FileSpec pcm_file{pcm_path}; + const FileSpec pcm_file{pcm_path}; if (pcm_file.GetFileNameExtension() != ".pcm") { result.AppendError("file must have a .pcm extension"); |