aprantl updated this revision to Diff 144420. aprantl added a comment. Updated the script based on Pavel's feedback:
import textwrap import commands import os import sys import re tmp = "%s.tmp"%sys.argv[1] out = open(tmp, "w+") with open(sys.argv[1], "r") as f: header = "" text = "" comment = re.compile(r'^( *//) ([^ ].*)$') special = re.compile(r'^(([A-Z]+[: ])|([0-9]+ )).*$') for line in f: match = comment.match(line) if match and not special.match(match.group(2)): # skip intentionally short comments. if not text and len(match.group(2)) < 40: out.write(line) continue if text: text += " " + match.group(2) else: header = match.group(1) text = match.group(2) continue if text: filled = textwrap.wrap(text, width=(77-len(header)), break_long_words=False) for l in filled: out.write(header+" "+l+'\n') text = "" out.write(line) os.rename(tmp, sys.argv[1]) #find source -name '*.cpp' -exec python join-comments.py \{} \; https://reviews.llvm.org/D46144 Files: include/lldb/API/SBAddress.h include/lldb/API/SBBroadcaster.h include/lldb/API/SBCommandInterpreter.h include/lldb/API/SBCommandReturnObject.h include/lldb/API/SBData.h include/lldb/API/SBExpressionOptions.h include/lldb/API/SBFrame.h include/lldb/API/SBInstruction.h include/lldb/API/SBInstructionList.h include/lldb/API/SBProcess.h include/lldb/API/SBStream.h include/lldb/API/SBSymbol.h include/lldb/API/SBTarget.h include/lldb/API/SBThreadPlan.h include/lldb/API/SBType.h include/lldb/API/SBValue.h include/lldb/API/SBValueList.h include/lldb/Breakpoint/Breakpoint.h include/lldb/Breakpoint/BreakpointLocation.h include/lldb/Breakpoint/BreakpointLocationCollection.h include/lldb/Breakpoint/BreakpointLocationList.h include/lldb/Breakpoint/BreakpointName.h include/lldb/Breakpoint/BreakpointOptions.h include/lldb/Breakpoint/BreakpointResolver.h include/lldb/Breakpoint/BreakpointResolverAddress.h include/lldb/Breakpoint/BreakpointResolverName.h include/lldb/Breakpoint/BreakpointSite.h include/lldb/Breakpoint/StoppointLocation.h include/lldb/Breakpoint/Watchpoint.h include/lldb/Breakpoint/WatchpointList.h include/lldb/Breakpoint/WatchpointOptions.h include/lldb/Core/Address.h include/lldb/Core/AddressRange.h include/lldb/Core/AddressResolverName.h include/lldb/Core/Broadcaster.h include/lldb/Core/Debugger.h include/lldb/Core/Disassembler.h include/lldb/Core/EmulateInstruction.h include/lldb/Core/FormatEntity.h include/lldb/Core/IOHandler.h include/lldb/Core/MappedHash.h include/lldb/Core/Module.h include/lldb/Core/ModuleList.h include/lldb/Core/ModuleSpec.h include/lldb/Core/PluginManager.h include/lldb/Core/RangeMap.h include/lldb/Core/RegisterValue.h include/lldb/Core/STLUtils.h include/lldb/Core/Scalar.h include/lldb/Core/SearchFilter.h include/lldb/Core/Section.h include/lldb/Core/SourceManager.h include/lldb/Core/StreamBuffer.h include/lldb/Core/UniqueCStringMap.h include/lldb/Core/UserSettingsController.h include/lldb/Core/Value.h include/lldb/Core/ValueObject.h include/lldb/Core/ValueObjectSyntheticFilter.h include/lldb/DataFormatters/DataVisualization.h include/lldb/DataFormatters/FormatClasses.h include/lldb/DataFormatters/FormatManager.h include/lldb/DataFormatters/FormattersContainer.h include/lldb/DataFormatters/StringPrinter.h include/lldb/DataFormatters/TypeFormat.h include/lldb/DataFormatters/TypeSummary.h include/lldb/DataFormatters/TypeSynthetic.h include/lldb/DataFormatters/TypeValidator.h include/lldb/DataFormatters/ValueObjectPrinter.h include/lldb/Expression/DiagnosticManager.h include/lldb/Expression/ExpressionSourceCode.h include/lldb/Expression/ExpressionVariable.h include/lldb/Expression/IRMemoryMap.h include/lldb/Expression/LLVMUserExpression.h include/lldb/Expression/REPL.h include/lldb/Expression/UtilityFunction.h include/lldb/Host/Debug.h include/lldb/Host/Editline.h include/lldb/Host/MainLoop.h include/lldb/Host/MainLoopBase.h include/lldb/Host/PosixApi.h include/lldb/Host/Predicate.h include/lldb/Host/Socket.h include/lldb/Host/SocketAddress.h include/lldb/Host/Symbols.h include/lldb/Host/TaskPool.h include/lldb/Host/XML.h include/lldb/Host/common/GetOptInc.h include/lldb/Host/common/NativeBreakpoint.h include/lldb/Host/common/NativeProcessProtocol.h include/lldb/Host/common/NativeRegisterContext.h include/lldb/Host/linux/Ptrace.h include/lldb/Host/posix/ConnectionFileDescriptorPosix.h include/lldb/Interpreter/CommandAlias.h include/lldb/Interpreter/CommandCompletions.h include/lldb/Interpreter/CommandInterpreter.h include/lldb/Interpreter/CommandObject.h include/lldb/Interpreter/CommandObjectMultiword.h include/lldb/Interpreter/CommandReturnObject.h include/lldb/Interpreter/OptionGroupBoolean.h include/lldb/Interpreter/OptionValue.h include/lldb/Interpreter/OptionValueArray.h include/lldb/Interpreter/OptionValueProperties.h include/lldb/Interpreter/OptionValueUInt64.h include/lldb/Interpreter/Options.h include/lldb/Symbol/Block.h include/lldb/Symbol/ClangASTContext.h include/lldb/Symbol/ClangASTImporter.h include/lldb/Symbol/ClangExternalASTSourceCallbacks.h include/lldb/Symbol/ClangExternalASTSourceCommon.h include/lldb/Symbol/CompactUnwindInfo.h include/lldb/Symbol/CompilerDecl.h include/lldb/Symbol/CompilerType.h include/lldb/Symbol/DWARFCallFrameInfo.h include/lldb/Symbol/DeclVendor.h include/lldb/Symbol/FuncUnwinders.h include/lldb/Symbol/GoASTContext.h include/lldb/Symbol/ObjectFile.h include/lldb/Symbol/Symbol.h include/lldb/Symbol/SymbolFile.h include/lldb/Symbol/SymbolVendor.h include/lldb/Symbol/Type.h include/lldb/Symbol/TypeSystem.h include/lldb/Symbol/UnwindPlan.h include/lldb/Symbol/UnwindTable.h include/lldb/Symbol/Variable.h include/lldb/Symbol/VariableList.h include/lldb/Target/ABI.h include/lldb/Target/DynamicLoader.h include/lldb/Target/ExecutionContext.h include/lldb/Target/Language.h include/lldb/Target/LanguageRuntime.h include/lldb/Target/Memory.h include/lldb/Target/MemoryRegionInfo.h include/lldb/Target/ObjCLanguageRuntime.h include/lldb/Target/Platform.h include/lldb/Target/Process.h include/lldb/Target/ProcessInfo.h include/lldb/Target/ProcessLaunchInfo.h include/lldb/Target/Queue.h include/lldb/Target/QueueItem.h include/lldb/Target/QueueList.h include/lldb/Target/RegisterCheckpoint.h include/lldb/Target/RegisterContext.h include/lldb/Target/RegisterNumber.h include/lldb/Target/SectionLoadHistory.h include/lldb/Target/SectionLoadList.h include/lldb/Target/StackFrame.h include/lldb/Target/StackID.h include/lldb/Target/StopInfo.h include/lldb/Target/Target.h include/lldb/Target/Thread.h include/lldb/Target/ThreadCollection.h include/lldb/Target/ThreadList.h include/lldb/Target/ThreadPlan.h include/lldb/Target/ThreadPlanCallFunction.h include/lldb/Target/ThreadPlanCallFunctionUsingABI.h include/lldb/Target/ThreadPlanShouldStopHere.h include/lldb/Target/ThreadPlanStepRange.h include/lldb/Target/UnixSignals.h include/lldb/Utility/ArchSpec.h include/lldb/Utility/Args.h include/lldb/Utility/Baton.h include/lldb/Utility/ConstString.h include/lldb/Utility/DataBufferHeap.h include/lldb/Utility/History.h include/lldb/Utility/JSON.h include/lldb/Utility/Log.h include/lldb/Utility/SafeMachO.h include/lldb/Utility/SelectHelper.h include/lldb/Utility/SharedCluster.h include/lldb/Utility/SharingPtr.h include/lldb/Utility/Stream.h include/lldb/Utility/StreamTee.h include/lldb/Utility/StringExtractor.h include/lldb/Utility/StringLexer.h include/lldb/Utility/StringList.h include/lldb/Utility/Timeout.h include/lldb/lldb-enumerations.h include/lldb/lldb-private-enumerations.h include/lldb/lldb-private-forward.h include/lldb/lldb-private-types.h include/lldb/lldb-versioning.h source/API/SBAddress.cpp source/API/SBBreakpointName.cpp source/API/SBCommandInterpreter.cpp source/API/SBDebugger.cpp source/API/SBEvent.cpp source/API/SBFrame.cpp source/API/SBInstruction.cpp source/API/SBInstructionList.cpp source/API/SBModule.cpp source/API/SBModuleSpec.cpp source/API/SBPlatform.cpp source/API/SBProcess.cpp source/API/SBQueueItem.cpp source/API/SBStream.cpp source/API/SBTarget.cpp source/API/SBThread.cpp source/API/SBThreadPlan.cpp source/API/SBType.cpp source/API/SBTypeCategory.cpp source/API/SBValue.cpp source/API/SystemInitializerFull.cpp source/Breakpoint/Breakpoint.cpp source/Breakpoint/BreakpointID.cpp source/Breakpoint/BreakpointLocation.cpp source/Breakpoint/BreakpointLocationList.cpp source/Breakpoint/BreakpointOptions.cpp source/Breakpoint/BreakpointResolver.cpp source/Breakpoint/BreakpointResolverAddress.cpp source/Breakpoint/BreakpointResolverFileLine.cpp source/Breakpoint/BreakpointResolverName.cpp source/Breakpoint/BreakpointSiteList.cpp source/Breakpoint/Watchpoint.cpp source/Breakpoint/WatchpointList.cpp source/Breakpoint/WatchpointOptions.cpp source/Commands/CommandCompletions.cpp source/Commands/CommandObjectApropos.cpp source/Commands/CommandObjectBreakpoint.cpp source/Commands/CommandObjectBreakpointCommand.cpp source/Commands/CommandObjectCommands.cpp source/Commands/CommandObjectDisassemble.cpp source/Commands/CommandObjectExpression.cpp source/Commands/CommandObjectFrame.cpp source/Commands/CommandObjectHelp.cpp source/Commands/CommandObjectMemory.cpp source/Commands/CommandObjectMultiword.cpp source/Commands/CommandObjectPlatform.cpp source/Commands/CommandObjectProcess.cpp source/Commands/CommandObjectQuit.cpp source/Commands/CommandObjectRegister.cpp source/Commands/CommandObjectSettings.cpp source/Commands/CommandObjectSource.cpp source/Commands/CommandObjectTarget.cpp source/Commands/CommandObjectThread.cpp source/Commands/CommandObjectType.cpp source/Commands/CommandObjectWatchpoint.cpp source/Commands/CommandObjectWatchpointCommand.cpp source/Core/Address.cpp source/Core/AddressResolverName.cpp source/Core/Broadcaster.cpp source/Core/Communication.cpp source/Core/Debugger.cpp source/Core/Disassembler.cpp source/Core/DumpDataExtractor.cpp source/Core/DynamicLoader.cpp source/Core/FileLineResolver.cpp source/Core/FileSpecList.cpp source/Core/FormatEntity.cpp source/Core/IOHandler.cpp (370 more files...) _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits