summaryrefslogtreecommitdiffstats
path: root/lldb/source/API/SBCompileUnit.cpp
diff options
context:
space:
mode:
authorPavel Labath <pavel@labath.sk>2019-05-30 08:21:25 +0000
committerPavel Labath <pavel@labath.sk>2019-05-30 08:21:25 +0000
commit833dba01d9f2393f89ed4bd69e1b3b5c084285c3 (patch)
tree2539301d8c81f07e49bf72268446f697c2a0f7a2 /lldb/source/API/SBCompileUnit.cpp
parent5857bf5d1e5a5ffe5ae51a38514ee55495c0cc69 (diff)
downloadbcm5719-llvm-833dba01d9f2393f89ed4bd69e1b3b5c084285c3.tar.gz
bcm5719-llvm-833dba01d9f2393f89ed4bd69e1b3b5c084285c3.zip
Make CompileUnit::GetSupportFiles return a const list
There's no reason for anyone to modify a list from outside of a symbol file (as that would break a lot of invariants that symbol files depend on). Make the function return a const FileSpecList and fix up a couple of places that were needlessly binding non-const references to the result of this function. llvm-svn: 362069
Diffstat (limited to 'lldb/source/API/SBCompileUnit.cpp')
-rw-r--r--lldb/source/API/SBCompileUnit.cpp14
1 files changed, 6 insertions, 8 deletions
diff --git a/lldb/source/API/SBCompileUnit.cpp b/lldb/source/API/SBCompileUnit.cpp
index 48b501043e1..c9ca70645d9 100644
--- a/lldb/source/API/SBCompileUnit.cpp
+++ b/lldb/source/API/SBCompileUnit.cpp
@@ -118,10 +118,9 @@ uint32_t SBCompileUnit::FindLineEntryIndex(uint32_t start_idx, uint32_t line,
uint32_t SBCompileUnit::GetNumSupportFiles() const {
LLDB_RECORD_METHOD_CONST_NO_ARGS(uint32_t, SBCompileUnit, GetNumSupportFiles);
- if (m_opaque_ptr) {
- FileSpecList &support_files = m_opaque_ptr->GetSupportFiles();
- return support_files.GetSize();
- }
+ if (m_opaque_ptr)
+ return m_opaque_ptr->GetSupportFiles().GetSize();
+
return 0;
}
@@ -155,9 +154,8 @@ SBFileSpec SBCompileUnit::GetSupportFileAtIndex(uint32_t idx) const {
SBFileSpec sb_file_spec;
if (m_opaque_ptr) {
- FileSpecList &support_files = m_opaque_ptr->GetSupportFiles();
- FileSpec file_spec = support_files.GetFileSpecAtIndex(idx);
- sb_file_spec.SetFileSpec(file_spec);
+ FileSpec spec = m_opaque_ptr->GetSupportFiles().GetFileSpecAtIndex(idx);
+ sb_file_spec.SetFileSpec(spec);
}
@@ -172,7 +170,7 @@ uint32_t SBCompileUnit::FindSupportFileIndex(uint32_t start_idx,
sb_file, full);
if (m_opaque_ptr) {
- FileSpecList &support_files = m_opaque_ptr->GetSupportFiles();
+ const FileSpecList &support_files = m_opaque_ptr->GetSupportFiles();
return support_files.FindFileIndex(start_idx, sb_file.ref(), full);
}
return 0;
OpenPOWER on IntegriCloud