Skip to content
This repository was archived by the owner on Apr 2, 2020. It is now read-only.

Commit a015ff5

Browse files
author
Kate Stone
committed
*** This commit represents a complete reformatting of the LLDB source code
*** to conform to clang-format’s LLVM style. This kind of mass change has *** two obvious implications: Firstly, merging this particular commit into a downstream fork may be a huge effort. Alternatively, it may be worth merging all changes up to this commit, performing the same reformatting operation locally, and then discarding the merge for this particular commit. The commands used to accomplish this reformatting were as follows (with current working directory as the root of the repository): find . \( -iname "*.c" -or -iname "*.cpp" -or -iname "*.h" -or -iname "*.mm" \) -exec clang-format -i {} + find . -iname "*.py" -exec autopep8 --in-place --aggressive --aggressive {} + ; The version of clang-format used was 3.9.0, and autopep8 was 1.2.4. Secondly, “blame” style tools will generally point to this commit instead of a meaningful prior commit. There are alternatives available that will attempt to look through this change and find the appropriate prior commit. YMMV. git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@280751 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent 063858b commit a015ff5

File tree

2,780 files changed

+558490
-598860
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

2,780 files changed

+558490
-598860
lines changed

examples/customization/bin-utils/binutils.py

+11-8
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import StringIO
44

5+
56
def binary(n, width=None):
67
"""
78
Return a list of (0|1)'s for the binary representation of n where n >= 0.
@@ -12,7 +13,7 @@ def binary(n, width=None):
1213
if width and width <= 0:
1314
width = None
1415
while n > 0:
15-
l.append(1 if n&1 else 0)
16+
l.append(1 if n & 1 else 0)
1617
n = n >> 1
1718

1819
if width:
@@ -22,14 +23,15 @@ def binary(n, width=None):
2223
l.reverse()
2324
return l
2425

26+
2527
def twos_complement(n, width):
2628
"""
2729
Return a list of (0|1)'s for the binary representation of a width-bit two's
2830
complement numeral system of an integer n which may be negative.
2931
"""
30-
val = 2**(width-1)
32+
val = 2**(width - 1)
3133
if n >= 0:
32-
if n > (val-1):
34+
if n > (val - 1):
3335
return None
3436
# It is safe to represent n with width-bits.
3537
return binary(n, width)
@@ -38,7 +40,7 @@ def twos_complement(n, width):
3840
if abs(n) > val:
3941
return None
4042
# It is safe to represent n (a negative int) with width-bits.
41-
return binary(val*2 - abs(n))
43+
return binary(val * 2 - abs(n))
4244

4345
# print binary(0xABCD)
4446
# [1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 0, 0, 1, 1, 0, 1]
@@ -53,12 +55,13 @@ def twos_complement(n, width):
5355
# print twos_complement(-5, 64)
5456
# [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1]
5557

58+
5659
def positions(width):
5760
"""Helper function returning a list describing the bit positions.
5861
Bit positions greater than 99 are truncated to 2 digits, for example,
5962
100 -> 00 and 127 -> 27."""
6063
return ['{0:2}'.format(i)[-2:] for i in reversed(range(width))]
61-
64+
6265

6366
def utob(debugger, command_line, result, dict):
6467
"""Convert the unsigned integer to print its binary representation.
@@ -88,9 +91,10 @@ def utob(debugger, command_line, result, dict):
8891
return
8992
if verbose and width > 0:
9093
pos = positions(width)
91-
print ' '+' '.join(pos)
94+
print ' ' + ' '.join(pos)
9295
print ' %s' % str(bits)
9396

