mirror of
https://github.com/intel/llvm.git
synced 2026-01-25 10:55:58 +08:00
Reflow paragraphs in comments.
This is intended as a clean up after the big clang-format commit
(r280751), which unfortunately resulted in many of the comment
paragraphs in LLDB being very hard to read.
FYI, the script I used was:
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=(78-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])
Differential Revision: https://reviews.llvm.org/D46144
llvm-svn: 331197
This commit is contained in:
@@ -35,15 +35,13 @@ OptionValueProperties::OptionValueProperties(
|
||||
m_name(global_properties.m_name),
|
||||
m_properties(global_properties.m_properties),
|
||||
m_name_to_index(global_properties.m_name_to_index) {
|
||||
// We now have an exact copy of "global_properties". We need to now
|
||||
// find all non-global settings and copy the property values so that
|
||||
// all non-global settings get new OptionValue instances created for
|
||||
// them.
|
||||
// We now have an exact copy of "global_properties". We need to now find all
|
||||
// non-global settings and copy the property values so that all non-global
|
||||
// settings get new OptionValue instances created for them.
|
||||
const size_t num_properties = m_properties.size();
|
||||
for (size_t i = 0; i < num_properties; ++i) {
|
||||
// Duplicate any values that are not global when constructing properties
|
||||
// from
|
||||
// a global copy
|
||||
// from a global copy
|
||||
if (m_properties[i].IsGlobal() == false) {
|
||||
lldb::OptionValueSP new_value_sp(m_properties[i].GetValue()->DeepCopy());
|
||||
m_properties[i].SetOptionValue(new_value_sp);
|
||||
@@ -157,15 +155,13 @@ OptionValueProperties::GetSubValue(const ExecutionContext *exe_ctx,
|
||||
case '{':
|
||||
// Predicate matching for predicates like
|
||||
// "<setting-name>{<predicate>}"
|
||||
// strings are parsed by the current OptionValueProperties subclass
|
||||
// to mean whatever they want to. For instance a subclass of
|
||||
// OptionValueProperties for a lldb_private::Target might implement:
|
||||
// "target.run-args{arch==i386}" -- only set run args if the arch is
|
||||
// i386
|
||||
// "target.run-args{path=/tmp/a/b/c/a.out}" -- only set run args if the
|
||||
// path matches
|
||||
// "target.run-args{basename==test&&arch==x86_64}" -- only set run args
|
||||
// if executable basename is "test" and arch is "x86_64"
|
||||
// strings are parsed by the current OptionValueProperties subclass to mean
|
||||
// whatever they want to. For instance a subclass of OptionValueProperties
|
||||
// for a lldb_private::Target might implement: "target.run-
|
||||
// args{arch==i386}" -- only set run args if the arch is i386 "target
|
||||
// .run-args{path=/tmp/a/b/c/a.out}" -- only set run args if the path
|
||||
// matches "target.run-args{basename==test&&arch==x86_64}" -- only set run
|
||||
// args if executable basename is "test" and arch is "x86_64"
|
||||
if (sub_name[1]) {
|
||||
llvm::StringRef predicate_start = sub_name.drop_front();
|
||||
size_t pos = predicate_start.find_first_of('}');
|
||||
@@ -189,9 +185,8 @@ OptionValueProperties::GetSubValue(const ExecutionContext *exe_ctx,
|
||||
break;
|
||||
|
||||
case '[':
|
||||
// Array or dictionary access for subvalues like:
|
||||
// "[12]" -- access 12th array element
|
||||
// "['hello']" -- dictionary access of key named hello
|
||||
// Array or dictionary access for subvalues like: "[12]" -- access
|
||||
// 12th array element "['hello']" -- dictionary access of key named hello
|
||||
return value_sp->GetSubValue(exe_ctx, sub_name, will_modify, error);
|
||||
|
||||
default:
|
||||
|
||||
Reference in New Issue
Block a user