AAlex Langford[lldb] Refactor ObjCLanguage::MethodName
| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
[lldb][NFCI] Add unittests for ObjCLanguage::MethodName I have a patch to refactor this class and I'd like a unittest in place to make sure I don't break anything. Differential Revision: https://reviews.llvm.org/D149804 | 3 年前 | |
[lldb] Refactor ObjCLanguage::MethodName The goal of this patch is to make it easier to reason about the state of ObjCLanguage::MethodName. I do that in several ways: - Instead of using the constructor directly, you go through a factory method. It returns a std::optional<MethodName> so either you got an ObjCLanguage::MethodName or you didn't. No more checking if it's valid to know if you can use it or not. - ObjCLanguage::MethodName is now immutable. You cannot change its internals once it is created. - ObjCLanguage::MethodName::GetFullNameWithoutCategory previously had a parameter that let you get back an empty string if the method had no category. Every caller of this method was enabling this behavior so I dropped the parameter and made it the default behavior. - No longer store all the various components of the method name as ConstStrings. The relevant Get methods now return llvm::StringRefs backed by the MethodName's internal storage. The lifetime of these StringRefs are tied to the MethodName itself, so if you need to persist these you need to create copies. Differential Revision: https://reviews.llvm.org/D149914 | 3 年前 |