llvm-project/lldb/source/Target
Greg Clayton 529a3d87a7 [NFC] Improve FileSpec internal APIs and usage in preparation for adding caching of resolved/absolute.
Resubmission of https://reviews.llvm.org/D130309 with the 2 patches that fixed the linux buildbot, and new windows fixes.

The FileSpec APIs allow users to modify instance variables directly by getting a non const reference to the directory and filename instance variables. This makes it impossible to control all of the times the FileSpec object is modified so we can clear cached member variables like m_resolved and with an upcoming patch caching if the file is relative or absolute. This patch modifies the APIs of FileSpec so no one can modify the directory or filename instance variables directly by adding set accessors and by removing the get accessors that are non const.

Many clients were using FileSpec::GetCString(...) which returned a unique C string from a ConstString'ified version of the result of GetPath() which returned a std::string. This caused many locations to use this convenient function incorrectly and could cause many strings to be added to the constant string pool that didn't need to. Most clients were converted to using FileSpec::GetPath().c_str() when possible. Other clients were modified to use the newly renamed version of this function which returns an actualy ConstString:

ConstString FileSpec::GetPathAsConstString(bool denormalize = true) const;

This avoids the issue where people were getting an already uniqued "const char *" that came from a ConstString only to put the "const char *" back into a "ConstString" object. By returning the ConstString instead of a "const char *" clients can be more efficient with the result.

The patch:
- Removes the non const GetDirectory() and GetFilename() get accessors
- Adds set accessors to replace the above functions: SetDirectory() and SetFilename().
- Adds ClearDirectory() and ClearFilename() to replace usage of the FileSpec::GetDirectory().Clear()/FileSpec::GetFilename().Clear() call sites
- Fixed all incorrect usage of FileSpec::GetCString() to use FileSpec::GetPath().c_str() where appropriate, and updated other call sites that wanted a ConstString to use the newly returned ConstString appropriately and efficiently.

