[Lldb-commits] [PATCH] D59030: Pass ConstString by value

Adrian Prantl via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed Mar 6 09:29:21 PST 2019


aprantl created this revision.
aprantl added reviewers: clayborg, shafik, jasonmolenda.
Herald added subscribers: jdoerfert, arphaman, MaskRay, arichardson, emaste.
Herald added a reviewer: espindola.
Herald added a project: LLDB.

My apologies for the large patch. With the exception of `ConstString.h` itself it was entirely produced by sed.

I technically only need one of these changes to fix a taking-reference-of-local-object bug that Jason discovered on the swift-lldb branch, but while I'm at it I thought I might as well do all at once.

ConstString has exactly one `const char *` data member, so passing a ConstString by reference is not any more efficient than copying it by value. In both cases a single pointer is passed. But passing it by value makes it harder to accidentally return the address of a local object.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D59030

Files:
  lldb/docs/structured_data/StructuredDataPlugins.md
  lldb/include/lldb/Breakpoint/Breakpoint.h
  lldb/include/lldb/Breakpoint/BreakpointName.h
  lldb/include/lldb/Breakpoint/BreakpointResolverName.h
  lldb/include/lldb/Breakpoint/Watchpoint.h
  lldb/include/lldb/Core/Debugger.h
  lldb/include/lldb/Core/Disassembler.h
  lldb/include/lldb/Core/Mangled.h
  lldb/include/lldb/Core/Module.h
  lldb/include/lldb/Core/ModuleList.h
  lldb/include/lldb/Core/ModuleSpec.h
  lldb/include/lldb/Core/PluginManager.h
  lldb/include/lldb/Core/RichManglingContext.h
  lldb/include/lldb/Core/Section.h
  lldb/include/lldb/Core/UserSettingsController.h
  lldb/include/lldb/Core/ValueObject.h
  lldb/include/lldb/Core/ValueObjectCast.h
  lldb/include/lldb/Core/ValueObjectChild.h
  lldb/include/lldb/Core/ValueObjectConstResult.h
  lldb/include/lldb/Core/ValueObjectConstResultCast.h
  lldb/include/lldb/Core/ValueObjectConstResultChild.h
  lldb/include/lldb/Core/ValueObjectRegister.h
  lldb/include/lldb/Core/ValueObjectSyntheticFilter.h
  lldb/include/lldb/DataFormatters/DataVisualization.h
  lldb/include/lldb/DataFormatters/FormatCache.h
  lldb/include/lldb/DataFormatters/FormatManager.h
  lldb/include/lldb/DataFormatters/FormattersContainer.h
  lldb/include/lldb/DataFormatters/TypeSynthetic.h
  lldb/include/lldb/DataFormatters/VectorIterator.h
  lldb/include/lldb/Expression/ExpressionVariable.h
  lldb/include/lldb/Expression/IRExecutionUnit.h
  lldb/include/lldb/Interpreter/OptionGroupPlatform.h
  lldb/include/lldb/Interpreter/OptionValueDictionary.h
  lldb/include/lldb/Interpreter/OptionValueProperties.h
  lldb/include/lldb/Interpreter/Property.h
  lldb/include/lldb/Symbol/ClangASTContext.h
  lldb/include/lldb/Symbol/ClangASTImporter.h
  lldb/include/lldb/Symbol/CompilerType.h
  lldb/include/lldb/Symbol/DeclVendor.h
  lldb/include/lldb/Symbol/Function.h
  lldb/include/lldb/Symbol/Symbol.h
  lldb/include/lldb/Symbol/SymbolContext.h
  lldb/include/lldb/Symbol/SymbolFile.h
  lldb/include/lldb/Symbol/SymbolVendor.h
  lldb/include/lldb/Symbol/Symtab.h
  lldb/include/lldb/Symbol/Type.h
  lldb/include/lldb/Symbol/TypeList.h
  lldb/include/lldb/Symbol/TypeMap.h
  lldb/include/lldb/Symbol/TypeSystem.h
  lldb/include/lldb/Symbol/Variable.h
  lldb/include/lldb/Symbol/VariableList.h
  lldb/include/lldb/Target/ABI.h
  lldb/include/lldb/Target/MemoryRegionInfo.h
  lldb/include/lldb/Target/ObjCLanguageRuntime.h
  lldb/include/lldb/Target/PathMappingList.h
  lldb/include/lldb/Target/Platform.h
  lldb/include/lldb/Target/Process.h
  lldb/include/lldb/Target/StackFrameRecognizer.h
  lldb/include/lldb/Target/StructuredDataPlugin.h
  lldb/include/lldb/Target/Target.h
  lldb/include/lldb/Target/Thread.h
  lldb/include/lldb/Utility/ArchSpec.h
  lldb/include/lldb/Utility/Broadcaster.h
  lldb/include/lldb/Utility/ConstString.h
  lldb/include/lldb/Utility/Event.h
  lldb/include/lldb/Utility/FileSpec.h
  lldb/include/lldb/Utility/Log.h
  lldb/source/API/SBType.cpp
  lldb/source/Breakpoint/Breakpoint.cpp
  lldb/source/Breakpoint/BreakpointName.cpp
  lldb/source/Breakpoint/BreakpointResolverName.cpp
  lldb/source/Breakpoint/Watchpoint.cpp
  lldb/source/Commands/CommandObjectSource.cpp
  lldb/source/Commands/CommandObjectType.cpp
  lldb/source/Core/Debugger.cpp
  lldb/source/Core/Disassembler.cpp
  lldb/source/Core/Mangled.cpp
  lldb/source/Core/Module.cpp
  lldb/source/Core/ModuleList.cpp
  lldb/source/Core/PluginManager.cpp
  lldb/source/Core/RichManglingContext.cpp
  lldb/source/Core/Section.cpp
  lldb/source/Core/UserSettingsController.cpp
  lldb/source/Core/ValueObject.cpp
  lldb/source/Core/ValueObjectCast.cpp
  lldb/source/Core/ValueObjectChild.cpp
  lldb/source/Core/ValueObjectConstResult.cpp
  lldb/source/Core/ValueObjectConstResultCast.cpp
  lldb/source/Core/ValueObjectConstResultChild.cpp
  lldb/source/Core/ValueObjectRegister.cpp
  lldb/source/Core/ValueObjectSyntheticFilter.cpp
  lldb/source/DataFormatters/DataVisualization.cpp
  lldb/source/DataFormatters/FormatCache.cpp
  lldb/source/DataFormatters/FormatManager.cpp
  lldb/source/DataFormatters/TypeSynthetic.cpp
  lldb/source/DataFormatters/VectorType.cpp
  lldb/source/Expression/ExpressionVariable.cpp
  lldb/source/Expression/IRExecutionUnit.cpp
  lldb/source/Host/common/FileSystem.cpp
  lldb/source/Interpreter/OptionValueDictionary.cpp
  lldb/source/Interpreter/OptionValueProperties.cpp
  lldb/source/Interpreter/Property.cpp
  lldb/source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.cpp
  lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp
  lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.h
  lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
  lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.h
  lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
  lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.h
  lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionVariable.cpp
  lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionVariable.h
  lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
  lldb/source/Plugins/ExpressionParser/Clang/ClangPersistentVariables.cpp
  lldb/source/Plugins/ExpressionParser/Clang/ClangPersistentVariables.h
  lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.h
  lldb/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp
  lldb/source/Plugins/JITLoader/GDB/JITLoaderGDB.h
  lldb/source/Plugins/Language/CPlusPlus/BlockPointer.cpp
  lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.h
  lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp
  lldb/source/Plugins/Language/CPlusPlus/LibCxx.h
  lldb/source/Plugins/Language/CPlusPlus/LibCxxAtomic.cpp
  lldb/source/Plugins/Language/CPlusPlus/LibCxxBitset.cpp
  lldb/source/Plugins/Language/CPlusPlus/LibCxxInitializerList.cpp
  lldb/source/Plugins/Language/CPlusPlus/LibCxxList.cpp
  lldb/source/Plugins/Language/CPlusPlus/LibCxxMap.cpp
  lldb/source/Plugins/Language/CPlusPlus/LibCxxOptional.cpp
  lldb/source/Plugins/Language/CPlusPlus/LibCxxQueue.cpp
  lldb/source/Plugins/Language/CPlusPlus/LibCxxTuple.cpp
  lldb/source/Plugins/Language/CPlusPlus/LibCxxUnorderedMap.cpp
  lldb/source/Plugins/Language/CPlusPlus/LibCxxVariant.cpp
  lldb/source/Plugins/Language/CPlusPlus/LibCxxVector.cpp
  lldb/source/Plugins/Language/CPlusPlus/LibStdcpp.cpp
  lldb/source/Plugins/Language/CPlusPlus/LibStdcppTuple.cpp
  lldb/source/Plugins/Language/CPlusPlus/LibStdcppUniquePointer.cpp
  lldb/source/Plugins/Language/ObjC/Cocoa.cpp
  lldb/source/Plugins/Language/ObjC/NSArray.cpp
  lldb/source/Plugins/Language/ObjC/NSDictionary.cpp
  lldb/source/Plugins/Language/ObjC/NSError.cpp
  lldb/source/Plugins/Language/ObjC/NSException.cpp
  lldb/source/Plugins/Language/ObjC/NSIndexPath.cpp
  lldb/source/Plugins/Language/ObjC/NSSet.cpp
  lldb/source/Plugins/Language/ObjC/ObjCLanguage.cpp
  lldb/source/Plugins/Language/ObjC/ObjCLanguage.h
  lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.cpp
  lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.h
  lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
  lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h
  lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
  lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.h
  lldb/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp
  lldb/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.h
  lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
  lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
  lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h
  lldb/source/Plugins/Process/Utility/DynamicRegisterInfo.cpp
  lldb/source/Plugins/Process/Utility/DynamicRegisterInfo.h
  lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
  lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h
  lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
  lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
  lldb/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp
  lldb/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.h
  lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp
  lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.h
  lldb/source/Plugins/SymbolFile/DWARF/NameToDIE.cpp
  lldb/source/Plugins/SymbolFile/DWARF/NameToDIE.h
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h
  lldb/source/Plugins/SymbolFile/DWARF/UniqueDWARFASTType.h
  lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
  lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h
  lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
  lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.h
  lldb/source/Symbol/ClangASTContext.cpp
  lldb/source/Symbol/CompilerType.cpp
  lldb/source/Symbol/Function.cpp
  lldb/source/Symbol/LocateSymbolFile.cpp
  lldb/source/Symbol/Symbol.cpp
  lldb/source/Symbol/SymbolContext.cpp
  lldb/source/Symbol/SymbolFile.cpp
  lldb/source/Symbol/SymbolVendor.cpp
  lldb/source/Symbol/Symtab.cpp
  lldb/source/Symbol/Type.cpp
  lldb/source/Symbol/TypeList.cpp
  lldb/source/Symbol/TypeMap.cpp
  lldb/source/Symbol/TypeSystem.cpp
  lldb/source/Symbol/Variable.cpp
  lldb/source/Symbol/VariableList.cpp
  lldb/source/Target/ABI.cpp
  lldb/source/Target/ObjCLanguageRuntime.cpp
  lldb/source/Target/PathMappingList.cpp
  lldb/source/Target/Platform.cpp
  lldb/source/Target/Process.cpp
  lldb/source/Target/StackFrameRecognizer.cpp
  lldb/source/Target/StructuredDataPlugin.cpp
  lldb/source/Target/Target.cpp
  lldb/source/Target/Thread.cpp
  lldb/source/Utility/ArchSpec.cpp
  lldb/source/Utility/ConstString.cpp
  lldb/source/Utility/Event.cpp
  lldb/source/Utility/FileSpec.cpp
  lldb/source/Utility/Listener.cpp
  lldb/unittests/Core/MangledTest.cpp
  lldb/www/architecture/varformats.html

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D59030.189523.patch
Type: text/x-patch
Size: 309393 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20190306/cfa6c94e/attachment-0001.bin>


More information about the lldb-commits mailing list