97+
9498
def itob(debugger, command_line, result, dict):
9599
"""Convert the integer to print its two's complement representation.
96100
args[0] (mandatory) is the integer to be converted
@@ -117,6 +121,5 @@ def itob(debugger, command_line, result, dict):
117121
return
118122
if verbose and width > 0:
119123
pos = positions(width)
120-
print ' '+' '.join(pos)
124+
print ' ' + ' '.join(pos)
121125
print ' %s' % str(bits)
122-
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,38 @@
1-
import sys,os,lldb
1+
import sys
2+
import os
3+
import lldb
4+
5+
26
def check_has_dir_in_path(dirname):
3-
return sys.path.__contains__(dirname);
7+
return sys.path.__contains__(dirname)
8+
49

510
def ensure_has_dir_in_path(dirname):
6-
dirname = os.path.abspath(dirname)
7-
if not (check_has_dir_in_path(dirname)):
8-
sys.path.append(dirname);
11+
dirname = os.path.abspath(dirname)
12+
if not (check_has_dir_in_path(dirname)):
13+
sys.path.append(dirname)
14+
15+
16+
def do_import(debugger, modname):
17+
if (len(modname) > 4 and modname[-4:] == '.pyc'):
18+
modname = modname[:-4]
19+
if (len(modname) > 3 and modname[-3:] == '.py'):
20+
modname = modname[:-3]
21+
debugger.HandleCommand("script import " + modname)
922

10-
def do_import(debugger,modname):
11-
if (len(modname) > 4 and modname[-4:] == '.pyc'):
12-
modname = modname[:-4]
13-
if (len(modname) > 3 and modname[-3:] == '.py'):
14-
modname = modname[:-3]
15-
debugger.HandleCommand("script import " + modname)
1623

1724
def pyimport_cmd(debugger, args, result, dict):
18-
"""Import a Python module given its full path"""
19-
print 'WARNING: obsolete feature - use native command "command script import"'
20-
if args == "":
21-
return "no module path given";
22-
if not (os.sep in args):
23-
modname = args
24-
ensure_has_dir_in_path('.')
25-
else:
26-
endofdir = args.rfind(os.sep)
27-
modname = args[endofdir+1:]
28-
args = args[0:endofdir]
29-
ensure_has_dir_in_path(args)
30-
do_import(debugger,modname)
31-
return None
25+
"""Import a Python module given its full path"""
26+
print 'WARNING: obsolete feature - use native command "command script import"'
27+
if args == "":
28+
return "no module path given"
29+
if not (os.sep in args):
30+
modname = args
31+
ensure_has_dir_in_path('.')
32+
else:
33+
endofdir = args.rfind(os.sep)
34+
modname = args[endofdir + 1:]
35+
args = args[0:endofdir]
36+
ensure_has_dir_in_path(args)
37+
do_import(debugger, modname)
38+
return None

examples/customization/pwd-cd-and-system/utils.py

+11-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
"""Utility for changing directories and execution of commands in a subshell."""
22

3-
import os, shlex, subprocess
3+
import os
4+
import shlex
5+
import subprocess
46

57
# Store the previous working directory for the 'cd -' command.
8+
9+
610
class Holder:
711
"""Holds the _prev_dir_ class attribute for chdir() function."""
812
_prev_dir_ = None
@@ -15,6 +19,7 @@ def prev_dir(cls):
1519
def swap(cls, dir):
1620
cls._prev_dir_ = dir
1721

22+
1823
def chdir(debugger, args, result, dict):
1924
"""Change the working directory, or cd to ${HOME}.
2025
You can also issue 'cd -' to change to the previous working directory."""
@@ -33,10 +38,14 @@ def chdir(debugger, args, result, dict):
3338
os.chdir(new_dir)
3439
print "Current working directory: %s" % os.getcwd()
3540

41+
3642
def system(debugger, command_line, result, dict):
3743
"""Execute the command (a string) in a subshell."""
3844
args = shlex.split(command_line)
39-
process = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
45+
process = subprocess.Popen(
46+
args,
47+
stdout=subprocess.PIPE,
48+
stderr=subprocess.PIPE)
4049
output, error = process.communicate()
4150
retcode = process.poll()
4251
if output and error:

0 commit comments

Comments
 (0)