Differential Revision: https://reviews.llvm.org/D130549
2022-07-28 13:28:26 -07:00
..
ABI.cpp [lldb] Rename Logging.h to LLDBLog.h and clean up includes 2022-02-03 14:47:01 +01:00
AssertFrameRecognizer.cpp [lldb] Rename Logging.h to LLDBLog.h and clean up includes 2022-02-03 14:47:01 +01:00
CMakeLists.txt [trace] Make events first class items in the trace cursor and rework errors 2022-06-29 09:19:51 -07:00
DynamicRegisterInfo.cpp Use the range-based overload of llvm::sort where possible 2022-07-23 15:13:25 +02:00
ExecutionContext.cpp [LLDB] Applying clang-tidy modernize-use-equals-default over LLDB 2022-03-31 13:21:49 -07:00
InstrumentationRuntime.cpp
InstrumentationRuntimeStopInfo.cpp
JITLoader.cpp
JITLoaderList.cpp [lldb] Replace default bodies of special member functions with = default; 2021-07-02 11:31:16 -07:00
Language.cpp We don't require users to type out the full context of a function, for 2022-05-12 12:39:28 -07:00
LanguageRuntime.cpp [LLDB] Applying clang-tidy modernize-use-default-member-init over LLDB 2022-03-14 13:32:03 -07:00
Memory.cpp [lldb] Rename Logging.h to LLDBLog.h and clean up includes 2022-02-03 14:47:01 +01:00
MemoryHistory.cpp
MemoryRegionInfo.cpp
MemoryTagMap.cpp [lldb] Add MemoryTagMap class 2022-01-26 13:55:48 +00:00
ModuleCache.cpp [lldb] Rename Logging.h to LLDBLog.h and clean up includes 2022-02-03 14:47:01 +01:00
OperatingSystem.cpp [lldb] Remove ConstString from GetPluginNameStatic of some plugins 2021-10-21 12:58:45 +02:00
PathMappingList.cpp [lldb] Use value_or instead of getValueOr (NFC) 2022-06-19 09:12:01 -07:00
Platform.cpp [NFC] Improve FileSpec internal APIs and usage in preparation for adding caching of resolved/absolute. 2022-07-28 13:28:26 -07:00
Process.cpp [LLDB][NFC][Reliability] Fix uninitialized variables from Coverity scan. Part 2 2022-07-25 20:52:45 -07:00
ProcessTrace.cpp [lldb] Remove non-address bits from read/write addresses in lldb 2022-05-18 12:59:34 +01:00
Queue.cpp
QueueItem.cpp [lldb] Replace default bodies of special member functions with = default; 2021-07-02 11:31:16 -07:00
QueueList.cpp
RegisterContext.cpp Recommit: [lldb] Remove "dwarf dynamic register size expressions" from RegisterInfo 2021-10-07 11:15:00 +02:00
RegisterContextUnwind.cpp [LLDB][NFC][Reliability] Fix uninitialized variables from Coverity scan. Part 2 2022-07-25 20:52:45 -07:00
RegisterNumber.cpp [lldb] Use C++11 default member initializers 2021-06-09 09:43:13 -07:00
RemoteAwarePlatform.cpp [lldb] Move host platform implementations into the base class 2022-04-05 11:22:37 +02:00
SectionLoadHistory.cpp
SectionLoadList.cpp [lldb] Rename Logging.h to LLDBLog.h and clean up includes 2022-02-03 14:47:01 +01:00
StackFrame.cpp StackFrame::GetValueObjectForFrameVariable holds the StackFrame lock too long. 2022-07-26 10:13:19 -07:00
StackFrameList.cpp [lldb] Rename Logging.h to LLDBLog.h and clean up includes 2022-02-03 14:47:01 +01:00
StackFrameRecognizer.cpp
StackID.cpp
Statistics.cpp Introduce new symbol on-demand for debug info 2022-04-26 10:42:06 -07:00
StopInfo.cpp Revert "Make hit point counts reliable for architectures that stop before evaluation." 2022-07-18 17:38:43 -07:00
StructuredDataPlugin.cpp [lldb] Replace default bodies of special member functions with = default; 2021-07-02 11:31:16 -07:00
SystemRuntime.cpp
Target.cpp [NFC] Improve FileSpec internal APIs and usage in preparation for adding caching of resolved/absolute. 2022-07-28 13:28:26 -07:00
TargetList.cpp [NFC] Improve FileSpec internal APIs and usage in preparation for adding caching of resolved/absolute. 2022-07-28 13:28:26 -07:00
TargetProperties.td The help string for stop-on-shared-library-load was copied to stop-on-exec. 2022-06-23 13:54:50 -07:00
Thread.cpp Use value instead of getValue (NFC) 2022-07-15 20:03:13 -07:00
ThreadCollection.cpp [lldb][NFC] Use C++ versions of the deprecated C standard library headers 2021-05-26 12:46:12 +02:00
ThreadList.cpp [lldb] Rename Logging.h to LLDBLog.h and clean up includes 2022-02-03 14:47:01 +01:00
ThreadPlan.cpp [lldb] Rename Logging.h to LLDBLog.h and clean up includes 2022-02-03 14:47:01 +01:00
ThreadPlanBase.cpp [lldb] Rename Logging.h to LLDBLog.h and clean up includes 2022-02-03 14:47:01 +01:00
ThreadPlanCallFunction.cpp [LLDB][NFC][Reliability] Fix uninitialized variables from Coverity scan. Part 2 2022-07-25 20:52:45 -07:00
ThreadPlanCallFunctionUsingABI.cpp
ThreadPlanCallOnFunctionExit.cpp [lldb][NFC] Inclusive Language: rename master plan to controlling plan 2021-11-11 15:04:44 -06:00
ThreadPlanCallUserExpression.cpp [lldb] Rename Logging.h to LLDBLog.h and clean up includes 2022-02-03 14:47:01 +01:00
ThreadPlanPython.cpp [lldb] Rename Logging.h to LLDBLog.h and clean up includes 2022-02-03 14:47:01 +01:00
ThreadPlanRunToAddress.cpp [lldb] Rename Logging.h to LLDBLog.h and clean up includes 2022-02-03 14:47:01 +01:00
ThreadPlanShouldStopHere.cpp [lldb] Rename Logging.h to LLDBLog.h and clean up includes 2022-02-03 14:47:01 +01:00
ThreadPlanStack.cpp Add a mutex to the ThreadPlanStackMap class. 2022-04-29 11:07:22 -07:00
ThreadPlanStepInRange.cpp [lldb] Fix step-avoid-regexp logging 2022-03-09 08:35:15 -08:00
ThreadPlanStepInstruction.cpp [lldb] Rename Logging.h to LLDBLog.h and clean up includes 2022-02-03 14:47:01 +01:00
ThreadPlanStepOut.cpp [lldb] Rename Logging.h to LLDBLog.h and clean up includes 2022-02-03 14:47:01 +01:00
ThreadPlanStepOverBreakpoint.cpp [lldb] Rename Logging.h to LLDBLog.h and clean up includes 2022-02-03 14:47:01 +01:00
ThreadPlanStepOverRange.cpp [lldb] Rename Logging.h to LLDBLog.h and clean up includes 2022-02-03 14:47:01 +01:00
ThreadPlanStepRange.cpp [lldb] Rename Logging.h to LLDBLog.h and clean up includes 2022-02-03 14:47:01 +01:00
ThreadPlanStepThrough.cpp [lldb] Rename Logging.h to LLDBLog.h and clean up includes 2022-02-03 14:47:01 +01:00
ThreadPlanStepUntil.cpp [lldb] Rename Logging.h to LLDBLog.h and clean up includes 2022-02-03 14:47:01 +01:00
ThreadPlanTracer.cpp [LLDB][NFC][Reliability] Fix uninitialized variables from Coverity scan. Part 2 2022-07-25 20:52:45 -07:00
ThreadSpec.cpp [lldb] Use C++11 default member initializers 2021-06-09 09:43:13 -07:00
Trace.cpp [NFC] Improve FileSpec internal APIs and usage in preparation for adding caching of resolved/absolute. 2022-07-28 13:28:26 -07:00
TraceCursor.cpp [trace][intel pt] Introduce wall clock time for each trace item 2022-07-26 12:05:23 -07:00
TraceDumper.cpp [trace] Add instruction control flow kind to JSON trace dumper's output 2022-07-27 05:23:59 -07:00
TraceExporter.cpp [lldb] Remove ConstString from SymbolVendor, Trace, TraceExporter, UnwindAssembly, MemoryHistory and InstrumentationRuntime plugin names 2021-10-29 12:08:57 +02:00
UnixSignals.cpp Use value instead of getValue (NFC) 2022-07-15 20:03:13 -07:00
UnwindAssembly.cpp
UnwindLLDB.cpp [lldb] Rename Logging.h to LLDBLog.h and clean up includes 2022-02-03 14:47:01 +01:00