[Lldb-commits] [PATCH] D58177: Fix lldb-server test suite for python3

2019-02-13 Thread serge via Phabricator via lldb-commits
serge-sans-paille added inline comments.



Comment at: 
packages/Python/lldbsuite/test/tools/lldb-server/lldbgdbserverutils.py:415
 # Add zero-fill to the right/end (MSB side) of the value.
-retval += "00" * (byte_size - len(retval) / 2)
+retval += "00" * (byte_size - len(retval) // 2)
 return retval

Maybe `from __future__ import division` to make sure the `/` operator behaves 
consistently across versions? That way it may uncover missed `/` to `//` 
conversion?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D58177/new/

https://reviews.llvm.org/D58177



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D58193: Do not explicitly depend on llvm tools during standalone build

2019-02-13 Thread serge via Phabricator via lldb-commits
serge-sans-paille created this revision.
serge-sans-paille added a reviewer: labath.
Herald added subscribers: lldb-commits, mgorny.
Herald added a reviewer: alexshap.
Herald added a project: LLDB.

When building lldb in standalone mode, the llvm-nm, llvm-objdump etc target are 
not available, so only conditionnaly include them.


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D58193

Files:
  lit/CMakeLists.txt


Index: lit/CMakeLists.txt
===
--- lit/CMakeLists.txt
+++ lit/CMakeLists.txt
@@ -19,18 +19,23 @@
 
 list(APPEND LLDB_TEST_DEPS
   LLDBUnitTests
-  dsymutil
-  llc
   lldb
   lldb-test
-  llvm-config
-  llvm-mc
-  llvm-objcopy
-  FileCheck
-  count
-  not
   )
 
+if (NOT LLDB_BUILT_STANDALONE)
+  list(APPEND LLDB_TEST_DEPS
+dsymutil
+llc
+llvm-config
+llvm-mc
+llvm-objcopy
+FileCheck
+count
+not
+)
+endif()
+
 if(TARGET lld)
   list(APPEND LLDB_TEST_DEPS lld)
 endif()


Index: lit/CMakeLists.txt
===
--- lit/CMakeLists.txt
+++ lit/CMakeLists.txt
@@ -19,18 +19,23 @@
 
 list(APPEND LLDB_TEST_DEPS
   LLDBUnitTests
-  dsymutil
-  llc
   lldb
   lldb-test
-  llvm-config
-  llvm-mc
-  llvm-objcopy
-  FileCheck
-  count
-  not
   )
 
+if (NOT LLDB_BUILT_STANDALONE)
+  list(APPEND LLDB_TEST_DEPS
+dsymutil
+llc
+llvm-config
+llvm-mc
+llvm-objcopy
+FileCheck
+count
+not
+)
+endif()
+
 if(TARGET lld)
   list(APPEND LLDB_TEST_DEPS lld)
 endif()
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D58193: Do not explicitly depend on llvm tools during standalone build

2019-02-18 Thread serge via Phabricator via lldb-commits
serge-sans-paille added a comment.

@sgraenitz I currently have this patch applied to LLVM 8rc1 source tree for 
fedora, because it wasn't working automagically otherwise. Reading the 
discussion, I don't think I missed some configuration stuff, or what did I miss 
when configuring the build of lldb in standalone mode?


Repository:
  rLLDB LLDB

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D58193/new/

https://reviews.llvm.org/D58193



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D58193: Do not explicitly depend on llvm tools during standalone build

2019-02-20 Thread serge via Phabricator via lldb-commits
serge-sans-paille added a comment.

@sgraenitz : it's possible that r352382 fixes my issue. I'll double check that 
first!


Repository:
  rLLDB LLDB

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D58193/new/

https://reviews.llvm.org/D58193



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D58193: Do not explicitly depend on llvm tools during standalone build

2019-02-25 Thread serge via Phabricator via lldb-commits
serge-sans-paille abandoned this revision.
serge-sans-paille added a comment.

@sgraenitz It's fixed! I'm dropping this patch then, thanks for investigating o/


Repository:
  rLLDB LLDB

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D58193/new/

https://reviews.llvm.org/D58193



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D59433: Fix UUID decoding from minidump files.

2019-03-19 Thread serge via Phabricator via lldb-commits
serge-sans-paille added inline comments.



Comment at: 
packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpNew.py:533
+self.assertEqual(2, len(modules))
+self.verify_module(modules[0], "/tmp/a", None)
+self.verify_module(modules[1], "/tmp/b", None)

labath wrote:
> Am I right in thinking that if I have an object file called `/tmp/a` on my 
> system, then lldb will pick it up (and it's build-id), causing this test to 
> fail ? If that's the case then it would be better to use some path which is 
> less likely to exist.
I second this. https://docs.python.org/3/library/tempfile.html provides ways to 
create such temporary names.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D59433/new/

https://reviews.llvm.org/D59433



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D59579: Use list comprehension instead of map/filter to prepare Python2/3 compat

2019-03-20 Thread serge via Phabricator via lldb-commits
serge-sans-paille created this revision.
serge-sans-paille added a reviewer: michaelplatings.
Herald added subscribers: lldb-commits, jdoerfert.
Herald added a project: LLDB.

Repository:
  rLLDB LLDB

https://reviews.llvm.org/D59579

Files:
  lldb/packages/Python/lldbsuite/test/dotest.py
  lldb/scripts/analyze-project-deps.py
  lldb/scripts/swig_bot_lib/local.py
  lldb/utils/lui/lldbutil.py
  lldb/utils/vim-lldb/python-vim-lldb/lldb_controller.py

Index: lldb/utils/vim-lldb/python-vim-lldb/lldb_controller.py
===
--- lldb/utils/vim-lldb/python-vim-lldb/lldb_controller.py
+++ lldb/utils/vim-lldb/python-vim-lldb/lldb_controller.py
@@ -102,8 +102,8 @@
 pass
 
 if result.GetSize() > 0:
-results = filter(None, [result.GetStringAtIndex(x)
-for x in range(result.GetSize())])
+results = [_f for _f in [result.GetStringAtIndex(x)
+for x in range(result.GetSize())] if _f]
 return results
 else:
 return []
Index: lldb/utils/lui/lldbutil.py
===
--- lldb/utils/lui/lldbutil.py
+++ lldb/utils/lui/lldbutil.py
@@ -84,7 +84,7 @@
 return None
 
 packed = struct.pack(fmt, val)
-return bytearray(map(ord, packed))
+return bytearray(ord(x) for x in packed)
 
 
 def bytearray_to_int(bytes, bytesize):
@@ -706,7 +706,7 @@
 def GetFuncName(i):
 return thread.GetFrameAtIndex(i).GetFunctionName()
 
-return map(GetFuncName, range(thread.GetNumFrames()))
+return [GetFuncName(i) for i in range(thread.GetNumFrames())]
 
 
 def get_symbol_names(thread):
@@ -716,7 +716,7 @@
 def GetSymbol(i):
 return thread.GetFrameAtIndex(i).GetSymbol().GetName()
 
-return map(GetSymbol, range(thread.GetNumFrames()))
+return [GetSymbol(i) for i in range(thread.GetNumFrames())]
 
 
 def get_pc_addresses(thread):
@@ -726,7 +726,7 @@
 def GetPCAddress(i):
 return thread.GetFrameAtIndex(i).GetPCAddress()
 
-return map(GetPCAddress, range(thread.GetNumFrames()))
+return [GetPCAddress(i) for in in range(thread.GetNumFrames())]
 
 
 def get_filenames(thread):
@@ -737,7 +737,7 @@
 return thread.GetFrameAtIndex(
 i).GetLineEntry().GetFileSpec().GetFilename()
 
-return map(GetFilename, range(thread.GetNumFrames()))
+return [GetFilename(i) for i in range(thread.GetNumFrames())]
 
 
 def get_line_numbers(thread):
@@ -747,7 +747,7 @@
 def GetLineNumber(i):
 return thread.GetFrameAtIndex(i).GetLineEntry().GetLine()
 
-return map(GetLineNumber, range(thread.GetNumFrames()))
+return [GetLineNumber(i) for i in range(thread.GetNumFrames())]
 
 
 def get_module_names(thread):
@@ -758,7 +758,7 @@
 return thread.GetFrameAtIndex(
 i).GetModule().GetFileSpec().GetFilename()
 
-return map(GetModuleName, range(thread.GetNumFrames()))
+return [GetModuleName(i) for i in range(thread.GetNumFrames())]
 
 
 def get_stack_frames(thread):
@@ -768,7 +768,7 @@
 def GetStackFrame(i):
 return thread.GetFrameAtIndex(i)
 
-return map(GetStackFrame, range(thread.GetNumFrames()))
+return [GetStackFrame(i) for i in range(thread.GetNumFrames())]
 
 
 def print_stacktrace(thread, string_buffer=False):
Index: lldb/scripts/swig_bot_lib/local.py
===
--- lldb/scripts/swig_bot_lib/local.py
+++ lldb/scripts/swig_bot_lib/local.py
@@ -54,10 +54,8 @@
 full_path = os.path.normpath(os.path.join(src_root, subfolder))
 candidates = [os.path.normpath(os.path.join(full_path, f))
   for f in os.listdir(full_path)]
-actual = filter(
-lambda f: os.path.isfile(f) and os.path.splitext(f)[1] == ext,
-candidates)
-return (subfolder, map(lambda f: os.path.basename(f), actual))
+actual = [f for f in candidates if os.path.isfile(f) and os.path.splitext(f)[1] == ext]
+return (subfolder, [os.path.basename(f) for f in actual])
 archive_entries = map(filter_func, filters)
 else:
 for (root, dirs, files) in os.walk(src_root):
Index: lldb/scripts/analyze-project-deps.py
===
--- lldb/scripts/analyze-project-deps.py
+++ lldb/scripts/analyze-project-deps.py
@@ -65,7 +65,7 @@
 for (base, dirs, files) in os.walk(inc_dir):
 dir = os.path.basename(base)
 relative = os.path.relpath(base, inc_dir)
-inc_files = filter(lambda x : os.path.splitext(x)[1] in [".h"], files)
+inc_files = [x for x in files if os.path.splitext(x)[1] in [".h"]]
 relative = relative.replace("\\", "/")
 for inc in inc_files:
 inc_path = os.path.join(base, inc)
@@ -74,7 +74,7 @@
 for (base, dirs, files) in os.walk(src_dir)

[Lldb-commits] [PATCH] D59581: Python 2/3 compat: urllib

2019-03-20 Thread serge via Phabricator via lldb-commits
serge-sans-paille created this revision.
serge-sans-paille added a reviewer: michaelplatings.
Herald added subscribers: llvm-commits, lldb-commits, jdoerfert.
Herald added projects: LLDB, LLVM.

Repository:
  rLLDB LLDB

https://reviews.llvm.org/D59581

Files:
  lld/utils/benchmark.py


Index: lld/utils/benchmark.py
===
--- lld/utils/benchmark.py
+++ lld/utils/benchmark.py
@@ -13,8 +13,13 @@
 import json
 import datetime
 import argparse
-import urllib
-import urllib2
+try:
+from urllib.parse import urlencode
+from urllib.request import urlopen, Request
+except ImportError:
+from urllib import urlencode
+from urllib2 import urlopen, Request
+
 
 parser = argparse.ArgumentParser()
 parser.add_argument('benchmark_directory')
@@ -126,8 +131,8 @@
 return json.dumps(ret, sort_keys=True, indent=4)
 
 def submitToServer(data):
-data2 = urllib.urlencode({ 'input_data' : data }).encode('ascii')
-urllib2.urlopen(urllib2.Request(args.url, data2))
+data2 = urlencode({ 'input_data' : data }).encode('ascii')
+urlopen(Request(args.url, data2))
 
 os.chdir(args.benchmark_directory)
 data = buildLntJson(getBenchmarks())


Index: lld/utils/benchmark.py
===
--- lld/utils/benchmark.py
+++ lld/utils/benchmark.py
@@ -13,8 +13,13 @@
 import json
 import datetime
 import argparse
-import urllib
-import urllib2
+try:
+from urllib.parse import urlencode
+from urllib.request import urlopen, Request
+except ImportError:
+from urllib import urlencode
+from urllib2 import urlopen, Request
+
 
 parser = argparse.ArgumentParser()
 parser.add_argument('benchmark_directory')
@@ -126,8 +131,8 @@
 return json.dumps(ret, sort_keys=True, indent=4)
 
 def submitToServer(data):
-data2 = urllib.urlencode({ 'input_data' : data }).encode('ascii')
-urllib2.urlopen(urllib2.Request(args.url, data2))
+data2 = urlencode({ 'input_data' : data }).encode('ascii')
+urlopen(Request(args.url, data2))
 
 os.chdir(args.benchmark_directory)
 data = buildLntJson(getBenchmarks())
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D59583: python2/3 compat: exceptions

2019-03-20 Thread serge via Phabricator via lldb-commits
serge-sans-paille created this revision.
serge-sans-paille added a reviewer: michaelplatings.
Herald added subscribers: lldb-commits, jdoerfert.
Herald added a project: LLDB.

Repository:
  rLLDB LLDB

https://reviews.llvm.org/D59583

Files:
  lldb/examples/python/crashlog.py


Index: lldb/examples/python/crashlog.py
===
--- lldb/examples/python/crashlog.py
+++ lldb/examples/python/crashlog.py
@@ -284,7 +284,7 @@
 try:
 plist_root = plistlib.readPlistFromString(s)
 except:
-print(("Got exception: ", sys.exc_value, " handling 
dsymForUUID output: \n", s)) 
+print(("Got exception: ", sys.exc_info()[1], " 
handling dsymForUUID output: \n", s))
 raise
 if plist_root:
 plist = plist_root[uuid_str]


Index: lldb/examples/python/crashlog.py
===
--- lldb/examples/python/crashlog.py
+++ lldb/examples/python/crashlog.py
@@ -284,7 +284,7 @@
 try:
 plist_root = plistlib.readPlistFromString(s)
 except:
-print(("Got exception: ", sys.exc_value, " handling dsymForUUID output: \n", s)) 
+print(("Got exception: ", sys.exc_info()[1], " handling dsymForUUID output: \n", s))
 raise
 if plist_root:
 plist = plist_root[uuid_str]
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D59584: python 2/3 compat: commands vs subprocess

2019-03-20 Thread serge via Phabricator via lldb-commits
serge-sans-paille created this revision.
serge-sans-paille added a reviewer: michaelplatings.
Herald added subscribers: lldb-commits, jdoerfert.
Herald added a project: LLDB.

Repository:
  rLLDB LLDB

https://reviews.llvm.org/D59584

Files:
  lldb/examples/python/delta.py
  lldb/examples/python/gdbremote.py
  lldb/examples/python/globals.py
  lldb/examples/python/memory.py
  lldb/examples/python/performance.py
  lldb/examples/python/process_events.py
  lldb/examples/python/stacks.py
  lldb/examples/python/types.py
  lldb/scripts/verify_api.py

Index: lldb/scripts/verify_api.py
===
--- lldb/scripts/verify_api.py
+++ lldb/scripts/verify_api.py
@@ -1,6 +1,6 @@
 #!/usr/bin/env python
 
-import commands
+import subprocess
 import optparse
 import os
 import os.path
@@ -11,7 +11,7 @@
 def extract_exe_symbol_names(arch, exe_path, match_str):
 command = 'dsymutil --arch %s -s "%s" | grep "%s" | colrm 1 69' % (
 arch, exe_path, match_str)
-(command_exit_status, command_output) = commands.getstatusoutput(command)
+(command_exit_status, command_output) = subprocess.getstatusoutput(command)
 if command_exit_status == 0:
 if command_output:
 return command_output[0:-1].split("'\n")
Index: lldb/examples/python/types.py
===
--- lldb/examples/python/types.py
+++ lldb/examples/python/types.py
@@ -9,7 +9,6 @@
 #   (lldb) command script import /path/to/cmdtemplate.py
 #--
 
-import commands
 from __future__ import print_function
 
 import platform
@@ -18,6 +17,11 @@
 import signal
 import sys
 
+if sys.version_info.major == 2:
+import commands as subprocess
+else:
+import subprocess
+
 try:
 # Just try for LLDB in case PYTHONPATH is already correctly setup
 import lldb
@@ -27,7 +31,7 @@
 platform_system = platform.system()
 if platform_system == 'Darwin':
 # On Darwin, try the currently selected Xcode directory
-xcode_dir = commands.getoutput("xcode-select --print-path")
+xcode_dir = subprocess.getoutput("xcode-select --print-path")
 if xcode_dir:
 lldb_python_dirs.append(
 os.path.realpath(
@@ -54,7 +58,6 @@
 print("error: couldn't locate the 'lldb' module, please set PYTHONPATH correctly")
 sys.exit(1)
 
-import commands
 import optparse
 import shlex
 import time
Index: lldb/examples/python/stacks.py
===
--- lldb/examples/python/stacks.py
+++ lldb/examples/python/stacks.py
@@ -1,7 +1,6 @@
 #!/usr/bin/python
 from __future__ import print_function
 import lldb
-import commands
 import optparse
 import shlex
 
Index: lldb/examples/python/process_events.py
===
--- lldb/examples/python/process_events.py
+++ lldb/examples/python/process_events.py
@@ -8,7 +8,6 @@
 #   export PYTHONPATH=/Applications/Xcode.app/Contents/SharedFrameworks/LLDB.framework/Resources/Python
 #--
 
-import commands
 from __future__ import print_function
 
 import optparse
@@ -16,6 +15,11 @@
 import platform
 import sys
 
+if sys.version_info.major == 2:
+import commands as subprocess
+else:
+import subprocess
+
 #--
 # Code that auto imports LLDB
 #--
@@ -28,7 +32,7 @@
 platform_system = platform.system()
 if platform_system == 'Darwin':
 # On Darwin, try the currently selected Xcode directory
-xcode_dir = commands.getoutput("xcode-select --print-path")
+xcode_dir = subprocess.getoutput("xcode-select --print-path")
 if xcode_dir:
 lldb_python_dirs.append(
 os.path.realpath(
Index: lldb/examples/python/performance.py
===
--- lldb/examples/python/performance.py
+++ lldb/examples/python/performance.py
@@ -8,7 +8,6 @@
 #   export PYTHONPATH=/Applications/Xcode.app/Contents/SharedFrameworks/LLDB.framework/Resources/Python
 #--
 
-import commands
 from __future__ import print_function
 
 import optparse
@@ -20,6 +19,11 @@
 import time
 import types
 
+if sys.version_info.major == 2:
+import commands as subprocess
+else:
+import subprocess
+
 #--
 # Code that auto imports LLDB
 #--
@@ -32,7 +36,7 @@
 platform_system = platform.system()
 if platform_system == 'Darwin':
 # On Darwin, try the currently selected Xcode directory
-xcode_d

[Lldb-commits] [PATCH] D59582: Python 2/3 compat: StringIO

2019-03-20 Thread serge via Phabricator via lldb-commits
serge-sans-paille created this revision.
serge-sans-paille added a reviewer: michaelplatings.
Herald added subscribers: lldb-commits, jdoerfert.
Herald added a project: LLDB.

Repository:
  rLLDB LLDB

https://reviews.llvm.org/D59582

Files:
  lldb/examples/customization/bin-utils/binutils.py
  lldb/examples/python/mach_o.py
  lldb/utils/git-svn/convert.py
  lldb/utils/lui/lldbutil.py
  lldb/utils/misc/grep-svn-log.py
  lldb/utils/sync-source/syncsource.py
  lldb/utils/test/disasm.py
  lldb/utils/test/run-until-faulted.py

Index: lldb/utils/test/run-until-faulted.py
===
--- lldb/utils/test/run-until-faulted.py
+++ lldb/utils/test/run-until-faulted.py
@@ -32,7 +32,6 @@
 
 
 def do_lldb_launch_loop(lldb_command, exe, exe_options):
-from cStringIO import StringIO
 import pexpect
 import time
 
Index: lldb/utils/test/disasm.py
===
--- lldb/utils/test/disasm.py
+++ lldb/utils/test/disasm.py
@@ -39,7 +39,7 @@
 func,
 mc,
 mc_options):
-from cStringIO import StringIO
+from io import StringIO
 import pexpect
 
 gdb_prompt = "\r\n\(gdb\) "
Index: lldb/utils/sync-source/syncsource.py
===
--- lldb/utils/sync-source/syncsource.py
+++ lldb/utils/sync-source/syncsource.py
@@ -11,7 +11,7 @@
 """
 
 import argparse
-import cStringIO
+import io
 import importlib
 import json
 import os.path
@@ -89,11 +89,11 @@
 # preserving the line count.
 regex = re.compile(r"#.*$")
 
-comment_stripped_file = cStringIO.StringIO()
+comment_stripped_file = io.StringIO()
 with open(filename, "r") as json_file:
 for line in json_file:
 comment_stripped_file.write(regex.sub("", line))
-return json.load(cStringIO.StringIO(comment_stripped_file.getvalue()))
+return json.load(io.StringIO(comment_stripped_file.getvalue()))
 
 
 def find_appropriate_rcfile(options):
Index: lldb/utils/misc/grep-svn-log.py
===
--- lldb/utils/misc/grep-svn-log.py
+++ lldb/utils/misc/grep-svn-log.py
@@ -13,7 +13,7 @@
 import fileinput
 import re
 import sys
-import StringIO
+import io
 
 # Separator string for "svn log -v" output.
 separator = '-' * 72
@@ -23,7 +23,7 @@
 svn log -v | grep-svn-log.py '^   D.+why_are_you_missing.h'"""
 
 
-class Log(StringIO.StringIO):
+class Log(io.StringIO):
 """Simple facade to keep track of the log content."""
 
 def __init__(self):
Index: lldb/utils/lui/lldbutil.py
===
--- lldb/utils/lui/lldbutil.py
+++ lldb/utils/lui/lldbutil.py
@@ -17,7 +17,7 @@
 import lldb
 import os
 import sys
-import StringIO
+import io
 
 # ===
 # Utilities for locating/checking executable programs
@@ -52,7 +52,7 @@
 
 It returns the disassembly content in a string object.
 """
-buf = StringIO.StringIO()
+buf = io.StringIO()
 insts = function_or_symbol.GetInstructions(target)
 for i in insts:
 print(i, file=buf)
@@ -776,7 +776,7 @@
 def print_stacktrace(thread, string_buffer=False):
 """Prints a simple stack trace of this thread."""
 
-output = StringIO.StringIO() if string_buffer else sys.stdout
+output = io.StringIO() if string_buffer else sys.stdout
 target = thread.GetProcess().GetTarget()
 
 depth = thread.GetNumFrames()
@@ -819,7 +819,7 @@
 def print_stacktraces(process, string_buffer=False):
 """Prints the stack traces of all the threads."""
 
-output = StringIO.StringIO() if string_buffer else sys.stdout
+output = io.StringIO() if string_buffer else sys.stdout
 
 print("Stack traces for " + str(process), file=output)
 
@@ -879,7 +879,7 @@
 def print_registers(frame, string_buffer=False):
 """Prints all the register sets of the frame."""
 
-output = StringIO.StringIO() if string_buffer else sys.stdout
+output = io.StringIO() if string_buffer else sys.stdout
 
 print("Register sets for " + str(frame), file=output)
 
@@ -962,7 +962,7 @@
 
 def format(self, value, buffer=None, indent=0):
 if not buffer:
-output = StringIO.StringIO()
+output = io.StringIO()
 else:
 output = buffer
 # If there is a summary, it suffices.
@@ -992,7 +992,7 @@
 
 def format(self, value, buffer=None):
 if not buffer:
-output = StringIO.StringIO()
+output = io.StringIO()
 else:
 output = buffer
 
@@ -1019,7 +1019,7 @@
 
 def format(self, value, buffer=None):
 if not buffer:
-output = StringIO.StringIO()
+output = io.StringIO()
 else:
 output = buffer
 
Index: lldb/utils/git-svn/convert.py

[Lldb-commits] [PATCH] D59585: python 2/3 compat: int vs long

2019-03-20 Thread serge via Phabricator via lldb-commits
serge-sans-paille created this revision.
serge-sans-paille added a reviewer: michaelplatings.
Herald added subscribers: lldb-commits, jdoerfert.
Herald added a project: LLDB.

Repository:
  rLLDB LLDB

https://reviews.llvm.org/D59585

Files:
  lldb/examples/python/jump.py


Index: lldb/examples/python/jump.py
===
--- lldb/examples/python/jump.py
+++ lldb/examples/python/jump.py
@@ -80,7 +80,7 @@
 if (mo is not None):
 matched = True
 # print "Matched "
-address = long(mo.group(1), base=0)
+address = int(mo.group(1), base=0)
 breakpoint = target.BreakpointCreateByAddress(address)
 
 if (not matched):


Index: lldb/examples/python/jump.py
===
--- lldb/examples/python/jump.py
+++ lldb/examples/python/jump.py
@@ -80,7 +80,7 @@
 if (mo is not None):
 matched = True
 # print "Matched "
-address = long(mo.group(1), base=0)
+address = int(mo.group(1), base=0)
 breakpoint = target.BreakpointCreateByAddress(address)
 
 if (not matched):
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D59587: Use explicit loop instead of map for Python 2/3 compat

2019-03-20 Thread serge via Phabricator via lldb-commits
serge-sans-paille created this revision.
serge-sans-paille added a reviewer: michaelplatings.
Herald added subscribers: lldb-commits, jdoerfert.
Herald added a project: LLDB.

The output of map is not used, so using a list comprehension or an explicit 
call to list looks awkward.


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D59587

Files:
  lldb/scripts/Xcode/build-llvm.py


Index: lldb/scripts/Xcode/build-llvm.py
===
--- lldb/scripts/Xcode/build-llvm.py
+++ lldb/scripts/Xcode/build-llvm.py
@@ -239,7 +239,8 @@
 
 
 def all_check_out_if_needed():
-map(check_out_if_needed, XCODE_REPOSITORIES())
+for r in XCODE_REPOSITORIES():
+check_out_if_needed(r)
 
 
 def should_build_llvm():
@@ -263,7 +264,8 @@
 
 
 def setup_source_symlinks():
-map(setup_source_symlink, XCODE_REPOSITORIES())
+for r in XCODE_REPOSITORIES():
+setup_source_symlink(r)
 
 
 def setup_build_symlink():


Index: lldb/scripts/Xcode/build-llvm.py
===
--- lldb/scripts/Xcode/build-llvm.py
+++ lldb/scripts/Xcode/build-llvm.py
@@ -239,7 +239,8 @@
 
 
 def all_check_out_if_needed():
-map(check_out_if_needed, XCODE_REPOSITORIES())
+for r in XCODE_REPOSITORIES():
+check_out_if_needed(r)
 
 
 def should_build_llvm():
@@ -263,7 +264,8 @@
 
 
 def setup_source_symlinks():
-map(setup_source_symlink, XCODE_REPOSITORIES())
+for r in XCODE_REPOSITORIES():
+setup_source_symlink(r)
 
 
 def setup_build_symlink():
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D59586: Python 2/3 compat: tkinter

2019-03-20 Thread serge via Phabricator via lldb-commits
serge-sans-paille created this revision.
serge-sans-paille added a reviewer: michaelplatings.
Herald added subscribers: lldb-commits, jdoerfert.
Herald added a project: LLDB.

Repository:
  rLLDB LLDB

https://reviews.llvm.org/D59586

Files:
  lldb/examples/python/lldbtk.py


Index: lldb/examples/python/lldbtk.py
===
--- lldb/examples/python/lldbtk.py
+++ lldb/examples/python/lldbtk.py
@@ -1,10 +1,15 @@
 #!/usr/bin/python
+from __future__ import print_function
 
 import lldb
 import shlex
 import sys
-from Tkinter import *
-import ttk
+try:
+from tkinter import *
+import tkinter.ttk as ttk
+except ImportError:
+from Tkinter import *
+import ttk
 
 
 class ValueTreeItemDelegate(object):


Index: lldb/examples/python/lldbtk.py
===
--- lldb/examples/python/lldbtk.py
+++ lldb/examples/python/lldbtk.py
@@ -1,10 +1,15 @@
 #!/usr/bin/python
+from __future__ import print_function
 
 import lldb
 import shlex
 import sys
-from Tkinter import *
-import ttk
+try:
+from tkinter import *
+import tkinter.ttk as ttk
+except ImportError:
+from Tkinter import *
+import ttk
 
 
 class ValueTreeItemDelegate(object):
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D59588: Python 2/3 compat: iteritems vs items

2019-03-20 Thread serge via Phabricator via lldb-commits
serge-sans-paille created this revision.
serge-sans-paille added a reviewer: michaelplatings.
Herald added subscribers: lldb-commits, jdoerfert.
Herald added a project: LLDB.

Repository:
  rLLDB LLDB

https://reviews.llvm.org/D59588

Files:
  lldb/examples/python/pytracer.py


Index: lldb/examples/python/pytracer.py
===
--- lldb/examples/python/pytracer.py
+++ lldb/examples/python/pytracer.py
@@ -339,7 +339,7 @@
 
 def print_keyword_args(**kwargs):
 # kwargs is a dict of the keyword args passed to the function
-for key, value in kwargs.iteritems():
+for key, value in kwargs.items():
 print("%s = %s" % (key, value))
 
 


Index: lldb/examples/python/pytracer.py
===
--- lldb/examples/python/pytracer.py
+++ lldb/examples/python/pytracer.py
@@ -339,7 +339,7 @@
 
 def print_keyword_args(**kwargs):
 # kwargs is a dict of the keyword args passed to the function
-for key, value in kwargs.iteritems():
+for key, value in kwargs.items():
 print("%s = %s" % (key, value))
 
 
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D59590: Python 2/3 compat: queue vs Queue

2019-03-20 Thread serge via Phabricator via lldb-commits
serge-sans-paille created this revision.
serge-sans-paille added a reviewer: michaelplatings.
Herald added subscribers: lldb-commits, jdoerfert.
Herald added a project: LLDB.

Repository:
  rLLDB LLDB

https://reviews.llvm.org/D59590

Files:
  lldb/utils/lui/lui.py
  lldb/utils/lui/sandbox.py


Index: lldb/utils/lui/sandbox.py
===
--- lldb/utils/lui/sandbox.py
+++ lldb/utils/lui/sandbox.py
@@ -14,7 +14,10 @@
 import signal
 import sys
 
-import Queue
+try:
+import queue
+except ImportError:
+import Queue as queue
 
 import cui
 
@@ -62,7 +65,7 @@
 
 def main(screen):
 global event_queue
-event_queue = Queue.Queue()
+event_queue = queue.Queue()
 
 sandbox = SandboxUI(screen, event_queue)
 sandbox.eventLoop()
Index: lldb/utils/lui/lui.py
===
--- lldb/utils/lui/lui.py
+++ lldb/utils/lui/lui.py
@@ -18,7 +18,10 @@
 import signal
 import sys
 
-import Queue
+try:
+import queue
+except ImportError:
+import Queue as queue
 
 import debuggerdriver
 import cui
@@ -126,7 +129,7 @@
 signal.signal(signal.SIGINT, sigint_handler)
 
 global event_queue
-event_queue = Queue.Queue()
+event_queue = queue.Queue()
 
 global debugger
 debugger = lldb.SBDebugger.Create()


Index: lldb/utils/lui/sandbox.py
===
--- lldb/utils/lui/sandbox.py
+++ lldb/utils/lui/sandbox.py
@@ -14,7 +14,10 @@
 import signal
 import sys
 
-import Queue
+try:
+import queue
+except ImportError:
+import Queue as queue
 
 import cui
 
@@ -62,7 +65,7 @@
 
 def main(screen):
 global event_queue
-event_queue = Queue.Queue()
+event_queue = queue.Queue()
 
 sandbox = SandboxUI(screen, event_queue)
 sandbox.eventLoop()
Index: lldb/utils/lui/lui.py
===
--- lldb/utils/lui/lui.py
+++ lldb/utils/lui/lui.py
@@ -18,7 +18,10 @@
 import signal
 import sys
 
-import Queue
+try:
+import queue
+except ImportError:
+import Queue as queue
 
 import debuggerdriver
 import cui
@@ -126,7 +129,7 @@
 signal.signal(signal.SIGINT, sigint_handler)
 
 global event_queue
-event_queue = Queue.Queue()
+event_queue = queue.Queue()
 
 global debugger
 debugger = lldb.SBDebugger.Create()
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D59591: Python 2/3 compat: unichr vs chr

2019-03-20 Thread serge via Phabricator via lldb-commits
serge-sans-paille created this revision.
serge-sans-paille added a reviewer: michaelplatings.
Herald added subscribers: lldb-commits, jdoerfert.
Herald added a project: LLDB.

Repository:
  rLLDB LLDB

https://reviews.llvm.org/D59591

Files:
  lldb/examples/summaries/cocoa/CFString.py


Index: lldb/examples/summaries/cocoa/CFString.py
===
--- lldb/examples/summaries/cocoa/CFString.py
+++ lldb/examples/summaries/cocoa/CFString.py
@@ -11,6 +11,10 @@
 import lldb.runtime.objc.objc_runtime
 import lldb.formatters.Logger
 
+try:
+unichr
+except NameError:
+unichr = chr
 
 def CFString_SummaryProvider(valobj, dict):
 logger = lldb.formatters.Logger.Logger()


Index: lldb/examples/summaries/cocoa/CFString.py
===
--- lldb/examples/summaries/cocoa/CFString.py
+++ lldb/examples/summaries/cocoa/CFString.py
@@ -11,6 +11,10 @@
 import lldb.runtime.objc.objc_runtime
 import lldb.formatters.Logger
 
+try:
+unichr
+except NameError:
+unichr = chr
 
 def CFString_SummaryProvider(valobj, dict):
 logger = lldb.formatters.Logger.Logger()
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D59589: Python 2/3 compat: str vs basestring

2019-03-20 Thread serge via Phabricator via lldb-commits
serge-sans-paille created this revision.
serge-sans-paille added a reviewer: michaelplatings.
Herald added subscribers: lldb-commits, jdoerfert, arphaman.
Herald added a project: LLDB.

Repository:
  rLLDB LLDB

https://reviews.llvm.org/D59589

Files:
  lldb/examples/summaries/cocoa/CFArray.py
  lldb/examples/summaries/cocoa/CFBag.py
  lldb/examples/summaries/cocoa/CFBinaryHeap.py
  lldb/examples/summaries/cocoa/CFDictionary.py
  lldb/examples/summaries/cocoa/NSData.py
  lldb/examples/summaries/cocoa/NSIndexSet.py
  lldb/examples/summaries/cocoa/NSMachPort.py
  lldb/examples/summaries/cocoa/NSSet.py

Index: lldb/examples/summaries/cocoa/NSSet.py
===
--- lldb/examples/summaries/cocoa/NSSet.py
+++ lldb/examples/summaries/cocoa/NSSet.py
@@ -13,6 +13,11 @@
 import CFBag
 import lldb.formatters.Logger
 
+try:
+basestring
+except NameError:
+basestring = str
+
 statistics = lldb.formatters.metrics.Metrics()
 statistics.add_metric('invalid_isa')
 statistics.add_metric('invalid_pointer')
Index: lldb/examples/summaries/cocoa/NSMachPort.py
===
--- lldb/examples/summaries/cocoa/NSMachPort.py
+++ lldb/examples/summaries/cocoa/NSMachPort.py
@@ -13,6 +13,11 @@
 import lldb.formatters.metrics
 import lldb.formatters.Logger
 
+try:
+basestring
+except NameError:
+basestring =str
+
 statistics = lldb.formatters.metrics.Metrics()
 statistics.add_metric('invalid_isa')
 statistics.add_metric('invalid_pointer')
Index: lldb/examples/summaries/cocoa/NSIndexSet.py
===
--- lldb/examples/summaries/cocoa/NSIndexSet.py
+++ lldb/examples/summaries/cocoa/NSIndexSet.py
@@ -13,6 +13,11 @@
 import lldb.formatters.metrics
 import lldb.formatters.Logger
 
+try:
+basestring
+except NameError:
+basestring = str
+
 statistics = lldb.formatters.metrics.Metrics()
 statistics.add_metric('invalid_isa')
 statistics.add_metric('invalid_pointer')
Index: lldb/examples/summaries/cocoa/NSData.py
===
--- lldb/examples/summaries/cocoa/NSData.py
+++ lldb/examples/summaries/cocoa/NSData.py
@@ -13,6 +13,11 @@
 import lldb.formatters.metrics
 import lldb.formatters.Logger
 
+try:
+basestring
+except NameError:
+basestring = str
+
 statistics = lldb.formatters.metrics.Metrics()
 statistics.add_metric('invalid_isa')
 statistics.add_metric('invalid_pointer')
Index: lldb/examples/summaries/cocoa/CFDictionary.py
===
--- lldb/examples/summaries/cocoa/CFDictionary.py
+++ lldb/examples/summaries/cocoa/CFDictionary.py
@@ -13,6 +13,11 @@
 import lldb.formatters.metrics
 import lldb.formatters.Logger
 
+try:
+basestring
+except NameError
+basestring = str
+
 statistics = lldb.formatters.metrics.Metrics()
 statistics.add_metric('invalid_isa')
 statistics.add_metric('invalid_pointer')
Index: lldb/examples/summaries/cocoa/CFBinaryHeap.py
===
--- lldb/examples/summaries/cocoa/CFBinaryHeap.py
+++ lldb/examples/summaries/cocoa/CFBinaryHeap.py
@@ -13,6 +13,11 @@
 import lldb.formatters.metrics
 import lldb.formatters.Logger
 
+try:
+basestring
+except NameError:
+basestring = str
+
 statistics = lldb.formatters.metrics.Metrics()
 statistics.add_metric('invalid_isa')
 statistics.add_metric('invalid_pointer')
Index: lldb/examples/summaries/cocoa/CFBag.py
===
--- lldb/examples/summaries/cocoa/CFBag.py
+++ lldb/examples/summaries/cocoa/CFBag.py
@@ -13,6 +13,11 @@
 import lldb.formatters.metrics
 import lldb.formatters.Logger
 
+try:
+basestring
+except NameError:
+basestring = str
+
 statistics = lldb.formatters.metrics.Metrics()
 statistics.add_metric('invalid_isa')
 statistics.add_metric('invalid_pointer')
Index: lldb/examples/summaries/cocoa/CFArray.py
===
--- lldb/examples/summaries/cocoa/CFArray.py
+++ lldb/examples/summaries/cocoa/CFArray.py
@@ -13,6 +13,11 @@
 import lldb.formatters.metrics
 import lldb.formatters.Logger
 
+try:
+basestring
+except NameError:
+basestring = str
+
 statistics = lldb.formatters.metrics.Metrics()
 statistics.add_metric('invalid_isa')
 statistics.add_metric('invalid_pointer')
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D59580: Use compatible print statements for Python2/3

2019-03-21 Thread serge via Phabricator via lldb-commits
serge-sans-paille added a comment.

I didn't run the `check-lldb` target though, I'm doing that right now.


Repository:
  rLLDB LLDB

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D59580/new/

https://reviews.llvm.org/D59580



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D59580: Use compatible print statements for Python2/3

2019-03-21 Thread serge via Phabricator via lldb-commits
serge-sans-paille added a comment.

@davide I first applied 2to3 systematically, then manually edited the diff so 
that it remains backward compatible with python2.


Repository:
  rLLDB LLDB

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D59580/new/

https://reviews.llvm.org/D59580



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D59580: Use compatible print statements for Python2/3

2019-03-21 Thread serge via Phabricator via lldb-commits
serge-sans-paille added a comment.

validates fine on my side with py3


Repository:
  rLLDB LLDB

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D59580/new/

https://reviews.llvm.org/D59580



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D59580: Use compatible print statements for Python2/3

2019-03-21 Thread serge via Phabricator via lldb-commits
serge-sans-paille added a comment.

@davide : is that ok if I add you to a few other python compat related reviews?


Repository:
  rLLDB LLDB

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D59580/new/

https://reviews.llvm.org/D59580



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D59591: Python 2/3 compat: unichr vs chr

2019-03-25 Thread serge via Phabricator via lldb-commits
serge-sans-paille closed this revision.
serge-sans-paille added a comment.

Closed by https://reviews.llvm.org/rL356904


Repository:
  rLLDB LLDB

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D59591/new/

https://reviews.llvm.org/D59591



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D119092: Cleanup LLVMDebugInfoCodeView headers

2022-02-06 Thread serge via Phabricator via lldb-commits
serge-sans-paille created this revision.
serge-sans-paille added reviewers: RKSimon, lenary, MaskRay, mehdi_amini.
Herald added subscribers: arphaman, hiraditya.
serge-sans-paille requested review of this revision.
Herald added projects: LLDB, LLVM.
Herald added subscribers: llvm-commits, lldb-commits.

Major user-facing changes:

Many headers in llvm/DebugInfo/CodeView no longer include
llvm/Support/BinaryStreamReader.h or llvm/Support/BinaryStreamWriter.h,
those headers may need to be included manually.

Several headers in llvm/DebugInfo/CodeView no longer include
llvm/DebugInfo/CodeView/EnumTables.h or llvm/DebugInfo/CodeView/CodeView.h,
those headers may need to be included manually.

Some statistics:
$ clang++ -E  -Iinclude -I../llvm/include ../llvm/lib/DebugInfo/CodeView/*.cpp 
-std=c++14 -fno-rtti -fno-exceptions | wc -l
after:  2794466
before: 2832765

Discourse thread on the topic: 
https://discourse.llvm.org/t/include-what-you-use-include-cleanup/


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D119092

Files:
  lldb/source/Plugins/SymbolFile/NativePDB/PdbFPOProgramToDWARFExpression.cpp
  llvm/include/llvm/DebugInfo/CodeView/AppendingTypeTableBuilder.h
  llvm/include/llvm/DebugInfo/CodeView/CVSymbolVisitor.h
  llvm/include/llvm/DebugInfo/CodeView/CVTypeVisitor.h
  llvm/include/llvm/DebugInfo/CodeView/CodeViewRecordIO.h
  llvm/include/llvm/DebugInfo/CodeView/ContinuationRecordBuilder.h
  llvm/include/llvm/DebugInfo/CodeView/DebugChecksumsSubsection.h
  llvm/include/llvm/DebugInfo/CodeView/DebugCrossExSubsection.h
  llvm/include/llvm/DebugInfo/CodeView/DebugCrossImpSubsection.h
  llvm/include/llvm/DebugInfo/CodeView/DebugFrameDataSubsection.h
  llvm/include/llvm/DebugInfo/CodeView/DebugLinesSubsection.h
  llvm/include/llvm/DebugInfo/CodeView/DebugSubsection.h
  llvm/include/llvm/DebugInfo/CodeView/DebugSubsectionVisitor.h
  llvm/include/llvm/DebugInfo/CodeView/EnumTables.h
  llvm/include/llvm/DebugInfo/CodeView/Formatters.h
  llvm/include/llvm/DebugInfo/CodeView/GlobalTypeTableBuilder.h
  llvm/include/llvm/DebugInfo/CodeView/Line.h
  llvm/include/llvm/DebugInfo/CodeView/MergingTypeTableBuilder.h
  llvm/include/llvm/DebugInfo/CodeView/RecordName.h
  llvm/include/llvm/DebugInfo/CodeView/RecordSerialization.h
  llvm/include/llvm/DebugInfo/CodeView/StringsAndChecksums.h
  llvm/include/llvm/DebugInfo/CodeView/SymbolDumper.h
  llvm/include/llvm/DebugInfo/CodeView/SymbolSerializer.h
  llvm/include/llvm/DebugInfo/CodeView/TypeDumpVisitor.h
  llvm/include/llvm/DebugInfo/CodeView/TypeHashing.h
  llvm/include/llvm/DebugInfo/CodeView/TypeIndex.h
  llvm/include/llvm/DebugInfo/CodeView/TypeIndexDiscovery.h
  llvm/include/llvm/DebugInfo/CodeView/TypeRecordMapping.h
  llvm/include/llvm/DebugInfo/CodeView/TypeStreamMerger.h
  llvm/lib/DebugInfo/CodeView/AppendingTypeTableBuilder.cpp
  llvm/lib/DebugInfo/CodeView/CVSymbolVisitor.cpp
  llvm/lib/DebugInfo/CodeView/CVTypeVisitor.cpp
  llvm/lib/DebugInfo/CodeView/CodeViewRecordIO.cpp
  llvm/lib/DebugInfo/CodeView/DebugCrossExSubsection.cpp
  llvm/lib/DebugInfo/CodeView/DebugFrameDataSubsection.cpp
  llvm/lib/DebugInfo/CodeView/DebugSubsectionRecord.cpp
  llvm/lib/DebugInfo/CodeView/DebugSubsectionVisitor.cpp
  llvm/lib/DebugInfo/CodeView/DebugSymbolsSubsection.cpp
  llvm/lib/DebugInfo/CodeView/Formatters.cpp
  llvm/lib/DebugInfo/CodeView/GlobalTypeTableBuilder.cpp
  llvm/lib/DebugInfo/CodeView/LazyRandomTypeCollection.cpp
  llvm/lib/DebugInfo/CodeView/MergingTypeTableBuilder.cpp
  llvm/lib/DebugInfo/CodeView/RecordName.cpp
  llvm/lib/DebugInfo/CodeView/RecordSerialization.cpp
  llvm/lib/DebugInfo/CodeView/SimpleTypeSerializer.cpp
  llvm/lib/DebugInfo/CodeView/StringsAndChecksums.cpp
  llvm/lib/DebugInfo/CodeView/SymbolDumper.cpp
  llvm/lib/DebugInfo/CodeView/SymbolRecordHelpers.cpp
  llvm/lib/DebugInfo/CodeView/SymbolSerializer.cpp
  llvm/lib/DebugInfo/CodeView/TypeDumpVisitor.cpp
  llvm/lib/DebugInfo/CodeView/TypeRecordMapping.cpp
  llvm/lib/DebugInfo/CodeView/TypeStreamMerger.cpp
  llvm/lib/DebugInfo/CodeView/TypeTableCollection.cpp
  llvm/lib/ObjectYAML/COFFEmitter.cpp
  llvm/lib/ObjectYAML/CodeViewYAMLSymbols.cpp

Index: llvm/lib/ObjectYAML/CodeViewYAMLSymbols.cpp
===
--- llvm/lib/ObjectYAML/CodeViewYAMLSymbols.cpp
+++ llvm/lib/ObjectYAML/CodeViewYAMLSymbols.cpp
@@ -25,6 +25,7 @@
 #include "llvm/ObjectYAML/YAML.h"
 #include "llvm/Support/Allocator.h"
 #include "llvm/Support/Error.h"
+#include "llvm/Support/ScopedPrinter.h"
 #include "llvm/Support/YAMLTraits.h"
 #include 
 #include 
Index: llvm/lib/ObjectYAML/COFFEmitter.cpp
===
--- llvm/lib/ObjectYAML/COFFEmitter.cpp
+++ llvm/lib/ObjectYAML/COFFEmitter.cpp
@@ -19,6 +19,7 @@
 #include "llvm/Object/COFF.h"
 #include "llvm/ObjectYAML/ObjectYAML.h"
 #include "llvm/ObjectYAML/yaml2obj.h"
+#include "llvm/Support/BinaryStreamWriter.h"
 #include "llvm/Support/Endian.h"
 #include "

[Lldb-commits] [PATCH] D119092: Cleanup LLVMDebugInfoCodeView headers

2022-02-08 Thread serge via Phabricator via lldb-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG81cde474e2c5: Cleanup LLVMDebugInfoCodeView headers 
(authored by serge-sans-paille).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D119092/new/

https://reviews.llvm.org/D119092

Files:
  lldb/source/Plugins/SymbolFile/NativePDB/PdbFPOProgramToDWARFExpression.cpp
  llvm/include/llvm/DebugInfo/CodeView/AppendingTypeTableBuilder.h
  llvm/include/llvm/DebugInfo/CodeView/CVSymbolVisitor.h
  llvm/include/llvm/DebugInfo/CodeView/CVTypeVisitor.h
  llvm/include/llvm/DebugInfo/CodeView/CodeViewRecordIO.h
  llvm/include/llvm/DebugInfo/CodeView/ContinuationRecordBuilder.h
  llvm/include/llvm/DebugInfo/CodeView/DebugChecksumsSubsection.h
  llvm/include/llvm/DebugInfo/CodeView/DebugCrossExSubsection.h
  llvm/include/llvm/DebugInfo/CodeView/DebugCrossImpSubsection.h
  llvm/include/llvm/DebugInfo/CodeView/DebugFrameDataSubsection.h
  llvm/include/llvm/DebugInfo/CodeView/DebugLinesSubsection.h
  llvm/include/llvm/DebugInfo/CodeView/DebugSubsection.h
  llvm/include/llvm/DebugInfo/CodeView/DebugSubsectionVisitor.h
  llvm/include/llvm/DebugInfo/CodeView/EnumTables.h
  llvm/include/llvm/DebugInfo/CodeView/Formatters.h
  llvm/include/llvm/DebugInfo/CodeView/GlobalTypeTableBuilder.h
  llvm/include/llvm/DebugInfo/CodeView/Line.h
  llvm/include/llvm/DebugInfo/CodeView/MergingTypeTableBuilder.h
  llvm/include/llvm/DebugInfo/CodeView/RecordName.h
  llvm/include/llvm/DebugInfo/CodeView/RecordSerialization.h
  llvm/include/llvm/DebugInfo/CodeView/StringsAndChecksums.h
  llvm/include/llvm/DebugInfo/CodeView/SymbolDumper.h
  llvm/include/llvm/DebugInfo/CodeView/SymbolSerializer.h
  llvm/include/llvm/DebugInfo/CodeView/TypeDumpVisitor.h
  llvm/include/llvm/DebugInfo/CodeView/TypeHashing.h
  llvm/include/llvm/DebugInfo/CodeView/TypeIndex.h
  llvm/include/llvm/DebugInfo/CodeView/TypeIndexDiscovery.h
  llvm/include/llvm/DebugInfo/CodeView/TypeRecordMapping.h
  llvm/include/llvm/DebugInfo/CodeView/TypeStreamMerger.h
  llvm/lib/DebugInfo/CodeView/AppendingTypeTableBuilder.cpp
  llvm/lib/DebugInfo/CodeView/CVSymbolVisitor.cpp
  llvm/lib/DebugInfo/CodeView/CVTypeVisitor.cpp
  llvm/lib/DebugInfo/CodeView/CodeViewRecordIO.cpp
  llvm/lib/DebugInfo/CodeView/DebugCrossExSubsection.cpp
  llvm/lib/DebugInfo/CodeView/DebugFrameDataSubsection.cpp
  llvm/lib/DebugInfo/CodeView/DebugSubsectionRecord.cpp
  llvm/lib/DebugInfo/CodeView/DebugSubsectionVisitor.cpp
  llvm/lib/DebugInfo/CodeView/DebugSymbolsSubsection.cpp
  llvm/lib/DebugInfo/CodeView/Formatters.cpp
  llvm/lib/DebugInfo/CodeView/GlobalTypeTableBuilder.cpp
  llvm/lib/DebugInfo/CodeView/LazyRandomTypeCollection.cpp
  llvm/lib/DebugInfo/CodeView/MergingTypeTableBuilder.cpp
  llvm/lib/DebugInfo/CodeView/RecordName.cpp
  llvm/lib/DebugInfo/CodeView/RecordSerialization.cpp
  llvm/lib/DebugInfo/CodeView/SimpleTypeSerializer.cpp
  llvm/lib/DebugInfo/CodeView/StringsAndChecksums.cpp
  llvm/lib/DebugInfo/CodeView/SymbolDumper.cpp
  llvm/lib/DebugInfo/CodeView/SymbolRecordHelpers.cpp
  llvm/lib/DebugInfo/CodeView/SymbolSerializer.cpp
  llvm/lib/DebugInfo/CodeView/TypeDumpVisitor.cpp
  llvm/lib/DebugInfo/CodeView/TypeRecordMapping.cpp
  llvm/lib/DebugInfo/CodeView/TypeStreamMerger.cpp
  llvm/lib/DebugInfo/CodeView/TypeTableCollection.cpp
  llvm/lib/ObjectYAML/COFFEmitter.cpp
  llvm/lib/ObjectYAML/CodeViewYAMLSymbols.cpp

Index: llvm/lib/ObjectYAML/CodeViewYAMLSymbols.cpp
===
--- llvm/lib/ObjectYAML/CodeViewYAMLSymbols.cpp
+++ llvm/lib/ObjectYAML/CodeViewYAMLSymbols.cpp
@@ -25,6 +25,7 @@
 #include "llvm/ObjectYAML/YAML.h"
 #include "llvm/Support/Allocator.h"
 #include "llvm/Support/Error.h"
+#include "llvm/Support/ScopedPrinter.h"
 #include "llvm/Support/YAMLTraits.h"
 #include 
 #include 
Index: llvm/lib/ObjectYAML/COFFEmitter.cpp
===
--- llvm/lib/ObjectYAML/COFFEmitter.cpp
+++ llvm/lib/ObjectYAML/COFFEmitter.cpp
@@ -19,6 +19,7 @@
 #include "llvm/Object/COFF.h"
 #include "llvm/ObjectYAML/ObjectYAML.h"
 #include "llvm/ObjectYAML/yaml2obj.h"
+#include "llvm/Support/BinaryStreamWriter.h"
 #include "llvm/Support/Endian.h"
 #include "llvm/Support/MemoryBuffer.h"
 #include "llvm/Support/SourceMgr.h"
Index: llvm/lib/DebugInfo/CodeView/TypeTableCollection.cpp
===
--- llvm/lib/DebugInfo/CodeView/TypeTableCollection.cpp
+++ llvm/lib/DebugInfo/CodeView/TypeTableCollection.cpp
@@ -8,9 +8,10 @@
 
 #include "llvm/DebugInfo/CodeView/TypeTableCollection.h"
 
-#include "llvm/DebugInfo/CodeView/CVTypeVisitor.h"
+#include "llvm/DebugInfo/CodeView/CodeView.h"
 #include "llvm/DebugInfo/CodeView/RecordName.h"
-#include "llvm/Support/BinaryStreamReader.h"
+#include "llvm/DebugInfo/CodeView/TypeIndex.h"
+#include "llvm/Support/ErrorHandling.h"
 
 u

[Lldb-commits] [PATCH] D119723: Cleanup LLVMDWARFDebugInfo

2022-02-14 Thread serge via Phabricator via lldb-commits
serge-sans-paille created this revision.
serge-sans-paille added reviewers: RKSimon, MaskRay, mehdi_amini, lenary.
Herald added subscribers: ayermolo, cmtice, rupprecht, arphaman, hiraditya.
Herald added a reviewer: jhenderson.
Herald added a reviewer: rafauler.
Herald added a reviewer: Amir.
Herald added a reviewer: maksfb.
serge-sans-paille requested review of this revision.
Herald added subscribers: llvm-commits, lldb-commits, yota9.
Herald added projects: LLDB, LLVM.

As usual with that header cleanup series, some implicit dependencies now need to
be explicit:

llvm/DebugInfo/DWARF/DWARFContext.h no longer includes:

- "llvm/DebugInfo/DWARF/DWARFAcceleratorTable.h"
- "llvm/DebugInfo/DWARF/DWARFCompileUnit.h"
- "llvm/DebugInfo/DWARF/DWARFDebugAbbrev.h"
- "llvm/DebugInfo/DWARF/DWARFDebugAranges.h"
- "llvm/DebugInfo/DWARF/DWARFDebugFrame.h"
- "llvm/DebugInfo/DWARF/DWARFDebugLoc.h"
- "llvm/DebugInfo/DWARF/DWARFDebugMacro.h"
- "llvm/DebugInfo/DWARF/DWARFGdbIndex.h"
- "llvm/DebugInfo/DWARF/DWARFSection.h"
- "llvm/DebugInfo/DWARF/DWARFTypeUnit.h"
- "llvm/DebugInfo/DWARF/DWARFUnitIndex.h"

Plus llvm/Support/Errc.h not included by a bunch of 
llvm/DebugInfo/DWARF/DWARF*.h files

Preprocessed lines to build llvm on my setup:
after:  1065629059
before: 1066621848

Which is a great diff!

Discourse thread: 
https://discourse.llvm.org/t/include-what-you-use-include-cleanup


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D119723

Files:
  bolt/lib/Core/BinaryContext.cpp
  bolt/lib/Core/BinaryEmitter.cpp
  bolt/lib/Core/DebugData.cpp
  bolt/lib/Core/Exceptions.cpp
  bolt/lib/Profile/DataAggregator.cpp
  bolt/lib/Profile/DataReader.cpp
  bolt/lib/Rewrite/DWARFRewriter.cpp
  bolt/lib/Rewrite/MachORewriteInstance.cpp
  bolt/lib/Rewrite/RewriteInstance.cpp
  bolt/tools/driver/llvm-bolt.cpp
  bolt/tools/heatmap/heatmap.cpp
  lldb/source/Expression/DWARFExpression.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h
  lldb/source/Symbol/UnwindPlan.cpp
  lldb/unittests/Symbol/PostfixExpressionTest.cpp
  lldb/unittests/SymbolFile/NativePDB/PdbFPOProgramToDWARFExpressionTests.cpp
  llvm/include/llvm/DWARFLinker/DWARFLinker.h
  llvm/include/llvm/DWARFLinker/DWARFLinkerCompileUnit.h
  llvm/include/llvm/DebugInfo/DWARF/DWARFAbbreviationDeclaration.h
  llvm/include/llvm/DebugInfo/DWARF/DWARFAddressRange.h
  llvm/include/llvm/DebugInfo/DWARF/DWARFCompileUnit.h
  llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h
  llvm/include/llvm/DebugInfo/DWARF/DWARFDebugAddr.h
  llvm/include/llvm/DebugInfo/DWARF/DWARFDebugArangeSet.h
  llvm/include/llvm/DebugInfo/DWARF/DWARFDebugAranges.h
  llvm/include/llvm/DebugInfo/DWARF/DWARFDebugFrame.h
  llvm/include/llvm/DebugInfo/DWARF/DWARFDebugInfoEntry.h
  llvm/include/llvm/DebugInfo/DWARF/DWARFDebugLine.h
  llvm/include/llvm/DebugInfo/DWARF/DWARFDebugLoc.h
  llvm/include/llvm/DebugInfo/DWARF/DWARFDebugMacro.h
  llvm/include/llvm/DebugInfo/DWARF/DWARFDebugPubTable.h
  llvm/include/llvm/DebugInfo/DWARF/DWARFDebugRangeList.h
  llvm/include/llvm/DebugInfo/DWARF/DWARFDebugRnglists.h
  llvm/include/llvm/DebugInfo/DWARF/DWARFDie.h
  llvm/include/llvm/DebugInfo/DWARF/DWARFExpression.h
  llvm/include/llvm/DebugInfo/DWARF/DWARFFormValue.h
  llvm/include/llvm/DebugInfo/DWARF/DWARFGdbIndex.h
  llvm/include/llvm/DebugInfo/DWARF/DWARFListTable.h
  llvm/include/llvm/DebugInfo/DWARF/DWARFTypeUnit.h
  llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h
  llvm/include/llvm/DebugInfo/DWARF/DWARFUnitIndex.h
  llvm/include/llvm/DebugInfo/DWARF/DWARFVerifier.h
  llvm/lib/DebugInfo/DWARF/DWARFAbbreviationDeclaration.cpp
  llvm/lib/DebugInfo/DWARF/DWARFAcceleratorTable.cpp
  llvm/lib/DebugInfo/DWARF/DWARFAddressRange.cpp
  llvm/lib/DebugInfo/DWARF/DWARFCompileUnit.cpp
  llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
  llvm/lib/DebugInfo/DWARF/DWARFDataExtractor.cpp
  llvm/lib/DebugInfo/DWARF/DWARFDebugAddr.cpp
  llvm/lib/DebugInfo/DWARF/DWARFDebugAranges.cpp
  llvm/lib/DebugInfo/DWARF/DWARFDebugFrame.cpp
  llvm/lib/DebugInfo/DWARF/DWARFDebugInfoEntry.cpp
  llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp
  llvm/lib/DebugInfo/DWARF/DWARFDebugLoc.cpp
  llvm/lib/DebugInfo/DWARF/DWARFDebugMacro.cpp
  llvm/lib/DebugInfo/DWARF/DWARFDie.cpp
  llvm/lib/DebugInfo/DWARF/DWARFFormValue.cpp
  llvm/lib/DebugInfo/DWARF/DWARFGdbIndex.cpp
  llvm/lib/DebugInfo/DWARF/DWARFTypeUnit.cpp
  llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp
  llvm/lib/DebugInfo/DWARF/DWARFUnitIndex.cpp
  llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp
  llvm/lib/DebugInfo/GSYM/DwarfTransformer.cpp
  llvm/lib/ProfileData/InstrProfCorrelator.cpp
  llvm/tools/llvm-dwarfdump/Statistics.cpp
  llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp
  llvm/tools/llvm-objdump/SourcePrinter.cpp
  llvm/tools/obj2yaml/dwarf2yaml.cpp
  llvm/tools/obj2yaml/elf2yaml.cpp
  llvm/tools/obj2yaml/macho2yaml.cpp
  llvm/unittests/DebugInfo/DWARF/DWARFDebugArangeSetTest.cpp
  llvm/unittests/DebugInfo/DWARF/DWARFDebugFrameTest.cpp
  llvm/unittests/DebugInf

[Lldb-commits] [PATCH] D119723: Cleanup LLVMDWARFDebugInfo

2022-02-15 Thread serge via Phabricator via lldb-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG290e48234282: Cleanup LLVMDWARFDebugInfo (authored by 
serge-sans-paille).

Changed prior to commit:
  https://reviews.llvm.org/D119723?vs=408418&id=408734#toc

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D119723/new/

https://reviews.llvm.org/D119723

Files:
  bolt/lib/Core/BinaryContext.cpp
  bolt/lib/Core/BinaryEmitter.cpp
  bolt/lib/Core/DebugData.cpp
  bolt/lib/Core/Exceptions.cpp
  bolt/lib/Profile/DataAggregator.cpp
  bolt/lib/Profile/DataReader.cpp
  bolt/lib/Rewrite/DWARFRewriter.cpp
  bolt/lib/Rewrite/MachORewriteInstance.cpp
  bolt/lib/Rewrite/RewriteInstance.cpp
  bolt/tools/driver/llvm-bolt.cpp
  bolt/tools/heatmap/heatmap.cpp
  lldb/source/Expression/DWARFExpression.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h
  lldb/source/Symbol/UnwindPlan.cpp
  lldb/unittests/Symbol/PostfixExpressionTest.cpp
  lldb/unittests/SymbolFile/NativePDB/PdbFPOProgramToDWARFExpressionTests.cpp
  llvm/include/llvm/DWARFLinker/DWARFLinker.h
  llvm/include/llvm/DWARFLinker/DWARFLinkerCompileUnit.h
  llvm/include/llvm/DebugInfo/DWARF/DWARFAbbreviationDeclaration.h
  llvm/include/llvm/DebugInfo/DWARF/DWARFAddressRange.h
  llvm/include/llvm/DebugInfo/DWARF/DWARFCompileUnit.h
  llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h
  llvm/include/llvm/DebugInfo/DWARF/DWARFDebugAddr.h
  llvm/include/llvm/DebugInfo/DWARF/DWARFDebugArangeSet.h
  llvm/include/llvm/DebugInfo/DWARF/DWARFDebugAranges.h
  llvm/include/llvm/DebugInfo/DWARF/DWARFDebugFrame.h
  llvm/include/llvm/DebugInfo/DWARF/DWARFDebugInfoEntry.h
  llvm/include/llvm/DebugInfo/DWARF/DWARFDebugLine.h
  llvm/include/llvm/DebugInfo/DWARF/DWARFDebugLoc.h
  llvm/include/llvm/DebugInfo/DWARF/DWARFDebugMacro.h
  llvm/include/llvm/DebugInfo/DWARF/DWARFDebugPubTable.h
  llvm/include/llvm/DebugInfo/DWARF/DWARFDebugRangeList.h
  llvm/include/llvm/DebugInfo/DWARF/DWARFDebugRnglists.h
  llvm/include/llvm/DebugInfo/DWARF/DWARFDie.h
  llvm/include/llvm/DebugInfo/DWARF/DWARFExpression.h
  llvm/include/llvm/DebugInfo/DWARF/DWARFFormValue.h
  llvm/include/llvm/DebugInfo/DWARF/DWARFGdbIndex.h
  llvm/include/llvm/DebugInfo/DWARF/DWARFListTable.h
  llvm/include/llvm/DebugInfo/DWARF/DWARFTypeUnit.h
  llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h
  llvm/include/llvm/DebugInfo/DWARF/DWARFUnitIndex.h
  llvm/include/llvm/DebugInfo/DWARF/DWARFVerifier.h
  llvm/lib/DebugInfo/DWARF/DWARFAbbreviationDeclaration.cpp
  llvm/lib/DebugInfo/DWARF/DWARFAcceleratorTable.cpp
  llvm/lib/DebugInfo/DWARF/DWARFAddressRange.cpp
  llvm/lib/DebugInfo/DWARF/DWARFCompileUnit.cpp
  llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
  llvm/lib/DebugInfo/DWARF/DWARFDataExtractor.cpp
  llvm/lib/DebugInfo/DWARF/DWARFDebugAddr.cpp
  llvm/lib/DebugInfo/DWARF/DWARFDebugAranges.cpp
  llvm/lib/DebugInfo/DWARF/DWARFDebugFrame.cpp
  llvm/lib/DebugInfo/DWARF/DWARFDebugInfoEntry.cpp
  llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp
  llvm/lib/DebugInfo/DWARF/DWARFDebugLoc.cpp
  llvm/lib/DebugInfo/DWARF/DWARFDebugMacro.cpp
  llvm/lib/DebugInfo/DWARF/DWARFDie.cpp
  llvm/lib/DebugInfo/DWARF/DWARFFormValue.cpp
  llvm/lib/DebugInfo/DWARF/DWARFGdbIndex.cpp
  llvm/lib/DebugInfo/DWARF/DWARFTypeUnit.cpp
  llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp
  llvm/lib/DebugInfo/DWARF/DWARFUnitIndex.cpp
  llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp
  llvm/lib/DebugInfo/GSYM/DwarfTransformer.cpp
  llvm/lib/ProfileData/InstrProfCorrelator.cpp
  llvm/tools/llvm-dwarfdump/Statistics.cpp
  llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp
  llvm/tools/llvm-objdump/SourcePrinter.cpp
  llvm/tools/obj2yaml/dwarf2yaml.cpp
  llvm/tools/obj2yaml/elf2yaml.cpp
  llvm/tools/obj2yaml/macho2yaml.cpp
  llvm/unittests/DebugInfo/DWARF/DWARFDebugArangeSetTest.cpp
  llvm/unittests/DebugInfo/DWARF/DWARFDebugFrameTest.cpp
  llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp
  llvm/unittests/DebugInfo/DWARF/DWARFDieManualExtractTest.cpp
  llvm/unittests/DebugInfo/DWARF/DWARFDieTest.cpp
  llvm/unittests/DebugInfo/DWARF/DWARFFormValueTest.cpp

Index: llvm/unittests/DebugInfo/DWARF/DWARFFormValueTest.cpp
===
--- llvm/unittests/DebugInfo/DWARF/DWARFFormValueTest.cpp
+++ llvm/unittests/DebugInfo/DWARF/DWARFFormValueTest.cpp
@@ -10,6 +10,7 @@
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/SmallString.h"
 #include "llvm/BinaryFormat/Dwarf.h"
+#include "llvm/DebugInfo/DWARF/DWARFDataExtractor.h"
 #include "llvm/Support/FormatVariadic.h"
 #include "llvm/Support/Host.h"
 #include "llvm/Support/LEB128.h"
Index: llvm/unittests/DebugInfo/DWARF/DWARFDieTest.cpp
===
--- llvm/unittests/DebugInfo/DWARF/DWARFDieTest.cpp
+++ llvm/unittests/DebugInfo/DWARF/DWARFDieTest.cpp
@@ -7,6 +7,7 @@
 //===

[Lldb-commits] [PATCH] D120195: Cleanup llvm/DebugInfo/PDB headers

2022-02-19 Thread serge via Phabricator via lldb-commits
serge-sans-paille created this revision.
serge-sans-paille added reviewers: RKSimon, MaskRay, lenary.
Herald added a subscriber: hiraditya.
serge-sans-paille requested review of this revision.
Herald added projects: LLDB, LLVM.
Herald added subscribers: llvm-commits, lldb-commits.

accumulated preprocessed size:
before: 1065515095
after: 1065629059

Discourse thread: 
https://discourse.llvm.org/t/include-what-you-use-include-cleanup


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D120195

Files:
  lld/COFF/PDB.cpp
  lldb/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp
  lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
  llvm/include/llvm/DebugInfo/MSF/MSFBuilder.h
  llvm/include/llvm/DebugInfo/PDB/Native/DbiModuleDescriptorBuilder.h
  llvm/include/llvm/DebugInfo/PDB/Native/DbiStreamBuilder.h
  llvm/include/llvm/DebugInfo/PDB/Native/GSIStreamBuilder.h
  llvm/include/llvm/DebugInfo/PDB/Native/InfoStreamBuilder.h
  llvm/include/llvm/DebugInfo/PDB/Native/NativeEnumGlobals.h
  llvm/include/llvm/DebugInfo/PDB/Native/NativeEnumLineNumbers.h
  llvm/include/llvm/DebugInfo/PDB/Native/NativeEnumSymbols.h
  llvm/include/llvm/DebugInfo/PDB/Native/NativeEnumTypes.h
  llvm/include/llvm/DebugInfo/PDB/Native/NativeExeSymbol.h
  llvm/include/llvm/DebugInfo/PDB/Native/NativeFunctionSymbol.h
  llvm/include/llvm/DebugInfo/PDB/Native/NativeInlineSiteSymbol.h
  llvm/include/llvm/DebugInfo/PDB/Native/NativeLineNumber.h
  llvm/include/llvm/DebugInfo/PDB/Native/NativePublicSymbol.h
  llvm/include/llvm/DebugInfo/PDB/Native/NativeSession.h
  llvm/include/llvm/DebugInfo/PDB/Native/NativeSourceFile.h
  llvm/include/llvm/DebugInfo/PDB/Native/NativeSymbolEnumerator.h
  llvm/include/llvm/DebugInfo/PDB/Native/NativeTypeEnum.h
  llvm/include/llvm/DebugInfo/PDB/Native/NativeTypeFunctionSig.h
  llvm/include/llvm/DebugInfo/PDB/Native/NativeTypePointer.h
  llvm/include/llvm/DebugInfo/PDB/Native/NativeTypeTypedef.h
  llvm/include/llvm/DebugInfo/PDB/Native/NativeTypeUDT.h
  llvm/include/llvm/DebugInfo/PDB/Native/NativeTypeVTShape.h
  llvm/include/llvm/DebugInfo/PDB/Native/PDBFileBuilder.h
  llvm/include/llvm/DebugInfo/PDB/Native/SymbolCache.h
  llvm/include/llvm/DebugInfo/PDB/Native/TpiStreamBuilder.h
  llvm/include/llvm/DebugInfo/PDB/PDBSymbol.h
  llvm/include/llvm/DebugInfo/PDB/PDBSymbolAnnotation.h
  llvm/include/llvm/DebugInfo/PDB/PDBSymbolBlock.h
  llvm/include/llvm/DebugInfo/PDB/PDBSymbolCompilandDetails.h
  llvm/include/llvm/DebugInfo/PDB/PDBSymbolCompilandEnv.h
  llvm/include/llvm/DebugInfo/PDB/PDBSymbolCustom.h
  llvm/include/llvm/DebugInfo/PDB/PDBSymbolData.h
  llvm/include/llvm/DebugInfo/PDB/PDBSymbolFunc.h
  llvm/include/llvm/DebugInfo/PDB/PDBSymbolFuncDebugEnd.h
  llvm/include/llvm/DebugInfo/PDB/PDBSymbolFuncDebugStart.h
  llvm/include/llvm/DebugInfo/PDB/PDBSymbolLabel.h
  llvm/include/llvm/DebugInfo/PDB/PDBSymbolPublicSymbol.h
  llvm/include/llvm/DebugInfo/PDB/PDBSymbolThunk.h
  llvm/include/llvm/DebugInfo/PDB/PDBSymbolTypeArray.h
  llvm/include/llvm/DebugInfo/PDB/PDBSymbolTypeBaseClass.h
  llvm/include/llvm/DebugInfo/PDB/PDBSymbolTypeBuiltin.h
  llvm/include/llvm/DebugInfo/PDB/PDBSymbolTypeCustom.h
  llvm/include/llvm/DebugInfo/PDB/PDBSymbolTypeDimension.h
  llvm/include/llvm/DebugInfo/PDB/PDBSymbolTypeEnum.h
  llvm/include/llvm/DebugInfo/PDB/PDBSymbolTypeFriend.h
  llvm/include/llvm/DebugInfo/PDB/PDBSymbolTypeFunctionArg.h
  llvm/include/llvm/DebugInfo/PDB/PDBSymbolTypeManaged.h
  llvm/include/llvm/DebugInfo/PDB/PDBSymbolTypePointer.h
  llvm/include/llvm/DebugInfo/PDB/PDBSymbolTypeTypedef.h
  llvm/include/llvm/DebugInfo/PDB/PDBSymbolTypeUDT.h
  llvm/include/llvm/DebugInfo/PDB/PDBSymbolTypeVTable.h
  llvm/include/llvm/DebugInfo/PDB/PDBSymbolTypeVTableShape.h
  llvm/include/llvm/DebugInfo/PDB/PDBSymbolUnknown.h
  llvm/include/llvm/DebugInfo/PDB/PDBSymbolUsingNamespace.h
  llvm/include/llvm/DebugInfo/PDB/UDTLayout.h
  llvm/lib/DebugInfo/DWARF/DWARFCompileUnit.cpp
  llvm/lib/DebugInfo/MSF/MappedBlockStream.cpp
  llvm/lib/DebugInfo/PDB/Native/DbiModuleDescriptorBuilder.cpp
  llvm/lib/DebugInfo/PDB/Native/DbiStreamBuilder.cpp
  llvm/lib/DebugInfo/PDB/Native/GSIStreamBuilder.cpp
  llvm/lib/DebugInfo/PDB/Native/InfoStreamBuilder.cpp
  llvm/lib/DebugInfo/PDB/Native/NativeCompilandSymbol.cpp
  llvm/lib/DebugInfo/PDB/Native/NativeEnumGlobals.cpp
  llvm/lib/DebugInfo/PDB/Native/NativeEnumLineNumbers.cpp
  llvm/lib/DebugInfo/PDB/Native/NativeEnumModules.cpp
  llvm/lib/DebugInfo/PDB/Native/NativeEnumSymbols.cpp
  llvm/lib/DebugInfo/PDB/Native/NativeEnumTypes.cpp
  llvm/lib/DebugInfo/PDB/Native/NativeExeSymbol.cpp
  llvm/lib/DebugInfo/PDB/Native/NativeFunctionSymbol.cpp
  llvm/lib/DebugInfo/PDB/Native/NativeInlineSiteSymbol.cpp
  llvm/lib/DebugInfo/PDB/Native/NativeLineNumber.cpp
  llvm/lib/DebugInfo/PDB/Native/NativePublicSymbol.cpp
  llvm/lib/DebugInfo/PDB/Native/NativeRawSymbol.cpp
  llvm/lib/DebugInfo/PDB/Native/NativeSession.cpp
  llvm/lib/DebugInfo/PDB/Native/NativeSourceFile.cpp
  llvm/lib/DebugInfo/PDB/Native/NativeS

[Lldb-commits] [PATCH] D120195: Cleanup llvm/DebugInfo/PDB headers

2022-02-20 Thread serge via Phabricator via lldb-commits
serge-sans-paille added a comment.

In D120195#942 , @MaskRay wrote:

>   before: 1065515095
>   after: 1065629059
>
> An increase?

Ooopsie, a typo :-)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D120195/new/

https://reviews.llvm.org/D120195

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D120195: Cleanup llvm/DebugInfo/PDB headers

2022-02-20 Thread serge via Phabricator via lldb-commits
serge-sans-paille added a comment.

In D120195#943 , @MaskRay wrote:

> It'd be good to test `-DLLVM_ENABLE_MODULES=on` build.

Sure, I'll add that to my local test setup.

> Some files get pure new headers.

That's expected. It happens a lot when some headers gets a forward declaration 
instead of a header include when referencing a type.

> I still think it is good thing to do it separately. There is a risk that 
> someone may revert the change if it breaks some build modes.
> Splitting the change can be mechanical, perhaps with some git commands to 
> detect what files get pure addition.

I fear I don't have the energy to go at that grain of detail :-/ I'm currently 
testing with all projects enabled, in release mode. I'll add a setup with 
ENABLE_MODULE and DEBUG mode to increase the coverage of my pre-commit test


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D120195/new/

https://reviews.llvm.org/D120195

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D120195: Cleanup llvm/DebugInfo/PDB headers

2022-02-23 Thread serge via Phabricator via lldb-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGeb4c8608115c: Cleanup llvm/DebugInfo/PDB headers (authored 
by serge-sans-paille).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D120195/new/

https://reviews.llvm.org/D120195

Files:
  lld/COFF/PDB.cpp
  lldb/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp
  lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
  llvm/include/llvm/DebugInfo/MSF/MSFBuilder.h
  llvm/include/llvm/DebugInfo/PDB/Native/DbiModuleDescriptorBuilder.h
  llvm/include/llvm/DebugInfo/PDB/Native/DbiStreamBuilder.h
  llvm/include/llvm/DebugInfo/PDB/Native/GSIStreamBuilder.h
  llvm/include/llvm/DebugInfo/PDB/Native/InfoStreamBuilder.h
  llvm/include/llvm/DebugInfo/PDB/Native/NativeEnumGlobals.h
  llvm/include/llvm/DebugInfo/PDB/Native/NativeEnumLineNumbers.h
  llvm/include/llvm/DebugInfo/PDB/Native/NativeEnumSymbols.h
  llvm/include/llvm/DebugInfo/PDB/Native/NativeEnumTypes.h
  llvm/include/llvm/DebugInfo/PDB/Native/NativeExeSymbol.h
  llvm/include/llvm/DebugInfo/PDB/Native/NativeFunctionSymbol.h
  llvm/include/llvm/DebugInfo/PDB/Native/NativeInlineSiteSymbol.h
  llvm/include/llvm/DebugInfo/PDB/Native/NativeLineNumber.h
  llvm/include/llvm/DebugInfo/PDB/Native/NativePublicSymbol.h
  llvm/include/llvm/DebugInfo/PDB/Native/NativeSession.h
  llvm/include/llvm/DebugInfo/PDB/Native/NativeSourceFile.h
  llvm/include/llvm/DebugInfo/PDB/Native/NativeSymbolEnumerator.h
  llvm/include/llvm/DebugInfo/PDB/Native/NativeTypeEnum.h
  llvm/include/llvm/DebugInfo/PDB/Native/NativeTypeFunctionSig.h
  llvm/include/llvm/DebugInfo/PDB/Native/NativeTypePointer.h
  llvm/include/llvm/DebugInfo/PDB/Native/NativeTypeTypedef.h
  llvm/include/llvm/DebugInfo/PDB/Native/NativeTypeUDT.h
  llvm/include/llvm/DebugInfo/PDB/Native/NativeTypeVTShape.h
  llvm/include/llvm/DebugInfo/PDB/Native/PDBFileBuilder.h
  llvm/include/llvm/DebugInfo/PDB/Native/SymbolCache.h
  llvm/include/llvm/DebugInfo/PDB/Native/TpiStreamBuilder.h
  llvm/include/llvm/DebugInfo/PDB/PDBSymbol.h
  llvm/include/llvm/DebugInfo/PDB/PDBSymbolAnnotation.h
  llvm/include/llvm/DebugInfo/PDB/PDBSymbolBlock.h
  llvm/include/llvm/DebugInfo/PDB/PDBSymbolCompilandDetails.h
  llvm/include/llvm/DebugInfo/PDB/PDBSymbolCompilandEnv.h
  llvm/include/llvm/DebugInfo/PDB/PDBSymbolCustom.h
  llvm/include/llvm/DebugInfo/PDB/PDBSymbolData.h
  llvm/include/llvm/DebugInfo/PDB/PDBSymbolFunc.h
  llvm/include/llvm/DebugInfo/PDB/PDBSymbolFuncDebugEnd.h
  llvm/include/llvm/DebugInfo/PDB/PDBSymbolFuncDebugStart.h
  llvm/include/llvm/DebugInfo/PDB/PDBSymbolLabel.h
  llvm/include/llvm/DebugInfo/PDB/PDBSymbolPublicSymbol.h
  llvm/include/llvm/DebugInfo/PDB/PDBSymbolThunk.h
  llvm/include/llvm/DebugInfo/PDB/PDBSymbolTypeArray.h
  llvm/include/llvm/DebugInfo/PDB/PDBSymbolTypeBaseClass.h
  llvm/include/llvm/DebugInfo/PDB/PDBSymbolTypeBuiltin.h
  llvm/include/llvm/DebugInfo/PDB/PDBSymbolTypeCustom.h
  llvm/include/llvm/DebugInfo/PDB/PDBSymbolTypeDimension.h
  llvm/include/llvm/DebugInfo/PDB/PDBSymbolTypeEnum.h
  llvm/include/llvm/DebugInfo/PDB/PDBSymbolTypeFriend.h
  llvm/include/llvm/DebugInfo/PDB/PDBSymbolTypeFunctionArg.h
  llvm/include/llvm/DebugInfo/PDB/PDBSymbolTypeManaged.h
  llvm/include/llvm/DebugInfo/PDB/PDBSymbolTypePointer.h
  llvm/include/llvm/DebugInfo/PDB/PDBSymbolTypeTypedef.h
  llvm/include/llvm/DebugInfo/PDB/PDBSymbolTypeUDT.h
  llvm/include/llvm/DebugInfo/PDB/PDBSymbolTypeVTable.h
  llvm/include/llvm/DebugInfo/PDB/PDBSymbolTypeVTableShape.h
  llvm/include/llvm/DebugInfo/PDB/PDBSymbolUnknown.h
  llvm/include/llvm/DebugInfo/PDB/PDBSymbolUsingNamespace.h
  llvm/include/llvm/DebugInfo/PDB/UDTLayout.h
  llvm/lib/DebugInfo/DWARF/DWARFCompileUnit.cpp
  llvm/lib/DebugInfo/MSF/MappedBlockStream.cpp
  llvm/lib/DebugInfo/PDB/Native/DbiModuleDescriptorBuilder.cpp
  llvm/lib/DebugInfo/PDB/Native/DbiStreamBuilder.cpp
  llvm/lib/DebugInfo/PDB/Native/GSIStreamBuilder.cpp
  llvm/lib/DebugInfo/PDB/Native/InfoStreamBuilder.cpp
  llvm/lib/DebugInfo/PDB/Native/NativeCompilandSymbol.cpp
  llvm/lib/DebugInfo/PDB/Native/NativeEnumGlobals.cpp
  llvm/lib/DebugInfo/PDB/Native/NativeEnumLineNumbers.cpp
  llvm/lib/DebugInfo/PDB/Native/NativeEnumModules.cpp
  llvm/lib/DebugInfo/PDB/Native/NativeEnumSymbols.cpp
  llvm/lib/DebugInfo/PDB/Native/NativeEnumTypes.cpp
  llvm/lib/DebugInfo/PDB/Native/NativeExeSymbol.cpp
  llvm/lib/DebugInfo/PDB/Native/NativeFunctionSymbol.cpp
  llvm/lib/DebugInfo/PDB/Native/NativeInlineSiteSymbol.cpp
  llvm/lib/DebugInfo/PDB/Native/NativeLineNumber.cpp
  llvm/lib/DebugInfo/PDB/Native/NativePublicSymbol.cpp
  llvm/lib/DebugInfo/PDB/Native/NativeRawSymbol.cpp
  llvm/lib/DebugInfo/PDB/Native/NativeSession.cpp
  llvm/lib/DebugInfo/PDB/Native/NativeSourceFile.cpp
  llvm/lib/DebugInfo/PDB/Native/NativeSymbolEnumerator.cpp
  llvm/lib/DebugInfo/PDB/Native/NativeTypeArray.cpp
  llvm/lib/DebugInfo/PDB/Native/NativeTypeEnum.cpp
  llvm/lib/Debug

[Lldb-commits] [PATCH] D120195: Cleanup llvm/DebugInfo/PDB headers

2022-02-23 Thread serge via Phabricator via lldb-commits
serge-sans-paille added a comment.

@thakis should be fixed by 57c6012213b50804ed78530b89bae30c0ee4fe82 
 , the new 
failure (seems) unrelated to this change.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D120195/new/

https://reviews.llvm.org/D120195

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D121168: Cleanup includes: LLVMTarget

2022-03-08 Thread serge via Phabricator via lldb-commits
serge-sans-paille created this revision.
serge-sans-paille added reviewers: MaskRay, RKSimon, lenary.
Herald added subscribers: kerbowa, Jim, atanasyan, jrtc27, hiraditya, nhaehnle, 
jvesely, sdardis, dylanmckay.
Herald added a project: All.
serge-sans-paille requested review of this revision.
Herald added projects: LLDB, LLVM.
Herald added subscribers: llvm-commits, lldb-commits.

Most notably, Pass.h is no longer included by TargetMachine.h
before: 1063570306
after:  1063332844


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D121168

Files:
  
lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptExpressionOpts.h
  
llvm/examples/OrcV2Examples/LLJITWithOptimizingIRTransform/LLJITWithOptimizingIRTransform.cpp
  llvm/include/llvm/Target/TargetLoweringObjectFile.h
  llvm/include/llvm/Target/TargetMachine.h
  llvm/lib/Target/AArch64/AArch64.h
  llvm/lib/Target/AVR/AVR.h
  llvm/lib/Target/BPF/BPF.h
  llvm/lib/Target/Mips/MipsOs16.cpp
  llvm/lib/Target/TargetIntrinsicInfo.cpp
  llvm/lib/Target/TargetLoweringObjectFile.cpp
  llvm/lib/Target/TargetMachine.cpp
  llvm/lib/Target/TargetMachineC.cpp
  llvm/lib/Target/XCore/XCore.h
  llvm/unittests/CodeGen/AMDGPUMetadataTest.cpp
  llvm/unittests/MC/AMDGPU/DwarfRegMappings.cpp

Index: llvm/unittests/MC/AMDGPU/DwarfRegMappings.cpp
===
--- llvm/unittests/MC/AMDGPU/DwarfRegMappings.cpp
+++ llvm/unittests/MC/AMDGPU/DwarfRegMappings.cpp
@@ -12,6 +12,7 @@
 #include "llvm/Support/TargetSelect.h"
 #include "llvm/Target/TargetMachine.h"
 #include "gtest/gtest.h"
+#include 
 #include 
 
 using namespace llvm;
Index: llvm/unittests/CodeGen/AMDGPUMetadataTest.cpp
===
--- llvm/unittests/CodeGen/AMDGPUMetadataTest.cpp
+++ llvm/unittests/CodeGen/AMDGPUMetadataTest.cpp
@@ -14,6 +14,7 @@
 
 #include "llvm/IR/LegacyPassManager.h"
 #include "llvm/MC/TargetRegistry.h"
+#include "llvm/Pass.h"
 #include "llvm/Support/TargetSelect.h"
 #include "llvm/Target/TargetMachine.h"
 #include "gtest/gtest.h"
Index: llvm/lib/Target/XCore/XCore.h
===
--- llvm/lib/Target/XCore/XCore.h
+++ llvm/lib/Target/XCore/XCore.h
@@ -15,6 +15,7 @@
 #define LLVM_LIB_TARGET_XCORE_XCORE_H
 
 #include "MCTargetDesc/XCoreMCTargetDesc.h"
+#include "llvm/PassRegistry.h"
 #include "llvm/Target/TargetMachine.h"
 
 namespace llvm {
Index: llvm/lib/Target/TargetMachineC.cpp
===
--- llvm/lib/Target/TargetMachineC.cpp
+++ llvm/lib/Target/TargetMachineC.cpp
@@ -11,7 +11,6 @@
 //===--===//
 
 #include "llvm-c/Core.h"
-#include "llvm-c/Target.h"
 #include "llvm-c/TargetMachine.h"
 #include "llvm/Analysis/TargetTransformInfo.h"
 #include "llvm/IR/DataLayout.h"
@@ -20,13 +19,10 @@
 #include "llvm/MC/SubtargetFeature.h"
 #include "llvm/MC/TargetRegistry.h"
 #include "llvm/Support/FileSystem.h"
-#include "llvm/Support/FormattedStream.h"
 #include "llvm/Support/Host.h"
 #include "llvm/Support/raw_ostream.h"
 #include "llvm/Target/CodeGenCWrappers.h"
 #include "llvm/Target/TargetMachine.h"
-#include 
-#include 
 #include 
 
 using namespace llvm;
Index: llvm/lib/Target/TargetMachine.cpp
===
--- llvm/lib/Target/TargetMachine.cpp
+++ llvm/lib/Target/TargetMachine.cpp
@@ -13,19 +13,14 @@
 #include "llvm/Target/TargetMachine.h"
 #include "llvm/Analysis/TargetTransformInfo.h"
 #include "llvm/IR/Function.h"
-#include "llvm/IR/GlobalAlias.h"
 #include "llvm/IR/GlobalValue.h"
 #include "llvm/IR/GlobalVariable.h"
-#include "llvm/IR/LegacyPassManager.h"
 #include "llvm/IR/Mangler.h"
 #include "llvm/MC/MCAsmInfo.h"
 #include "llvm/MC/MCContext.h"
 #include "llvm/MC/MCInstrInfo.h"
 #include "llvm/MC/MCRegisterInfo.h"
-#include "llvm/MC/MCSectionMachO.h"
 #include "llvm/MC/MCSubtargetInfo.h"
-#include "llvm/MC/MCTargetOptions.h"
-#include "llvm/MC/SectionKind.h"
 #include "llvm/Target/TargetLoweringObjectFile.h"
 using namespace llvm;
 
Index: llvm/lib/Target/TargetLoweringObjectFile.cpp
===
--- llvm/lib/Target/TargetLoweringObjectFile.cpp
+++ llvm/lib/Target/TargetLoweringObjectFile.cpp
@@ -24,10 +24,8 @@
 #include "llvm/MC/MCContext.h"
 #include "llvm/MC/MCExpr.h"
 #include "llvm/MC/MCStreamer.h"
-#include "llvm/MC/MCSymbol.h"
 #include "llvm/MC/SectionKind.h"
 #include "llvm/Support/ErrorHandling.h"
-#include "llvm/Support/raw_ostream.h"
 #include "llvm/Target/TargetMachine.h"
 #include "llvm/Target/TargetOptions.h"
 using namespace llvm;
Index: llvm/lib/Target/TargetIntrinsicInfo.cpp
===
--- llvm/lib/Target/TargetIntrinsicInfo.cpp
+++ llvm/lib/Target/TargetIntrinsicInfo.cpp
@@ -11,7 +11,7 @@
 //

[Lldb-commits] [PATCH] D121168: Cleanup includes: LLVMTarget

2022-03-10 Thread serge via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG3c4410dfcaaf: Cleanup includes: LLVMTarget (authored by 
serge-sans-paille).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D121168/new/

https://reviews.llvm.org/D121168

Files:
  
lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptExpressionOpts.h
  
llvm/examples/OrcV2Examples/LLJITWithOptimizingIRTransform/LLJITWithOptimizingIRTransform.cpp
  llvm/include/llvm/Target/TargetLoweringObjectFile.h
  llvm/include/llvm/Target/TargetMachine.h
  llvm/lib/Target/AArch64/AArch64.h
  llvm/lib/Target/AVR/AVR.h
  llvm/lib/Target/BPF/BPF.h
  llvm/lib/Target/Mips/MipsOs16.cpp
  llvm/lib/Target/TargetIntrinsicInfo.cpp
  llvm/lib/Target/TargetLoweringObjectFile.cpp
  llvm/lib/Target/TargetMachine.cpp
  llvm/lib/Target/TargetMachineC.cpp
  llvm/lib/Target/XCore/XCore.h
  llvm/unittests/CodeGen/AMDGPUMetadataTest.cpp
  llvm/unittests/MC/AMDGPU/DwarfRegMappings.cpp

Index: llvm/unittests/MC/AMDGPU/DwarfRegMappings.cpp
===
--- llvm/unittests/MC/AMDGPU/DwarfRegMappings.cpp
+++ llvm/unittests/MC/AMDGPU/DwarfRegMappings.cpp
@@ -12,6 +12,7 @@
 #include "llvm/Support/TargetSelect.h"
 #include "llvm/Target/TargetMachine.h"
 #include "gtest/gtest.h"
+#include 
 #include 
 
 using namespace llvm;
Index: llvm/unittests/CodeGen/AMDGPUMetadataTest.cpp
===
--- llvm/unittests/CodeGen/AMDGPUMetadataTest.cpp
+++ llvm/unittests/CodeGen/AMDGPUMetadataTest.cpp
@@ -14,6 +14,7 @@
 
 #include "llvm/IR/LegacyPassManager.h"
 #include "llvm/MC/TargetRegistry.h"
+#include "llvm/Pass.h"
 #include "llvm/Support/TargetSelect.h"
 #include "llvm/Target/TargetMachine.h"
 #include "gtest/gtest.h"
Index: llvm/lib/Target/XCore/XCore.h
===
--- llvm/lib/Target/XCore/XCore.h
+++ llvm/lib/Target/XCore/XCore.h
@@ -15,6 +15,7 @@
 #define LLVM_LIB_TARGET_XCORE_XCORE_H
 
 #include "MCTargetDesc/XCoreMCTargetDesc.h"
+#include "llvm/PassRegistry.h"
 #include "llvm/Target/TargetMachine.h"
 
 namespace llvm {
Index: llvm/lib/Target/TargetMachineC.cpp
===
--- llvm/lib/Target/TargetMachineC.cpp
+++ llvm/lib/Target/TargetMachineC.cpp
@@ -11,7 +11,6 @@
 //===--===//
 
 #include "llvm-c/Core.h"
-#include "llvm-c/Target.h"
 #include "llvm-c/TargetMachine.h"
 #include "llvm/Analysis/TargetTransformInfo.h"
 #include "llvm/IR/DataLayout.h"
@@ -20,13 +19,10 @@
 #include "llvm/MC/SubtargetFeature.h"
 #include "llvm/MC/TargetRegistry.h"
 #include "llvm/Support/FileSystem.h"
-#include "llvm/Support/FormattedStream.h"
 #include "llvm/Support/Host.h"
 #include "llvm/Support/raw_ostream.h"
 #include "llvm/Target/CodeGenCWrappers.h"
 #include "llvm/Target/TargetMachine.h"
-#include 
-#include 
 #include 
 
 using namespace llvm;
Index: llvm/lib/Target/TargetMachine.cpp
===
--- llvm/lib/Target/TargetMachine.cpp
+++ llvm/lib/Target/TargetMachine.cpp
@@ -13,19 +13,14 @@
 #include "llvm/Target/TargetMachine.h"
 #include "llvm/Analysis/TargetTransformInfo.h"
 #include "llvm/IR/Function.h"
-#include "llvm/IR/GlobalAlias.h"
 #include "llvm/IR/GlobalValue.h"
 #include "llvm/IR/GlobalVariable.h"
-#include "llvm/IR/LegacyPassManager.h"
 #include "llvm/IR/Mangler.h"
 #include "llvm/MC/MCAsmInfo.h"
 #include "llvm/MC/MCContext.h"
 #include "llvm/MC/MCInstrInfo.h"
 #include "llvm/MC/MCRegisterInfo.h"
-#include "llvm/MC/MCSectionMachO.h"
 #include "llvm/MC/MCSubtargetInfo.h"
-#include "llvm/MC/MCTargetOptions.h"
-#include "llvm/MC/SectionKind.h"
 #include "llvm/Target/TargetLoweringObjectFile.h"
 using namespace llvm;
 
Index: llvm/lib/Target/TargetLoweringObjectFile.cpp
===
--- llvm/lib/Target/TargetLoweringObjectFile.cpp
+++ llvm/lib/Target/TargetLoweringObjectFile.cpp
@@ -24,10 +24,8 @@
 #include "llvm/MC/MCContext.h"
 #include "llvm/MC/MCExpr.h"
 #include "llvm/MC/MCStreamer.h"
-#include "llvm/MC/MCSymbol.h"
 #include "llvm/MC/SectionKind.h"
 #include "llvm/Support/ErrorHandling.h"
-#include "llvm/Support/raw_ostream.h"
 #include "llvm/Target/TargetMachine.h"
 #include "llvm/Target/TargetOptions.h"
 using namespace llvm;
Index: llvm/lib/Target/TargetIntrinsicInfo.cpp
===
--- llvm/lib/Target/TargetIntrinsicInfo.cpp
+++ llvm/lib/Target/TargetIntrinsicInfo.cpp
@@ -11,7 +11,7 @@
 //===--===//
 
 #include "llvm/Target/TargetIntrinsicInfo.h"
-#include "llvm/ADT/StringMap.h"
+#include "llvm/ADT/StringMapEntry.h"
 #include "llvm/IR/Function.h"
 using namespace llv

[Lldb-commits] [PATCH] D129261: [lldb/test] Add Shell/Expr/TestStringLiteralExpr.test

2022-07-07 Thread serge via Phabricator via lldb-commits
serge-sans-paille added a reviewer: JDevlieghere.
serge-sans-paille added inline comments.



Comment at: lldb/test/Shell/Expr/TestStringLiteralExpr.test:1
+# RUN: echo %t
+# RUN: echo %s

This line and the one below looks like debug code and should be removed


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D129261/new/

https://reviews.llvm.org/D129261

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D129261: [lldb/test] Add Shell/Expr/TestStringLiteralExpr.test

2022-07-08 Thread serge via Phabricator via lldb-commits
serge-sans-paille added a comment.

I checked the test base and didn't find any similar test either.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D129261/new/

https://reviews.llvm.org/D129261

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D129261: [lldb/test] Add Shell/Expr/TestStringLiteralExpr.test

2022-07-08 Thread serge via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGb042d15d2e39: [lldb/test] Add 
Shell/Expr/TestStringLiteralExpr.test (authored by jchecahi, committed by 
serge-sans-paille).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D129261/new/

https://reviews.llvm.org/D129261

Files:
  lldb/test/Shell/Expr/TestStringLiteralExpr.test


Index: lldb/test/Shell/Expr/TestStringLiteralExpr.test
===
--- /dev/null
+++ lldb/test/Shell/Expr/TestStringLiteralExpr.test
@@ -0,0 +1,11 @@
+# RUN: echo "int main() { return 0; }" | %clang_host -x c -o %t -
+# RUN: %lldb -s %s %t | FileCheck %s
+
+# Make sure that lldb doesn't crash when evaluating expressions with string 
literals
+b main
+run
+expr "hello there"
+expr printf("hello there")
+
+# CHECK: (const char[12]) $0 = "hello there"
+# CHECK: (int) $1 = 11


Index: lldb/test/Shell/Expr/TestStringLiteralExpr.test
===
--- /dev/null
+++ lldb/test/Shell/Expr/TestStringLiteralExpr.test
@@ -0,0 +1,11 @@
+# RUN: echo "int main() { return 0; }" | %clang_host -x c -o %t -
+# RUN: %lldb -s %s %t | FileCheck %s
+
+# Make sure that lldb doesn't crash when evaluating expressions with string literals
+b main
+run
+expr "hello there"
+expr printf("hello there")
+
+# CHECK: (const char[12]) $0 = "hello there"
+# CHECK: (int) $1 = 11
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D124760: [lldb] Fix ppc64 detection in lldb

2022-05-02 Thread serge via Phabricator via lldb-commits
serge-sans-paille created this revision.
serge-sans-paille added reviewers: MaskRay, jasonmolenda, labath.
Herald added subscribers: StephenFan, shchenz, kbarton, nemanjai, emaste.
Herald added a project: All.
serge-sans-paille requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

Currently, ppc64le and ppc64 (defaulting to big endian) have the same
descriptor, thus the linear scan always return ppc64le. Handle that through
subtype.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D124760

Files:
  lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
  lldb/source/Utility/ArchSpec.cpp
  lldb/test/API/functionalities/postmortem/elf-core/TestLinuxCore.py
  lldb/test/API/functionalities/postmortem/elf-core/linux-ppc64.core
  lldb/test/API/functionalities/postmortem/elf-core/linux-ppc64.out


Index: lldb/test/API/functionalities/postmortem/elf-core/TestLinuxCore.py
===
--- lldb/test/API/functionalities/postmortem/elf-core/TestLinuxCore.py
+++ lldb/test/API/functionalities/postmortem/elf-core/TestLinuxCore.py
@@ -24,12 +24,14 @@
 _i386_pid = 32306
 _x86_64_pid = 32259
 _s390x_pid = 1045
+_ppc64_pid = 28146
 _ppc64le_pid = 28147
 
 _aarch64_regions = 4
 _i386_regions = 4
 _x86_64_regions = 5
 _s390x_regions = 2
+_ppc64_regions = 2
 _ppc64le_regions = 2
 
 @skipIfLLVMTargetMissing("AArch64")
@@ -49,6 +51,12 @@
 self.do_test("linux-ppc64le", self._ppc64le_pid, self._ppc64le_regions,
  "linux-ppc64le.ou")
 
+@skipIfLLVMTargetMissing("PowerPC")
+def test_ppc64(self):
+"""Test that lldb can read the process information from an ppc64 linux 
core file."""
+self.do_test("linux-ppc64", self._ppc64_pid, self._ppc64_regions,
+ "linux-ppc64.ou")
+
 @skipIfLLVMTargetMissing("X86")
 def test_x86_64(self):
 """Test that lldb can read the process information from an x86_64 
linux core file."""
Index: lldb/source/Utility/ArchSpec.cpp
===
--- lldb/source/Utility/ArchSpec.cpp
+++ lldb/source/Utility/ArchSpec.cpp
@@ -358,9 +358,9 @@
  0xu, 0xu}, // Intel MCU // FIXME: is this correct?
 {ArchSpec::eCore_ppc_generic, llvm::ELF::EM_PPC, LLDB_INVALID_CPUTYPE,
  0xu, 0xu}, // PowerPC
-{ArchSpec::eCore_ppc64le_generic, llvm::ELF::EM_PPC64, 
LLDB_INVALID_CPUTYPE,
+{ArchSpec::eCore_ppc64le_generic, llvm::ELF::EM_PPC64, 
ArchSpec::eCore_ppc64le_generic,
  0xu, 0xu}, // PowerPC64le
-{ArchSpec::eCore_ppc64_generic, llvm::ELF::EM_PPC64, LLDB_INVALID_CPUTYPE,
+{ArchSpec::eCore_ppc64_generic, llvm::ELF::EM_PPC64, 
ArchSpec::eCore_ppc64_generic,
  0xu, 0xu}, // PowerPC64
 {ArchSpec::eCore_arm_generic, llvm::ELF::EM_ARM, LLDB_INVALID_CPUTYPE,
  0xu, 0xu}, // ARM
Index: lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
===
--- lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
+++ lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
@@ -310,11 +310,21 @@
   }
 }
 
+static uint32_t ppc64VariantFromElfFlags(const elf::ELFHeader &header) {
+  uint32_t endian = header.e_ident[EI_DATA];
+  if(endian == ELFDATA2LSB)
+return ArchSpec::eCore_ppc64le_generic;
+  else
+return ArchSpec::eCore_ppc64_generic;
+}
+
 static uint32_t subTypeFromElfHeader(const elf::ELFHeader &header) {
   if (header.e_machine == llvm::ELF::EM_MIPS)
 return mipsVariantFromElfFlags(header);
   else if (header.e_machine == llvm::ELF::EM_RISCV)
 return riscvVariantFromElfFlags(header);
+  else if (header.e_machine == llvm::ELF::EM_PPC64)
+return ppc64VariantFromElfFlags(header);
 
   return LLDB_INVALID_CPUTYPE;
 }


Index: lldb/test/API/functionalities/postmortem/elf-core/TestLinuxCore.py
===
--- lldb/test/API/functionalities/postmortem/elf-core/TestLinuxCore.py
+++ lldb/test/API/functionalities/postmortem/elf-core/TestLinuxCore.py
@@ -24,12 +24,14 @@
 _i386_pid = 32306
 _x86_64_pid = 32259
 _s390x_pid = 1045
+_ppc64_pid = 28146
 _ppc64le_pid = 28147
 
 _aarch64_regions = 4
 _i386_regions = 4
 _x86_64_regions = 5
 _s390x_regions = 2
+_ppc64_regions = 2
 _ppc64le_regions = 2
 
 @skipIfLLVMTargetMissing("AArch64")
@@ -49,6 +51,12 @@
 self.do_test("linux-ppc64le", self._ppc64le_pid, self._ppc64le_regions,
  "linux-ppc64le.ou")
 
+@skipIfLLVMTargetMissing("PowerPC")
+def test_ppc64(self):
+"""Test that lldb can read the process information from an ppc64 linux core file."""
+self.do_test("linux-ppc64", self._ppc64_pid, self._ppc64_regions,
+ "linux-ppc64.ou")
+
 @skip

[Lldb-commits] [PATCH] D124760: [lldb] Fix ppc64 detection in lldb

2022-05-03 Thread serge via Phabricator via lldb-commits
serge-sans-paille updated this revision to Diff 426620.
serge-sans-paille added a comment.

Fix nits


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D124760/new/

https://reviews.llvm.org/D124760

Files:
  lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
  lldb/source/Utility/ArchSpec.cpp
  lldb/test/API/functionalities/postmortem/elf-core/TestLinuxCore.py
  lldb/test/API/functionalities/postmortem/elf-core/linux-ppc64.core
  lldb/test/API/functionalities/postmortem/elf-core/linux-ppc64.out


Index: lldb/test/API/functionalities/postmortem/elf-core/TestLinuxCore.py
===
--- lldb/test/API/functionalities/postmortem/elf-core/TestLinuxCore.py
+++ lldb/test/API/functionalities/postmortem/elf-core/TestLinuxCore.py
@@ -24,12 +24,14 @@
 _i386_pid = 32306
 _x86_64_pid = 32259
 _s390x_pid = 1045
+_ppc64_pid = 28146
 _ppc64le_pid = 28147
 
 _aarch64_regions = 4
 _i386_regions = 4
 _x86_64_regions = 5
 _s390x_regions = 2
+_ppc64_regions = 2
 _ppc64le_regions = 2
 
 @skipIfLLVMTargetMissing("AArch64")
@@ -49,6 +51,12 @@
 self.do_test("linux-ppc64le", self._ppc64le_pid, self._ppc64le_regions,
  "linux-ppc64le.ou")
 
+@skipIfLLVMTargetMissing("PowerPC")
+def test_ppc64(self):
+"""Test that lldb can read the process information from an ppc64 linux 
core file."""
+self.do_test("linux-ppc64", self._ppc64_pid, self._ppc64_regions,
+ "linux-ppc64.ou")
+
 @skipIfLLVMTargetMissing("X86")
 def test_x86_64(self):
 """Test that lldb can read the process information from an x86_64 
linux core file."""
Index: lldb/source/Utility/ArchSpec.cpp
===
--- lldb/source/Utility/ArchSpec.cpp
+++ lldb/source/Utility/ArchSpec.cpp
@@ -358,10 +358,10 @@
  0xu, 0xu}, // Intel MCU // FIXME: is this correct?
 {ArchSpec::eCore_ppc_generic, llvm::ELF::EM_PPC, LLDB_INVALID_CPUTYPE,
  0xu, 0xu}, // PowerPC
-{ArchSpec::eCore_ppc64le_generic, llvm::ELF::EM_PPC64, 
LLDB_INVALID_CPUTYPE,
- 0xu, 0xu}, // PowerPC64le
-{ArchSpec::eCore_ppc64_generic, llvm::ELF::EM_PPC64, LLDB_INVALID_CPUTYPE,
- 0xu, 0xu}, // PowerPC64
+{ArchSpec::eCore_ppc64le_generic, llvm::ELF::EM_PPC64,
+ ArchSpec::eCore_ppc64le_generic, 0xu, 0xu}, // PowerPC64le
+{ArchSpec::eCore_ppc64_generic, llvm::ELF::EM_PPC64,
+ ArchSpec::eCore_ppc64_generic, 0xu, 0xu}, // PowerPC64
 {ArchSpec::eCore_arm_generic, llvm::ELF::EM_ARM, LLDB_INVALID_CPUTYPE,
  0xu, 0xu}, // ARM
 {ArchSpec::eCore_arm_aarch64, llvm::ELF::EM_AARCH64, LLDB_INVALID_CPUTYPE,
@@ -400,8 +400,8 @@
  LLDB_INVALID_CPUTYPE, 0xu, 0xu}, // HEXAGON
 {ArchSpec::eCore_arc, llvm::ELF::EM_ARC_COMPACT2, LLDB_INVALID_CPUTYPE,
  0xu, 0xu}, // ARC
-{ArchSpec::eCore_avr, llvm::ELF::EM_AVR, LLDB_INVALID_CPUTYPE,
- 0xu, 0xu}, // AVR
+{ArchSpec::eCore_avr, llvm::ELF::EM_AVR, LLDB_INVALID_CPUTYPE, 0xu,
+ 0xu}, // AVR
 {ArchSpec::eCore_riscv32, llvm::ELF::EM_RISCV,
  ArchSpec::eRISCVSubType_riscv32, 0xu, 0xu}, // riscv32
 {ArchSpec::eCore_riscv64, llvm::ELF::EM_RISCV,
Index: lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
===
--- lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
+++ lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
@@ -310,9 +310,19 @@
   }
 }
 
+static uint32_t ppc64VariantFromElfFlags(const elf::ELFHeader &header) {
+  uint32_t endian = header.e_ident[EI_DATA];
+  if (endian == ELFDATA2LSB)
+return ArchSpec::eCore_ppc64le_generic;
+  else
+return ArchSpec::eCore_ppc64_generic;
+}
+
 static uint32_t subTypeFromElfHeader(const elf::ELFHeader &header) {
   if (header.e_machine == llvm::ELF::EM_MIPS)
 return mipsVariantFromElfFlags(header);
+  else if (header.e_machine == llvm::ELF::EM_PPC64)
+return ppc64VariantFromElfFlags(header);
   else if (header.e_machine == llvm::ELF::EM_RISCV)
 return riscvVariantFromElfFlags(header);
 


Index: lldb/test/API/functionalities/postmortem/elf-core/TestLinuxCore.py
===
--- lldb/test/API/functionalities/postmortem/elf-core/TestLinuxCore.py
+++ lldb/test/API/functionalities/postmortem/elf-core/TestLinuxCore.py
@@ -24,12 +24,14 @@
 _i386_pid = 32306
 _x86_64_pid = 32259
 _s390x_pid = 1045
+_ppc64_pid = 28146
 _ppc64le_pid = 28147
 
 _aarch64_regions = 4
 _i386_regions = 4
 _x86_64_regions = 5
 _s390x_regions = 2
+_ppc64_regions = 2
 _ppc64le_regions = 2
 
 @skipIfLLVMTargetMissing("AArch64")
@@ -49,6 +51,12 @@
 self.do_test("linux-ppc64le

[Lldb-commits] [PATCH] D124760: [lldb] Fix ppc64 detection in lldb

2022-05-03 Thread serge via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGf114f0094868: [lldb] Fix ppc64 detection in lldb (authored 
by serge-sans-paille).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D124760/new/

https://reviews.llvm.org/D124760

Files:
  lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
  lldb/source/Utility/ArchSpec.cpp
  lldb/test/API/functionalities/postmortem/elf-core/TestLinuxCore.py
  lldb/test/API/functionalities/postmortem/elf-core/linux-ppc64.core
  lldb/test/API/functionalities/postmortem/elf-core/linux-ppc64.out


Index: lldb/test/API/functionalities/postmortem/elf-core/TestLinuxCore.py
===
--- lldb/test/API/functionalities/postmortem/elf-core/TestLinuxCore.py
+++ lldb/test/API/functionalities/postmortem/elf-core/TestLinuxCore.py
@@ -24,12 +24,14 @@
 _i386_pid = 32306
 _x86_64_pid = 32259
 _s390x_pid = 1045
+_ppc64_pid = 28146
 _ppc64le_pid = 28147
 
 _aarch64_regions = 4
 _i386_regions = 4
 _x86_64_regions = 5
 _s390x_regions = 2
+_ppc64_regions = 2
 _ppc64le_regions = 2
 
 @skipIfLLVMTargetMissing("AArch64")
@@ -49,6 +51,12 @@
 self.do_test("linux-ppc64le", self._ppc64le_pid, self._ppc64le_regions,
  "linux-ppc64le.ou")
 
+@skipIfLLVMTargetMissing("PowerPC")
+def test_ppc64(self):
+"""Test that lldb can read the process information from an ppc64 linux 
core file."""
+self.do_test("linux-ppc64", self._ppc64_pid, self._ppc64_regions,
+ "linux-ppc64.ou")
+
 @skipIfLLVMTargetMissing("X86")
 def test_x86_64(self):
 """Test that lldb can read the process information from an x86_64 
linux core file."""
Index: lldb/source/Utility/ArchSpec.cpp
===
--- lldb/source/Utility/ArchSpec.cpp
+++ lldb/source/Utility/ArchSpec.cpp
@@ -358,10 +358,10 @@
  0xu, 0xu}, // Intel MCU // FIXME: is this correct?
 {ArchSpec::eCore_ppc_generic, llvm::ELF::EM_PPC, LLDB_INVALID_CPUTYPE,
  0xu, 0xu}, // PowerPC
-{ArchSpec::eCore_ppc64le_generic, llvm::ELF::EM_PPC64, 
LLDB_INVALID_CPUTYPE,
- 0xu, 0xu}, // PowerPC64le
-{ArchSpec::eCore_ppc64_generic, llvm::ELF::EM_PPC64, LLDB_INVALID_CPUTYPE,
- 0xu, 0xu}, // PowerPC64
+{ArchSpec::eCore_ppc64le_generic, llvm::ELF::EM_PPC64,
+ ArchSpec::eCore_ppc64le_generic, 0xu, 0xu}, // PowerPC64le
+{ArchSpec::eCore_ppc64_generic, llvm::ELF::EM_PPC64,
+ ArchSpec::eCore_ppc64_generic, 0xu, 0xu}, // PowerPC64
 {ArchSpec::eCore_arm_generic, llvm::ELF::EM_ARM, LLDB_INVALID_CPUTYPE,
  0xu, 0xu}, // ARM
 {ArchSpec::eCore_arm_aarch64, llvm::ELF::EM_AARCH64, LLDB_INVALID_CPUTYPE,
@@ -400,8 +400,8 @@
  LLDB_INVALID_CPUTYPE, 0xu, 0xu}, // HEXAGON
 {ArchSpec::eCore_arc, llvm::ELF::EM_ARC_COMPACT2, LLDB_INVALID_CPUTYPE,
  0xu, 0xu}, // ARC
-{ArchSpec::eCore_avr, llvm::ELF::EM_AVR, LLDB_INVALID_CPUTYPE,
- 0xu, 0xu}, // AVR
+{ArchSpec::eCore_avr, llvm::ELF::EM_AVR, LLDB_INVALID_CPUTYPE, 0xu,
+ 0xu}, // AVR
 {ArchSpec::eCore_riscv32, llvm::ELF::EM_RISCV,
  ArchSpec::eRISCVSubType_riscv32, 0xu, 0xu}, // riscv32
 {ArchSpec::eCore_riscv64, llvm::ELF::EM_RISCV,
Index: lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
===
--- lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
+++ lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
@@ -310,9 +310,19 @@
   }
 }
 
+static uint32_t ppc64VariantFromElfFlags(const elf::ELFHeader &header) {
+  uint32_t endian = header.e_ident[EI_DATA];
+  if (endian == ELFDATA2LSB)
+return ArchSpec::eCore_ppc64le_generic;
+  else
+return ArchSpec::eCore_ppc64_generic;
+}
+
 static uint32_t subTypeFromElfHeader(const elf::ELFHeader &header) {
   if (header.e_machine == llvm::ELF::EM_MIPS)
 return mipsVariantFromElfFlags(header);
+  else if (header.e_machine == llvm::ELF::EM_PPC64)
+return ppc64VariantFromElfFlags(header);
   else if (header.e_machine == llvm::ELF::EM_RISCV)
 return riscvVariantFromElfFlags(header);
 


Index: lldb/test/API/functionalities/postmortem/elf-core/TestLinuxCore.py
===
--- lldb/test/API/functionalities/postmortem/elf-core/TestLinuxCore.py
+++ lldb/test/API/functionalities/postmortem/elf-core/TestLinuxCore.py
@@ -24,12 +24,14 @@
 _i386_pid = 32306
 _x86_64_pid = 32259
 _s390x_pid = 1045
+_ppc64_pid = 28146
 _ppc64le_pid = 28147
 
 _aarch64_regions = 4
 _i386_regions = 4
 _x86_64_regions = 5
 _s390x_regions = 2
+_ppc64_regions = 2
 _ppc64

[Lldb-commits] [PATCH] D124760: [lldb] Fix ppc64 detection in lldb

2022-05-04 Thread serge via Phabricator via lldb-commits
serge-sans-paille added a comment.



In D124760#3488289 , @DavidSpickett 
wrote:

> I reverted this due to an assert: 
> https://lab.llvm.org/buildbot/#/builders/96/builds/22715/steps/6/logs/stdio 
> (set cmake `LLVM_ENABLE_ASSERTIONS` to `ON`)
>
> I think you could just add PowerPC to the `if (!reg_interface` there but 
> first time looking at the code I'm not sure of the consequences of that.

Thanks @DavidSpickett for the revert. I think we need to implement 
RegisterInfoPOSIX_ppc64 for Linux... I'll investiagte that.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D124760/new/

https://reviews.llvm.org/D124760

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D124760: [lldb] Fix ppc64 detection in lldb

2022-05-04 Thread serge via Phabricator via lldb-commits
serge-sans-paille updated this revision to Diff 427119.
serge-sans-paille added a comment.

Change the rest case to something that doesn't require me to implement ppc64be 
corefile support.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D124760/new/

https://reviews.llvm.org/D124760

Files:
  lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
  lldb/source/Utility/ArchSpec.cpp
  lldb/test/Shell/Breakpoint/Inputs/ppc64le-localentry.s
  lldb/test/Shell/Breakpoint/ppc64-localentry.test
  lldb/test/Shell/Breakpoint/ppc64le-localentry.test

Index: lldb/test/Shell/Breakpoint/ppc64le-localentry.test
===
--- /dev/null
+++ lldb/test/Shell/Breakpoint/ppc64le-localentry.test
@@ -0,0 +1,12 @@
+# REQUIRES: powerpc
+#
+# RUN: llvm-mc -triple=powerpc64le -filetype=obj %p/Inputs/ppc64le-localentry.s -o %t
+# RUN: lldb-test breakpoints %t %s | FileCheck %s
+
+breakpoint set -n lfunc
+# CHECK-LABEL: breakpoint set -n lfunc
+# CHECK: Address: {{.*}}`lfunc + 8
+
+breakpoint set -n simple
+# CHECK-LABEL: breakpoint set -n simple
+# CHECK: Address: {{.*}}`simple
Index: lldb/test/Shell/Breakpoint/ppc64-localentry.test
===
--- lldb/test/Shell/Breakpoint/ppc64-localentry.test
+++ lldb/test/Shell/Breakpoint/ppc64-localentry.test
@@ -1,6 +1,6 @@
 # REQUIRES: powerpc
 #
-# RUN: llvm-mc -triple=powerpc64le -filetype=obj %p/Inputs/ppc64-localentry.s -o %t
+# RUN: llvm-mc -triple=powerpc64 -filetype=obj %p/Inputs/ppc64-localentry.s -o %t
 # RUN: lldb-test breakpoints %t %s | FileCheck %s
 
 breakpoint set -n lfunc
Index: lldb/test/Shell/Breakpoint/Inputs/ppc64le-localentry.s
===
--- /dev/null
+++ lldb/test/Shell/Breakpoint/Inputs/ppc64le-localentry.s
@@ -0,0 +1,55 @@
+	.text
+	.abiversion 2
+
+	.globl	lfunc
+	.p2align	4
+	.type	lfunc,@function
+lfunc:  # @lfunc
+.Lfunc_begin0:
+.Lfunc_gep0:
+	addis 2, 12, .TOC.-.Lfunc_gep0@ha
+	addi 2, 2, .TOC.-.Lfunc_gep0@l
+.Lfunc_lep0:
+	.localentry	lfunc, .Lfunc_lep0-.Lfunc_gep0
+# BB#0:
+	mr 4, 3
+	addis 3, 2, .LC0@toc@ha
+	ld 3, .LC0@toc@l(3)
+	stw 4, -12(1)
+	lwz 4, 0(3)
+	lwz 5, -12(1)
+	mullw 4, 4, 5
+	extsw 3, 4
+	blr
+	.long	0
+	.quad	0
+.Lfunc_end0:
+	.size	lfunc, .Lfunc_end0-.Lfunc_begin0
+
+	.globl	simple
+	.p2align	4
+	.type	simple,@function
+simple: # @simple
+.Lfunc_begin1:
+# %bb.0:# %entry
+	mr 4, 3
+	stw 4, -12(1)
+	lwz 4, -12(1)
+	mulli 4, 4, 10
+	extsw 3, 4
+	blr
+	.long	0
+	.quad	0
+.Lfunc_end1:
+	.size	simple, .Lfunc_end1-.Lfunc_begin1
+
+	.section	.toc,"aw",@progbits
+.LC0:
+	.tc g_foo[TC],g_foo
+	.type	g_foo,@object   # @g_foo
+	.data
+	.globl	g_foo
+	.p2align	2
+g_foo:
+	.long	2   # 0x2
+	.size	g_foo, 4
Index: lldb/source/Utility/ArchSpec.cpp
===
--- lldb/source/Utility/ArchSpec.cpp
+++ lldb/source/Utility/ArchSpec.cpp
@@ -358,10 +358,10 @@
  0xu, 0xu}, // Intel MCU // FIXME: is this correct?
 {ArchSpec::eCore_ppc_generic, llvm::ELF::EM_PPC, LLDB_INVALID_CPUTYPE,
  0xu, 0xu}, // PowerPC
-{ArchSpec::eCore_ppc64le_generic, llvm::ELF::EM_PPC64, LLDB_INVALID_CPUTYPE,
- 0xu, 0xu}, // PowerPC64le
-{ArchSpec::eCore_ppc64_generic, llvm::ELF::EM_PPC64, LLDB_INVALID_CPUTYPE,
- 0xu, 0xu}, // PowerPC64
+{ArchSpec::eCore_ppc64le_generic, llvm::ELF::EM_PPC64,
+ ArchSpec::eCore_ppc64le_generic, 0xu, 0xu}, // PowerPC64le
+{ArchSpec::eCore_ppc64_generic, llvm::ELF::EM_PPC64,
+ ArchSpec::eCore_ppc64_generic, 0xu, 0xu}, // PowerPC64
 {ArchSpec::eCore_arm_generic, llvm::ELF::EM_ARM, LLDB_INVALID_CPUTYPE,
  0xu, 0xu}, // ARM
 {ArchSpec::eCore_arm_aarch64, llvm::ELF::EM_AARCH64, LLDB_INVALID_CPUTYPE,
@@ -400,8 +400,8 @@
  LLDB_INVALID_CPUTYPE, 0xu, 0xu}, // HEXAGON
 {ArchSpec::eCore_arc, llvm::ELF::EM_ARC_COMPACT2, LLDB_INVALID_CPUTYPE,
  0xu, 0xu}, // ARC
-{ArchSpec::eCore_avr, llvm::ELF::EM_AVR, LLDB_INVALID_CPUTYPE,
- 0xu, 0xu}, // AVR
+{ArchSpec::eCore_avr, llvm::ELF::EM_AVR, LLDB_INVALID_CPUTYPE, 0xu,
+ 0xu}, // AVR
 {ArchSpec::eCore_riscv32, llvm::ELF::EM_RISCV,
  ArchSpec::eRISCVSubType_riscv32, 0xu, 0xu}, // riscv32
 {ArchSpec::eCore_riscv64, llvm::ELF::EM_RISCV,
Index: lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
===
--- lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
+++ lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
@@ -310,9 +310,19 @@
   }
 }
 
+static uint32_t ppc64VariantFromElfFlags(const elf::ELFHeader &header) {
+  uint32_t endian = h

[Lldb-commits] [PATCH] D124760: [lldb] Fix ppc64 detection in lldb

2022-05-04 Thread serge via Phabricator via lldb-commits
serge-sans-paille reopened this revision.
serge-sans-paille added a comment.
This revision is now accepted and ready to land.

@labath does that version look good? I only changed the test.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D124760/new/

https://reviews.llvm.org/D124760

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D124760: [lldb] Fix ppc64 detection in lldb

2022-05-05 Thread serge via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGf416e57339bd: [lldb] Fix ppc64 detection in lldb (authored 
by serge-sans-paille).

Changed prior to commit:
  https://reviews.llvm.org/D124760?vs=427119&id=427225#toc

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D124760/new/

https://reviews.llvm.org/D124760

Files:
  lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
  lldb/source/Utility/ArchSpec.cpp
  lldb/test/Shell/Breakpoint/Inputs/ppc64le-localentry.s
  lldb/test/Shell/Breakpoint/ppc64-localentry.test
  lldb/test/Shell/Breakpoint/ppc64le-localentry.test

Index: lldb/test/Shell/Breakpoint/ppc64le-localentry.test
===
--- lldb/test/Shell/Breakpoint/ppc64le-localentry.test
+++ lldb/test/Shell/Breakpoint/ppc64le-localentry.test
@@ -1,6 +1,6 @@
 # REQUIRES: powerpc
 #
-# RUN: llvm-mc -triple=powerpc64le -filetype=obj %p/Inputs/ppc64-localentry.s -o %t
+# RUN: llvm-mc -triple=powerpc64le -filetype=obj %p/Inputs/ppc64le-localentry.s -o %t
 # RUN: lldb-test breakpoints %t %s | FileCheck %s
 
 breakpoint set -n lfunc
Index: lldb/test/Shell/Breakpoint/ppc64-localentry.test
===
--- lldb/test/Shell/Breakpoint/ppc64-localentry.test
+++ lldb/test/Shell/Breakpoint/ppc64-localentry.test
@@ -1,6 +1,6 @@
 # REQUIRES: powerpc
 #
-# RUN: llvm-mc -triple=powerpc64le -filetype=obj %p/Inputs/ppc64-localentry.s -o %t
+# RUN: llvm-mc -triple=powerpc64 -filetype=obj %p/Inputs/ppc64-localentry.s -o %t
 # RUN: lldb-test breakpoints %t %s | FileCheck %s
 
 breakpoint set -n lfunc
Index: lldb/test/Shell/Breakpoint/Inputs/ppc64le-localentry.s
===
--- /dev/null
+++ lldb/test/Shell/Breakpoint/Inputs/ppc64le-localentry.s
@@ -0,0 +1,55 @@
+	.text
+	.abiversion 2
+
+	.globl	lfunc
+	.p2align	4
+	.type	lfunc,@function
+lfunc:  # @lfunc
+.Lfunc_begin0:
+.Lfunc_gep0:
+	addis 2, 12, .TOC.-.Lfunc_gep0@ha
+	addi 2, 2, .TOC.-.Lfunc_gep0@l
+.Lfunc_lep0:
+	.localentry	lfunc, .Lfunc_lep0-.Lfunc_gep0
+# BB#0:
+	mr 4, 3
+	addis 3, 2, .LC0@toc@ha
+	ld 3, .LC0@toc@l(3)
+	stw 4, -12(1)
+	lwz 4, 0(3)
+	lwz 5, -12(1)
+	mullw 4, 4, 5
+	extsw 3, 4
+	blr
+	.long	0
+	.quad	0
+.Lfunc_end0:
+	.size	lfunc, .Lfunc_end0-.Lfunc_begin0
+
+	.globl	simple
+	.p2align	4
+	.type	simple,@function
+simple: # @simple
+.Lfunc_begin1:
+# %bb.0:# %entry
+	mr 4, 3
+	stw 4, -12(1)
+	lwz 4, -12(1)
+	mulli 4, 4, 10
+	extsw 3, 4
+	blr
+	.long	0
+	.quad	0
+.Lfunc_end1:
+	.size	simple, .Lfunc_end1-.Lfunc_begin1
+
+	.section	.toc,"aw",@progbits
+.LC0:
+	.tc g_foo[TC],g_foo
+	.type	g_foo,@object   # @g_foo
+	.data
+	.globl	g_foo
+	.p2align	2
+g_foo:
+	.long	2   # 0x2
+	.size	g_foo, 4
Index: lldb/source/Utility/ArchSpec.cpp
===
--- lldb/source/Utility/ArchSpec.cpp
+++ lldb/source/Utility/ArchSpec.cpp
@@ -358,10 +358,10 @@
  0xu, 0xu}, // Intel MCU // FIXME: is this correct?
 {ArchSpec::eCore_ppc_generic, llvm::ELF::EM_PPC, LLDB_INVALID_CPUTYPE,
  0xu, 0xu}, // PowerPC
-{ArchSpec::eCore_ppc64le_generic, llvm::ELF::EM_PPC64, LLDB_INVALID_CPUTYPE,
- 0xu, 0xu}, // PowerPC64le
-{ArchSpec::eCore_ppc64_generic, llvm::ELF::EM_PPC64, LLDB_INVALID_CPUTYPE,
- 0xu, 0xu}, // PowerPC64
+{ArchSpec::eCore_ppc64le_generic, llvm::ELF::EM_PPC64,
+ ArchSpec::eCore_ppc64le_generic, 0xu, 0xu}, // PowerPC64le
+{ArchSpec::eCore_ppc64_generic, llvm::ELF::EM_PPC64,
+ ArchSpec::eCore_ppc64_generic, 0xu, 0xu}, // PowerPC64
 {ArchSpec::eCore_arm_generic, llvm::ELF::EM_ARM, LLDB_INVALID_CPUTYPE,
  0xu, 0xu}, // ARM
 {ArchSpec::eCore_arm_aarch64, llvm::ELF::EM_AARCH64, LLDB_INVALID_CPUTYPE,
@@ -400,8 +400,8 @@
  LLDB_INVALID_CPUTYPE, 0xu, 0xu}, // HEXAGON
 {ArchSpec::eCore_arc, llvm::ELF::EM_ARC_COMPACT2, LLDB_INVALID_CPUTYPE,
  0xu, 0xu}, // ARC
-{ArchSpec::eCore_avr, llvm::ELF::EM_AVR, LLDB_INVALID_CPUTYPE,
- 0xu, 0xu}, // AVR
+{ArchSpec::eCore_avr, llvm::ELF::EM_AVR, LLDB_INVALID_CPUTYPE, 0xu,
+ 0xu}, // AVR
 {ArchSpec::eCore_riscv32, llvm::ELF::EM_RISCV,
  ArchSpec::eRISCVSubType_riscv32, 0xu, 0xu}, // riscv32
 {ArchSpec::eCore_riscv64, llvm::ELF::EM_RISCV,
Index: lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
===
--- lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
+++ lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
@@ -310,9 +310,19 @@
   }
 }
 
+static uint32_t ppc64VariantFromElfFlag

[Lldb-commits] [PATCH] D137337: Replace LLVM_LIBDIR_SUFFIX by CMAKE_INSTALL_LIBDIR

2022-12-07 Thread serge via Phabricator via lldb-commits
serge-sans-paille created this revision.
serge-sans-paille added reviewers: MaskRay, tstellar, mgorny, sylvestre.ledru.
Herald added subscribers: libc-commits, libcxx-commits, Moerafaat, zero9178, 
Enna1, bzcheeseman, kosarev, ayermolo, sdasgup3, wenzhicui, wrengr, cota, 
StephenFan, teijeong, rdzhabarov, tatianashp, msifontes, jurahul, Kayjukh, 
grosul1, Joonsoo, kerbowa, liufengdb, aartbik, mgester, arpith-jacob, csigg, 
antiagainst, shauheen, rriddle, mehdi_amini, whisperity, jvesely.
Herald added a reviewer: bollu.
Herald added a reviewer: sscalpone.
Herald added a reviewer: rafauler.
Herald added a reviewer: Amir.
Herald added a reviewer: maksfb.
Herald added a reviewer: NoQ.
Herald added projects: libunwind, libc-project, Flang, All.
Herald added a reviewer: libunwind.
serge-sans-paille requested review of this revision.
Herald added a reviewer: jdoerfert.
Herald added subscribers: llvm-commits, openmp-commits, lldb-commits, 
Sanitizers, cfe-commits, yota9, sstefan1, stephenneuendorffer, 
nicolasvasilache, jdoerfert.
Herald added projects: clang, Sanitizers, LLDB, libc++, OpenMP, libc++abi, 
MLIR, LLVM.
Herald added a reviewer: libc++.
Herald added a reviewer: libc++abi.

There are a few advantages of using CMAKE_INSTALL_LIBDIR in place of
LLVM_LIBDIR_SUFFIX:

1. it's a standard flag, no need to support an extra cmake configuration
2. it has sane defaults, and picks lib64 instead of lib on some syssyems 
(including Fedora)


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D137337

Files:
  bolt/CMakeLists.txt
  bolt/include/bolt/RuntimeLibs/RuntimeLibraryVariables.inc.in
  bolt/lib/RuntimeLibs/RuntimeLibrary.cpp
  bolt/runtime/CMakeLists.txt
  clang/CMakeLists.txt
  clang/cmake/caches/Android-stage2.cmake
  clang/cmake/caches/Android.cmake
  clang/cmake/modules/AddClang.cmake
  clang/cmake/modules/CMakeLists.txt
  clang/include/clang/Config/config.h.cmake
  clang/lib/Driver/Driver.cpp
  clang/lib/Driver/ToolChains/CommonArgs.cpp
  clang/lib/Headers/CMakeLists.txt
  clang/runtime/CMakeLists.txt
  clang/tools/libclang/CMakeLists.txt
  clang/tools/scan-build-py/CMakeLists.txt
  cmake/Modules/GNUInstallPackageDir.cmake
  compiler-rt/cmake/Modules/CompilerRTAIXUtils.cmake
  compiler-rt/cmake/Modules/CompilerRTUtils.cmake
  compiler-rt/cmake/base-config-ix.cmake
  compiler-rt/docs/BuildingCompilerRT.rst
  flang/CMakeLists.txt
  flang/cmake/modules/AddFlang.cmake
  flang/cmake/modules/CMakeLists.txt
  libc/lib/CMakeLists.txt
  libcxx/CMakeLists.txt
  libcxx/docs/BuildingLibcxx.rst
  libcxxabi/CMakeLists.txt
  libunwind/CMakeLists.txt
  libunwind/docs/BuildingLibunwind.rst
  lld/CMakeLists.txt
  lld/cmake/modules/AddLLD.cmake
  lld/cmake/modules/CMakeLists.txt
  lldb/cmake/modules/AddLLDB.cmake
  lldb/cmake/modules/LLDBGenerateConfig.cmake
  lldb/cmake/modules/LLDBStandalone.cmake
  lldb/source/API/CMakeLists.txt
  lldb/test/CMakeLists.txt
  lldb/tools/intel-features/CMakeLists.txt
  lldb/utils/lldb-dotest/CMakeLists.txt
  llvm/CMakeLists.txt
  llvm/cmake/modules/AddLLVM.cmake
  llvm/cmake/modules/AddOCaml.cmake
  llvm/cmake/modules/CMakeLists.txt
  llvm/cmake/modules/LLVMConfig.cmake.in
  llvm/docs/CMake.rst
  llvm/tools/llvm-config/BuildVariables.inc.in
  llvm/tools/llvm-config/llvm-config.cpp
  llvm/utils/gn/secondary/llvm/tools/llvm-config/BUILD.gn
  mlir/CMakeLists.txt
  mlir/cmake/modules/AddMLIR.cmake
  mlir/cmake/modules/AddMLIRPython.cmake
  mlir/cmake/modules/CMakeLists.txt
  mlir/test/CMakeLists.txt
  openmp/CMakeLists.txt
  openmp/README.rst
  openmp/libompd/src/CMakeLists.txt
  openmp/libomptarget/DeviceRTL/CMakeLists.txt
  openmp/libomptarget/plugins-nextgen/CMakeLists.txt
  openmp/libomptarget/plugins-nextgen/cuda/CMakeLists.txt
  openmp/libomptarget/plugins/CMakeLists.txt
  openmp/libomptarget/plugins/amdgpu/CMakeLists.txt
  openmp/libomptarget/plugins/cuda/CMakeLists.txt
  openmp/libomptarget/plugins/remote/src/CMakeLists.txt
  openmp/libomptarget/plugins/ve/CMakeLists.txt
  openmp/libomptarget/src/CMakeLists.txt
  openmp/runtime/src/CMakeLists.txt
  openmp/tools/Modules/CMakeLists.txt
  openmp/tools/archer/CMakeLists.txt
  polly/cmake/CMakeLists.txt
  polly/cmake/polly_macros.cmake

Index: polly/cmake/polly_macros.cmake
===
--- polly/cmake/polly_macros.cmake
+++ polly/cmake/polly_macros.cmake
@@ -44,8 +44,8 @@
   if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY OR ${name} STREQUAL "LLVMPolly")
 install(TARGETS ${name}
   EXPORT LLVMExports
-  LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX}
-  ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX})
+  LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+  ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
   endif()
   set_property(GLOBAL APPEND PROPERTY LLVM_EXPORTS ${name})
 endmacro(add_polly_library)
Index: polly/cmake/CMakeLists.txt
===
--- polly/cmake/CMakeLists.txt
+++ polly/cmake/CMakeLists.txt
@@ -7,7 +7,7 

[Lldb-commits] [PATCH] D137337: Replace LLVM_LIBDIR_SUFFIX by CMAKE_INSTALL_LIBDIR

2022-12-07 Thread serge via Phabricator via lldb-commits
serge-sans-paille updated this revision to Diff 472945.
serge-sans-paille added a comment.

+ Release Note


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D137337/new/

https://reviews.llvm.org/D137337

Files:
  bolt/CMakeLists.txt
  bolt/include/bolt/RuntimeLibs/RuntimeLibraryVariables.inc.in
  bolt/lib/RuntimeLibs/RuntimeLibrary.cpp
  bolt/runtime/CMakeLists.txt
  clang/CMakeLists.txt
  clang/cmake/caches/Android-stage2.cmake
  clang/cmake/caches/Android.cmake
  clang/cmake/modules/AddClang.cmake
  clang/cmake/modules/CMakeLists.txt
  clang/include/clang/Config/config.h.cmake
  clang/lib/Driver/Driver.cpp
  clang/lib/Driver/ToolChains/CommonArgs.cpp
  clang/lib/Headers/CMakeLists.txt
  clang/runtime/CMakeLists.txt
  clang/tools/libclang/CMakeLists.txt
  clang/tools/scan-build-py/CMakeLists.txt
  cmake/Modules/GNUInstallPackageDir.cmake
  compiler-rt/cmake/Modules/CompilerRTAIXUtils.cmake
  compiler-rt/cmake/Modules/CompilerRTUtils.cmake
  compiler-rt/cmake/base-config-ix.cmake
  compiler-rt/docs/BuildingCompilerRT.rst
  flang/CMakeLists.txt
  flang/cmake/modules/AddFlang.cmake
  flang/cmake/modules/CMakeLists.txt
  libc/lib/CMakeLists.txt
  libcxx/CMakeLists.txt
  libcxx/docs/BuildingLibcxx.rst
  libcxxabi/CMakeLists.txt
  libunwind/CMakeLists.txt
  libunwind/docs/BuildingLibunwind.rst
  lld/CMakeLists.txt
  lld/cmake/modules/AddLLD.cmake
  lld/cmake/modules/CMakeLists.txt
  lldb/cmake/modules/AddLLDB.cmake
  lldb/cmake/modules/LLDBGenerateConfig.cmake
  lldb/cmake/modules/LLDBStandalone.cmake
  lldb/source/API/CMakeLists.txt
  lldb/test/CMakeLists.txt
  lldb/tools/intel-features/CMakeLists.txt
  lldb/utils/lldb-dotest/CMakeLists.txt
  llvm/CMakeLists.txt
  llvm/cmake/modules/AddLLVM.cmake
  llvm/cmake/modules/AddOCaml.cmake
  llvm/cmake/modules/CMakeLists.txt
  llvm/cmake/modules/LLVMConfig.cmake.in
  llvm/docs/CMake.rst
  llvm/docs/ReleaseNotes.rst
  llvm/tools/llvm-config/BuildVariables.inc.in
  llvm/tools/llvm-config/llvm-config.cpp
  llvm/utils/gn/secondary/llvm/tools/llvm-config/BUILD.gn
  mlir/CMakeLists.txt
  mlir/cmake/modules/AddMLIR.cmake
  mlir/cmake/modules/AddMLIRPython.cmake
  mlir/cmake/modules/CMakeLists.txt
  mlir/test/CMakeLists.txt
  openmp/CMakeLists.txt
  openmp/README.rst
  openmp/libompd/src/CMakeLists.txt
  openmp/libomptarget/DeviceRTL/CMakeLists.txt
  openmp/libomptarget/plugins-nextgen/CMakeLists.txt
  openmp/libomptarget/plugins-nextgen/cuda/CMakeLists.txt
  openmp/libomptarget/plugins/CMakeLists.txt
  openmp/libomptarget/plugins/amdgpu/CMakeLists.txt
  openmp/libomptarget/plugins/cuda/CMakeLists.txt
  openmp/libomptarget/plugins/remote/src/CMakeLists.txt
  openmp/libomptarget/plugins/ve/CMakeLists.txt
  openmp/libomptarget/src/CMakeLists.txt
  openmp/runtime/src/CMakeLists.txt
  openmp/tools/Modules/CMakeLists.txt
  openmp/tools/archer/CMakeLists.txt
  polly/cmake/CMakeLists.txt
  polly/cmake/polly_macros.cmake

Index: polly/cmake/polly_macros.cmake
===
--- polly/cmake/polly_macros.cmake
+++ polly/cmake/polly_macros.cmake
@@ -44,8 +44,8 @@
   if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY OR ${name} STREQUAL "LLVMPolly")
 install(TARGETS ${name}
   EXPORT LLVMExports
-  LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX}
-  ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX})
+  LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+  ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
   endif()
   set_property(GLOBAL APPEND PROPERTY LLVM_EXPORTS ${name})
 endmacro(add_polly_library)
Index: polly/cmake/CMakeLists.txt
===
--- polly/cmake/CMakeLists.txt
+++ polly/cmake/CMakeLists.txt
@@ -7,7 +7,7 @@
 set(POLLY_INSTALL_PACKAGE_DIR "${CMAKE_INSTALL_PACKAGEDIR}/polly" CACHE STRING
   "Path for CMake subdirectory for Polly (defaults to '${CMAKE_INSTALL_PACKAGEDIR}/polly')")
 # CMAKE_INSTALL_PACKAGEDIR might be absolute, so don't reuse below.
-set(polly_cmake_builddir "${POLLY_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/cmake/polly")
+set(polly_cmake_builddir "${POLLY_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}/cmake/polly")
 
 set(LLVM_INSTALL_PACKAGE_DIR "${CMAKE_INSTALL_PACKAGEDIR}/llvm" CACHE STRING
   "Path for CMake subdirectory for LLVM (defaults to '${CMAKE_INSTALL_PACKAGEDIR}/llvm')")
@@ -93,7 +93,7 @@
 find_prefix_from_config(POLLY_CONFIG_CODE POLLY_INSTALL_PREFIX "${POLLY_INSTALL_PACKAGE_DIR}")
 extend_path(POLLY_CONFIG_LLVM_CMAKE_DIR "\${POLLY_INSTALL_PREFIX}" "${LLVM_INSTALL_PACKAGE_DIR}")
 extend_path(POLLY_CONFIG_CMAKE_DIR "\${POLLY_INSTALL_PREFIX}" "${POLLY_INSTALL_PACKAGE_DIR}")
-extend_path(POLLY_CONFIG_LIBRARY_DIRS "\${POLLY_INSTALL_PREFIX}" "lib${LLVM_LIBDIR_SUFFIX}")
+extend_path(POLLY_CONFIG_LIBRARY_DIRS "\${POLLY_INSTALL_PREFIX}" "${CMAKE_INSTALL_LIBDIR}")
 extend_path(base_includedir "\${POLLY_INSTALL_PREFIX}" "${CMAKE_INSTALL_INCLUDEDIR}")
 if (POLLY_BUNDLED_ISL)
   set(POLLY_CONFIG_INCLUDE_DIRS
Index: openmp/tools/archer/CMakeLists.txt
===

[Lldb-commits] [PATCH] D137337: Replace LLVM_LIBDIR_SUFFIX by CMAKE_INSTALL_LIBDIR

2022-12-07 Thread serge via Phabricator via lldb-commits
serge-sans-paille added inline comments.



Comment at: bolt/lib/RuntimeLibs/RuntimeLibrary.cpp:32
   SmallString<128> LibPath = llvm::sys::path::parent_path(Dir);
-  llvm::sys::path::append(LibPath, "lib" LLVM_LIBDIR_SUFFIX);
+  llvm::sys::path::append(LibPath, CMAKE_INSTALL_LIBDIR);
   if (!llvm::sys::fs::exists(LibPath)) {

Ericson2314 wrote:
> mgorny wrote:
> > Well, one thing I immediately notice is that technically 
> > `CMAKE_INSTALL_LIBDIR` can be an absolute path, while in many locations you 
> > are assuming it will always be relative. Not saying that's a blocker but I 
> > think you should add checks for that into `CMakeLists.txt`.
> Yes I was working on this, and I intend to use `CMAKE_INSTALL_LIBDIR` with an 
> absolute path.
> 
> OK if this isn't supported initially but we should ovoid regressing where 
> possible.
Turns out LLVM_LIBDIR_SUFFIX is used in several situations: (a) for the library 
install dir or (b) for the location where build artifact as stored in 
CMAKE_BINARY_DIR. (a) could accept a path but not (b), unless we derive it from 
(a) but I can see a lot of complication there for the testing step. Would that 
be ok to choke on CMAKE_INSTALL_LIBDIR being a path and not a directory 
component?



CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D137337/new/

https://reviews.llvm.org/D137337

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D139881: [clang] Use a StringRef instead of a raw char pointer to store builtin and call information

2022-12-12 Thread serge via Phabricator via lldb-commits
serge-sans-paille created this revision.
serge-sans-paille added a reviewer: nikic.
Herald added subscribers: steakhal, pmatos, asb, jhenderson, abrachet, ormris, 
martong, phosek, kadircet, arphaman, steven_wu, hiraditya, arichardson, sbc100, 
emaste.
Herald added a reviewer: JDevlieghere.
Herald added a reviewer: alexander-shaposhnikov.
Herald added a reviewer: jhenderson.
Herald added a reviewer: MaskRay.
Herald added a reviewer: NoQ.
Herald added projects: lld-macho, All.
Herald added a reviewer: lld-macho.
serge-sans-paille requested review of this revision.
Herald added subscribers: cfe-commits, llvm-commits, lldb-commits, StephenFan, 
aheejin.
Herald added projects: clang, LLDB, LLVM, clang-tools-extra.

This avoids recomputing string lentgh that is already known at compile
time.

It has a slight impact on preprocessing / compile time, see

https://llvm-compile-time-tracker.com/compare.php?from=3f36d2d579d8b0e8824d9dd99bfa79f456858f88&to=e49640c507ddc6615b5e503144301c8e41f8f434&stat=instructions:u


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D139881

Files:
  clang-tools-extra/clangd/CompileCommands.cpp
  clang/include/clang/Basic/Builtins.h
  clang/include/clang/StaticAnalyzer/Core/PathSensitive/CallDescription.h
  clang/lib/AST/ExprConstant.cpp
  clang/lib/Basic/Builtins.cpp
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/lib/Driver/DriverOptions.cpp
  clang/lib/Sema/SemaChecking.cpp
  clang/lib/StaticAnalyzer/Checkers/BasicObjCFoundationChecks.cpp
  clang/lib/StaticAnalyzer/Checkers/BlockInCriticalSectionChecker.cpp
  clang/lib/StaticAnalyzer/Checkers/CStringChecker.cpp
  clang/lib/StaticAnalyzer/Checkers/ChrootChecker.cpp
  clang/lib/StaticAnalyzer/Checkers/ContainerModeling.cpp
  clang/lib/StaticAnalyzer/Checkers/DebugContainerModeling.cpp
  clang/lib/StaticAnalyzer/Checkers/DebugIteratorModeling.cpp
  clang/lib/StaticAnalyzer/Checkers/ErrnoModeling.cpp
  clang/lib/StaticAnalyzer/Checkers/ErrnoTesterChecker.cpp
  clang/lib/StaticAnalyzer/Checkers/GenericTaintChecker.cpp
  clang/lib/StaticAnalyzer/Checkers/MIGChecker.cpp
  clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp
  clang/lib/StaticAnalyzer/Checkers/MmapWriteExecChecker.cpp
  clang/lib/StaticAnalyzer/Checkers/PthreadLockChecker.cpp
  clang/lib/StaticAnalyzer/Checkers/SimpleStreamChecker.cpp
  clang/lib/StaticAnalyzer/Checkers/SmartPtrModeling.cpp
  clang/lib/StaticAnalyzer/Checkers/StreamChecker.cpp
  clang/lib/StaticAnalyzer/Checkers/ValistChecker.cpp
  clang/lib/StaticAnalyzer/Checkers/cert/InvalidPtrChecker.cpp
  clang/lib/StaticAnalyzer/Checkers/cert/PutenvWithAutoChecker.cpp
  clang/lib/StaticAnalyzer/Core/CallDescription.cpp
  clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp
  clang/unittests/StaticAnalyzer/BugReportInterestingnessTest.cpp
  clang/unittests/StaticAnalyzer/CallDescriptionTest.cpp
  clang/unittests/StaticAnalyzer/ConflictingEvalCallsTest.cpp
  clang/unittests/StaticAnalyzer/FalsePositiveRefutationBRVisitorTest.cpp
  clang/unittests/StaticAnalyzer/NoStateChangeFuncVisitorTest.cpp
  lld/COFF/DriverUtils.cpp
  lld/ELF/DriverUtils.cpp
  lld/MachO/DriverUtils.cpp
  lld/MinGW/Driver.cpp
  lld/wasm/Driver.cpp
  lldb/tools/driver/Driver.cpp
  lldb/tools/lldb-server/lldb-gdbserver.cpp
  lldb/tools/lldb-vscode/lldb-vscode.cpp
  llvm/include/llvm/ADT/ArrayRef.h
  llvm/include/llvm/Option/OptTable.h
  llvm/include/llvm/Option/Option.h
  llvm/lib/ExecutionEngine/JITLink/COFFDirectiveParser.cpp
  llvm/lib/Option/OptTable.cpp
  llvm/lib/Option/Option.cpp
  llvm/lib/ToolDrivers/llvm-dlltool/DlltoolDriver.cpp
  llvm/lib/ToolDrivers/llvm-lib/LibDriver.cpp
  llvm/tools/dsymutil/dsymutil.cpp
  llvm/tools/llvm-cvtres/llvm-cvtres.cpp
  llvm/tools/llvm-cxxfilt/llvm-cxxfilt.cpp
  llvm/tools/llvm-dwarfutil/llvm-dwarfutil.cpp
  llvm/tools/llvm-ifs/llvm-ifs.cpp
  llvm/tools/llvm-lipo/llvm-lipo.cpp
  llvm/tools/llvm-ml/llvm-ml.cpp
  llvm/tools/llvm-mt/llvm-mt.cpp
  llvm/tools/llvm-nm/llvm-nm.cpp
  llvm/tools/llvm-objcopy/ObjcopyOptions.cpp
  llvm/tools/llvm-objdump/llvm-objdump.cpp
  llvm/tools/llvm-rc/llvm-rc.cpp
  llvm/tools/llvm-readobj/llvm-readobj.cpp
  llvm/tools/llvm-size/llvm-size.cpp
  llvm/tools/llvm-strings/llvm-strings.cpp
  llvm/tools/llvm-symbolizer/llvm-symbolizer.cpp
  llvm/tools/llvm-tli-checker/llvm-tli-checker.cpp
  llvm/unittests/Option/OptionParsingTest.cpp
  llvm/utils/TableGen/OptParserEmitter.cpp

Index: llvm/utils/TableGen/OptParserEmitter.cpp
===
--- llvm/utils/TableGen/OptParserEmitter.cpp
+++ llvm/utils/TableGen/OptParserEmitter.cpp
@@ -251,8 +251,8 @@
 // Prefix values.
 OS << ", {";
 for (const auto &PrefixKey : Prefix.first)
-  OS << "\"" << PrefixKey << "\" COMMA ";
-OS << "nullptr})\n";
+  OS << "llvm::StringLiteral(\"" << PrefixKey << "\") COMMA ";
+OS << "llvm::StringLiteral(\"\")})\n";
   }
   OS << "#undef COMMA\n";
   OS << "#endif // PREFIX\n\n";
Index: llvm/unittests/Option/OptionParsingTest

[Lldb-commits] [PATCH] D139881: [clang] Use a StringRef instead of a raw char pointer to store builtin and call information

2022-12-13 Thread serge via Phabricator via lldb-commits
serge-sans-paille added inline comments.



Comment at: clang-tools-extra/clangd/CompileCommands.cpp:470
 const char *const *Prefixes[DriverID::LastOption] = {nullptr};
-#define PREFIX(NAME, VALUE) static const char *const NAME[] = VALUE;
+#define PREFIX(NAME, VALUE) static constexpr llvm::StringLiteral NAME[] = 
VALUE;
 #define OPTION(PREFIX, NAME, ID, KIND, GROUP, ALIAS, ALIASARGS, FLAGS, PARAM,  
\

kadircet wrote:
> this is actually an incorrect change (even builds shouldn't be succeeding). 
> as the values here can also be `nullptr` (which cannot be stored in a 
> StringLiteral) but moreover we later on assign these to `Prefixes` array, 
> which is of type `char*`, hence the conversion should also be failing.
> 
> but in general i'd actually expect people to be assigning "nullptr"s to these 
> `char*`s, hence if this was a purely mechanical migration without some extra 
> constraints, it might still blow up at runtime even if it succeeds compiles.
Builds (and test suite) all succeed (at least locally :-)). This patch also 
modifies tablegen to *not* generate `nullptr`, but empty string instead. The 
constructor of `OptTable::Info` has been modified to turn these "Empty string 
terminated array" into regular `ArrayRef`, which makes iteration code much more 
straight forward.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D139881/new/

https://reviews.llvm.org/D139881

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D139881: [clang] Use a StringRef instead of a raw char pointer to store builtin and call information

2022-12-14 Thread serge via Phabricator via lldb-commits
serge-sans-paille updated this revision to Diff 482825.
serge-sans-paille added a comment.

Make `Prefixes` an array of StringRef too


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D139881/new/

https://reviews.llvm.org/D139881

Files:
  clang-tools-extra/clangd/CompileCommands.cpp
  clang/include/clang/Basic/Builtins.h
  clang/include/clang/StaticAnalyzer/Core/PathSensitive/CallDescription.h
  clang/lib/AST/ExprConstant.cpp
  clang/lib/Basic/Builtins.cpp
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/lib/Driver/DriverOptions.cpp
  clang/lib/Sema/SemaChecking.cpp
  clang/lib/StaticAnalyzer/Checkers/BasicObjCFoundationChecks.cpp
  clang/lib/StaticAnalyzer/Checkers/BlockInCriticalSectionChecker.cpp
  clang/lib/StaticAnalyzer/Checkers/CStringChecker.cpp
  clang/lib/StaticAnalyzer/Checkers/ChrootChecker.cpp
  clang/lib/StaticAnalyzer/Checkers/ContainerModeling.cpp
  clang/lib/StaticAnalyzer/Checkers/DebugContainerModeling.cpp
  clang/lib/StaticAnalyzer/Checkers/DebugIteratorModeling.cpp
  clang/lib/StaticAnalyzer/Checkers/ErrnoModeling.cpp
  clang/lib/StaticAnalyzer/Checkers/ErrnoTesterChecker.cpp
  clang/lib/StaticAnalyzer/Checkers/GenericTaintChecker.cpp
  clang/lib/StaticAnalyzer/Checkers/MIGChecker.cpp
  clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp
  clang/lib/StaticAnalyzer/Checkers/MmapWriteExecChecker.cpp
  clang/lib/StaticAnalyzer/Checkers/PthreadLockChecker.cpp
  clang/lib/StaticAnalyzer/Checkers/SimpleStreamChecker.cpp
  clang/lib/StaticAnalyzer/Checkers/SmartPtrModeling.cpp
  clang/lib/StaticAnalyzer/Checkers/StreamChecker.cpp
  clang/lib/StaticAnalyzer/Checkers/ValistChecker.cpp
  clang/lib/StaticAnalyzer/Checkers/cert/InvalidPtrChecker.cpp
  clang/lib/StaticAnalyzer/Checkers/cert/PutenvWithAutoChecker.cpp
  clang/lib/StaticAnalyzer/Core/CallDescription.cpp
  clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp
  clang/unittests/StaticAnalyzer/BugReportInterestingnessTest.cpp
  clang/unittests/StaticAnalyzer/CallDescriptionTest.cpp
  clang/unittests/StaticAnalyzer/ConflictingEvalCallsTest.cpp
  clang/unittests/StaticAnalyzer/FalsePositiveRefutationBRVisitorTest.cpp
  clang/unittests/StaticAnalyzer/NoStateChangeFuncVisitorTest.cpp
  lld/COFF/DriverUtils.cpp
  lld/ELF/DriverUtils.cpp
  lld/MachO/DriverUtils.cpp
  lld/MinGW/Driver.cpp
  lld/wasm/Driver.cpp
  lldb/tools/driver/Driver.cpp
  lldb/tools/lldb-server/lldb-gdbserver.cpp
  lldb/tools/lldb-vscode/lldb-vscode.cpp
  llvm/include/llvm/ADT/ArrayRef.h
  llvm/include/llvm/Option/OptTable.h
  llvm/include/llvm/Option/Option.h
  llvm/lib/ExecutionEngine/JITLink/COFFDirectiveParser.cpp
  llvm/lib/Option/OptTable.cpp
  llvm/lib/Option/Option.cpp
  llvm/lib/ToolDrivers/llvm-dlltool/DlltoolDriver.cpp
  llvm/lib/ToolDrivers/llvm-lib/LibDriver.cpp
  llvm/tools/dsymutil/dsymutil.cpp
  llvm/tools/llvm-cvtres/llvm-cvtres.cpp
  llvm/tools/llvm-cxxfilt/llvm-cxxfilt.cpp
  llvm/tools/llvm-dwarfutil/llvm-dwarfutil.cpp
  llvm/tools/llvm-ifs/llvm-ifs.cpp
  llvm/tools/llvm-lipo/llvm-lipo.cpp
  llvm/tools/llvm-ml/llvm-ml.cpp
  llvm/tools/llvm-mt/llvm-mt.cpp
  llvm/tools/llvm-nm/llvm-nm.cpp
  llvm/tools/llvm-objcopy/ObjcopyOptions.cpp
  llvm/tools/llvm-objdump/llvm-objdump.cpp
  llvm/tools/llvm-rc/llvm-rc.cpp
  llvm/tools/llvm-readobj/llvm-readobj.cpp
  llvm/tools/llvm-size/llvm-size.cpp
  llvm/tools/llvm-strings/llvm-strings.cpp
  llvm/tools/llvm-symbolizer/llvm-symbolizer.cpp
  llvm/tools/llvm-tli-checker/llvm-tli-checker.cpp
  llvm/unittests/Option/OptionParsingTest.cpp
  llvm/utils/TableGen/OptParserEmitter.cpp

Index: llvm/utils/TableGen/OptParserEmitter.cpp
===
--- llvm/utils/TableGen/OptParserEmitter.cpp
+++ llvm/utils/TableGen/OptParserEmitter.cpp
@@ -251,8 +251,8 @@
 // Prefix values.
 OS << ", {";
 for (const auto &PrefixKey : Prefix.first)
-  OS << "\"" << PrefixKey << "\" COMMA ";
-OS << "nullptr})\n";
+  OS << "llvm::StringLiteral(\"" << PrefixKey << "\") COMMA ";
+OS << "llvm::StringLiteral(\"\")})\n";
   }
   OS << "#undef COMMA\n";
   OS << "#endif // PREFIX\n\n";
Index: llvm/unittests/Option/OptionParsingTest.cpp
===
--- llvm/unittests/Option/OptionParsingTest.cpp
+++ llvm/unittests/Option/OptionParsingTest.cpp
@@ -25,7 +25,7 @@
 #undef OPTION
 };
 
-#define PREFIX(NAME, VALUE) const char *const NAME[] = VALUE;
+#define PREFIX(NAME, VALUE) constexpr StringLiteral NAME[] = VALUE;
 #include "Opts.inc"
 #undef PREFIX
 
Index: llvm/tools/llvm-tli-checker/llvm-tli-checker.cpp
===
--- llvm/tools/llvm-tli-checker/llvm-tli-checker.cpp
+++ llvm/tools/llvm-tli-checker/llvm-tli-checker.cpp
@@ -35,7 +35,7 @@
 #undef OPTION
 };
 
-#define PREFIX(NAME, VALUE) const char *const NAME[] = VALUE;
+#define PREFIX(NAME, VALUE) constexpr StringLiteral NAME[] = VALUE;
 #include "Opts.inc"
 #undef PREFIX
 
Index: llvm/tools/llvm-symbolizer/llvm-sy

[Lldb-commits] [PATCH] D139881: [clang] Use a StringRef instead of a raw char pointer to store builtin and call information

2022-12-14 Thread serge via Phabricator via lldb-commits
serge-sans-paille marked 4 inline comments as done.
serge-sans-paille added a comment.

New version passes `ninja check` with clang, clang-tools-extra and lld.




Comment at: clang/lib/StaticAnalyzer/Core/CallDescription.cpp:39
 ento::CallDescription::CallDescription(CallDescriptionFlags Flags,
-   ArrayRef QualifiedName,
+   ArrayRef QualifiedName,
MaybeCount RequiredArgs /*= None*/,

steakhal wrote:
> Maybe we could restrict it even more to `StringLiteral`. The same applies to 
> the other ctor.
It's not a strong requirements to have a `StringLiteral` here, as we generate 
an `std::string` from it anyway. Plus the conversion from *intiializer list of 
string literals* to `ArrayRef` is not infered by the compiler, 
so I'd rather not go that way (although I like the idea).


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D139881/new/

https://reviews.llvm.org/D139881

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D140800: Precompute OptTable prefixes union table through tablegen

2022-12-31 Thread serge via Phabricator via lldb-commits
serge-sans-paille created this revision.
serge-sans-paille added a reviewer: nikic.
Herald added subscribers: pmatos, asb, jhenderson, ormris, mstorsjo, steven_wu, 
hiraditya, arichardson, sbc100, emaste.
Herald added a reviewer: JDevlieghere.
Herald added a reviewer: alexander-shaposhnikov.
Herald added a reviewer: jhenderson.
Herald added a reviewer: MaskRay.
Herald added projects: lld-macho, All.
Herald added a reviewer: lld-macho.
serge-sans-paille requested review of this revision.
Herald added subscribers: llvm-commits, lldb-commits, cfe-commits, StephenFan, 
aheejin.
Herald added projects: clang, LLDB, LLVM.

This avoid rediscovering this table when reading each options, providing
a sensible 2% speedup when processing and empty file, and a measurable
speedup on typical workloads, see:

https://llvm-compile-time-tracker.com/compare.php?from=4da6cb3202817ee2897d6b690e4af950459caea4&to=dffbe8638a92bfc73dff5494144d5ef9a73c0acc&stat=instructions:u


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D140800

Files:
  clang/lib/Driver/DriverOptions.cpp
  clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp
  lld/COFF/DriverUtils.cpp
  lld/ELF/DriverUtils.cpp
  lld/MachO/DriverUtils.cpp
  lld/MinGW/Driver.cpp
  lld/wasm/Driver.cpp
  lldb/tools/driver/Driver.cpp
  lldb/tools/lldb-server/lldb-gdbserver.cpp
  lldb/tools/lldb-vscode/lldb-vscode.cpp
  llvm/include/llvm/Option/OptTable.h
  llvm/lib/ExecutionEngine/JITLink/COFFDirectiveParser.cpp
  llvm/lib/Option/OptTable.cpp
  llvm/lib/ToolDrivers/llvm-dlltool/DlltoolDriver.cpp
  llvm/lib/ToolDrivers/llvm-lib/LibDriver.cpp
  llvm/tools/dsymutil/dsymutil.cpp
  llvm/tools/llvm-cvtres/llvm-cvtres.cpp
  llvm/tools/llvm-cxxfilt/llvm-cxxfilt.cpp
  llvm/tools/llvm-dwarfutil/llvm-dwarfutil.cpp
  llvm/tools/llvm-ifs/llvm-ifs.cpp
  llvm/tools/llvm-lipo/llvm-lipo.cpp
  llvm/tools/llvm-ml/llvm-ml.cpp
  llvm/tools/llvm-mt/llvm-mt.cpp
  llvm/tools/llvm-nm/llvm-nm.cpp
  llvm/tools/llvm-objcopy/ObjcopyOptions.cpp
  llvm/tools/llvm-objdump/llvm-objdump.cpp
  llvm/tools/llvm-rc/llvm-rc.cpp
  llvm/tools/llvm-readobj/llvm-readobj.cpp
  llvm/tools/llvm-size/llvm-size.cpp
  llvm/tools/llvm-strings/llvm-strings.cpp
  llvm/tools/llvm-symbolizer/llvm-symbolizer.cpp
  llvm/tools/llvm-tli-checker/llvm-tli-checker.cpp
  llvm/unittests/Option/OptionParsingTest.cpp
  llvm/utils/TableGen/OptParserEmitter.cpp

Index: llvm/utils/TableGen/OptParserEmitter.cpp
===
--- llvm/utils/TableGen/OptParserEmitter.cpp
+++ llvm/utils/TableGen/OptParserEmitter.cpp
@@ -237,8 +237,14 @@
   CurPrefix = NewPrefix;
   }
 
-  // Dump prefixes.
+  DenseSet PrefixesUnionSet;
+  for (const auto &Prefix : Prefixes)
+PrefixesUnionSet.insert(Prefix.first.begin(), Prefix.first.end());
+  SmallVector PrefixesUnion(PrefixesUnionSet.begin(),
+   PrefixesUnionSet.end());
+  array_pod_sort(PrefixesUnion.begin(), PrefixesUnion.end());
 
+  // Dump prefixes.
   OS << "/\n";
   OS << "// Prefixes\n\n";
   OS << "#ifdef PREFIX\n";
@@ -259,6 +265,20 @@
   OS << "#undef COMMA\n";
   OS << "#endif // PREFIX\n\n";
 
+  // Dump prefix unions.
+  OS << "/\n";
+  OS << "// Prefix Union\n\n";
+  OS << "#ifdef PREFIX_UNION\n";
+  OS << "#define COMMA ,\n";
+  OS << "PREFIX_UNION({\n";
+  for (const auto &Prefix : PrefixesUnion) {
+OS << "llvm::StringLiteral(\"" << Prefix << "\") COMMA ";
+  }
+  OS << "llvm::StringLiteral(\"\")})\n";
+  OS << "#undef COMMA\n";
+  OS << "#endif // PREFIX_UNION\n\n";
+
+  // Dump groups.
   OS << "/\n";
   OS << "// ValuesCode\n\n";
   OS << "#ifdef OPTTABLE_VALUES_CODE\n";
Index: llvm/unittests/Option/OptionParsingTest.cpp
===
--- llvm/unittests/Option/OptionParsingTest.cpp
+++ llvm/unittests/Option/OptionParsingTest.cpp
@@ -32,6 +32,14 @@
 #include "Opts.inc"
 #undef PREFIX
 
+static constexpr const StringLiteral PrefixTable_init[] =
+#define PREFIX_UNION(VALUES) VALUES
+#include "Opts.inc"
+#undef PREFIX_UNION
+;
+static constexpr const ArrayRef
+PrefixTable(PrefixTable_init, std::size(PrefixTable_init) - 1);
+
 enum OptionFlags {
   OptFlag1 = (1 << 4),
   OptFlag2 = (1 << 5),
@@ -51,7 +59,7 @@
 class TestOptTable : public OptTable {
 public:
   TestOptTable(bool IgnoreCase = false)
-: OptTable(InfoTable, IgnoreCase) {}
+  : OptTable(InfoTable, PrefixTable, IgnoreCase) {}
 };
 }
 
Index: llvm/tools/llvm-tli-checker/llvm-tli-checker.cpp
===
--- llvm/tools/llvm-tli-checker/llvm-tli-checker.cpp
+++ llvm/tools/llvm-tli-checker/llvm-tli-checker.cpp
@@ -42,6 +42,14 @@
 #include "Opts.inc"
 #undef PREFIX
 
+static constexpr const StringLiteral PrefixTable_init[] =
+#define PREFIX_UNION(VALUES) VALUES
+#include "Opts.inc"
+#undef PREFIX_UNION
+;
+static constexpr const ArrayRef
+PrefixTable(PrefixTable_init, std

[Lldb-commits] [PATCH] D140800: Precompute OptTable prefixes union table through tablegen

2023-01-01 Thread serge via Phabricator via lldb-commits
serge-sans-paille added a comment.

In D140800#4021228 , @thakis wrote:

> Could we make this an optional opt-in maybe? I imagine for the majority of 
> the tools, this has no measurable effect, but it currently makes the Opt 
> library harder to use for every client.

Sure, let's have two constructors, one that uses a precomputed table and one 
that does the precomputation.
Would you prefer having only clang use the faster-but-less efficient method, or 
can I keep the changes as is?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D140800/new/

https://reviews.llvm.org/D140800

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D140800: Precompute OptTable prefixes union table through tablegen

2023-01-03 Thread serge via Phabricator via lldb-commits
serge-sans-paille updated this revision to Diff 485929.
serge-sans-paille added a comment.

Added to versions of OptTable, one that uses a precomputed Table, generated by 
TableGen, and one that relies on the old, generic approach. Both are tested 
using the same test bench.

Updated benchmark: 
https://llvm-compile-time-tracker.com/compare.php?from=4da6cb3202817ee2897d6b690e4af950459caea4&to=19a492b704e8f5c1dea120b9c0d3859bd78796be&stat=instructions:u


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D140800/new/

https://reviews.llvm.org/D140800

Files:
  clang/lib/Driver/DriverOptions.cpp
  clang/lib/Driver/ToolChains/Gnu.cpp
  clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp
  lld/COFF/Driver.h
  lld/COFF/DriverUtils.cpp
  lld/ELF/Driver.h
  lld/ELF/DriverUtils.cpp
  lld/MachO/Driver.h
  lld/MachO/DriverUtils.cpp
  lld/MinGW/Driver.cpp
  lld/wasm/Driver.cpp
  lldb/tools/driver/Driver.cpp
  lldb/tools/lldb-server/lldb-gdbserver.cpp
  lldb/tools/lldb-vscode/lldb-vscode.cpp
  llvm/include/llvm/Option/OptTable.h
  llvm/lib/ExecutionEngine/JITLink/COFFDirectiveParser.cpp
  llvm/lib/Option/OptTable.cpp
  llvm/lib/ToolDrivers/llvm-dlltool/DlltoolDriver.cpp
  llvm/lib/ToolDrivers/llvm-lib/LibDriver.cpp
  llvm/tools/dsymutil/dsymutil.cpp
  llvm/tools/llvm-cvtres/llvm-cvtres.cpp
  llvm/tools/llvm-cxxfilt/llvm-cxxfilt.cpp
  llvm/tools/llvm-dwarfutil/llvm-dwarfutil.cpp
  llvm/tools/llvm-ifs/llvm-ifs.cpp
  llvm/tools/llvm-lipo/llvm-lipo.cpp
  llvm/tools/llvm-ml/llvm-ml.cpp
  llvm/tools/llvm-mt/llvm-mt.cpp
  llvm/tools/llvm-nm/llvm-nm.cpp
  llvm/tools/llvm-objcopy/ObjcopyOptions.cpp
  llvm/tools/llvm-objdump/llvm-objdump.cpp
  llvm/tools/llvm-rc/llvm-rc.cpp
  llvm/tools/llvm-readobj/llvm-readobj.cpp
  llvm/tools/llvm-size/llvm-size.cpp
  llvm/tools/llvm-strings/llvm-strings.cpp
  llvm/tools/llvm-symbolizer/llvm-symbolizer.cpp
  llvm/tools/llvm-tli-checker/llvm-tli-checker.cpp
  llvm/unittests/Option/OptionParsingTest.cpp
  llvm/utils/TableGen/OptParserEmitter.cpp

Index: llvm/utils/TableGen/OptParserEmitter.cpp
===
--- llvm/utils/TableGen/OptParserEmitter.cpp
+++ llvm/utils/TableGen/OptParserEmitter.cpp
@@ -237,8 +237,14 @@
   CurPrefix = NewPrefix;
   }
 
-  // Dump prefixes.
+  DenseSet PrefixesUnionSet;
+  for (const auto &Prefix : Prefixes)
+PrefixesUnionSet.insert(Prefix.first.begin(), Prefix.first.end());
+  SmallVector PrefixesUnion(PrefixesUnionSet.begin(),
+   PrefixesUnionSet.end());
+  array_pod_sort(PrefixesUnion.begin(), PrefixesUnion.end());
 
+  // Dump prefixes.
   OS << "/\n";
   OS << "// Prefixes\n\n";
   OS << "#ifdef PREFIX\n";
@@ -259,6 +265,20 @@
   OS << "#undef COMMA\n";
   OS << "#endif // PREFIX\n\n";
 
+  // Dump prefix unions.
+  OS << "/\n";
+  OS << "// Prefix Union\n\n";
+  OS << "#ifdef PREFIX_UNION\n";
+  OS << "#define COMMA ,\n";
+  OS << "PREFIX_UNION({\n";
+  for (const auto &Prefix : PrefixesUnion) {
+OS << "llvm::StringLiteral(\"" << Prefix << "\") COMMA ";
+  }
+  OS << "llvm::StringLiteral(\"\")})\n";
+  OS << "#undef COMMA\n";
+  OS << "#endif // PREFIX_UNION\n\n";
+
+  // Dump groups.
   OS << "/\n";
   OS << "// ValuesCode\n\n";
   OS << "#ifdef OPTTABLE_VALUES_CODE\n";
Index: llvm/unittests/Option/OptionParsingTest.cpp
===
--- llvm/unittests/Option/OptionParsingTest.cpp
+++ llvm/unittests/Option/OptionParsingTest.cpp
@@ -32,6 +32,14 @@
 #include "Opts.inc"
 #undef PREFIX
 
+static constexpr const StringLiteral PrefixTable_init[] =
+#define PREFIX_UNION(VALUES) VALUES
+#include "Opts.inc"
+#undef PREFIX_UNION
+;
+static constexpr const ArrayRef
+PrefixTable(PrefixTable_init, std::size(PrefixTable_init) - 1);
+
 enum OptionFlags {
   OptFlag1 = (1 << 4),
   OptFlag2 = (1 << 5),
@@ -48,10 +56,16 @@
 };
 
 namespace {
-class TestOptTable : public OptTable {
+class TestOptTable : public GenericOptTable {
 public:
   TestOptTable(bool IgnoreCase = false)
-: OptTable(InfoTable, IgnoreCase) {}
+  : GenericOptTable(InfoTable, IgnoreCase) {}
+};
+
+class TestPrecomputedOptTable : public PrecomputedOptTable {
+public:
+  TestPrecomputedOptTable(bool IgnoreCase = false)
+  : PrecomputedOptTable(InfoTable, PrefixTable, IgnoreCase) {}
 };
 }
 
@@ -67,8 +81,20 @@
   "-Gchuu", "2"
   };
 
-TEST(Option, OptionParsing) {
-  TestOptTable T;
+// Test fixture
+template  class OptTableTest : public ::testing::Test {};
+
+template  class DISABLED_OptTableTest : public ::testing::Test {};
+
+// Test both precomputed and computed OptTables with the same suite of tests.
+using OptTableTestTypes =
+::testing::Types;
+
+TYPED_TEST_SUITE(OptTableTest, OptTableTestTypes, );
+TYPED_TEST_SUITE(DISABLED_OptTableTest, OptTableTestTypes, );
+
+TYPED_TEST(OptTableTest, OptionParsing) {
+  TypeParam T;
   unsigned MAI, MAC;
   InputArgList AL = T.ParseArgs(Args, MAI, MAC);
 

[Lldb-commits] [PATCH] D140800: Precompute OptTable prefixes union table through tablegen

2023-01-03 Thread serge via Phabricator via lldb-commits
serge-sans-paille added a comment.

In D140800#4021282 , @thakis wrote:

> I'm guessing on non-empty files this is a negligible win even in clang.

As showcased by 
https://llvm-compile-time-tracker.com/compare.php?from=4da6cb3202817ee2897d6b690e4af950459caea4&to=19a492b704e8f5c1dea120b9c0d3859bd78796be&stat=instructions:u,
 it's not neglectible in -O0 (and obviously even less neglictible for the 
preprocessing-only step)


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D140800/new/

https://reviews.llvm.org/D140800

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D140800: Precompute OptTable prefixes union table through tablegen

2023-01-03 Thread serge via Phabricator via lldb-commits
serge-sans-paille updated this revision to Diff 485931.
serge-sans-paille added a comment.

(rebased on main. Note that this patch is applied on top of 
https://reviews.llvm.org/D140699)


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D140800/new/

https://reviews.llvm.org/D140800

Files:
  clang/lib/Driver/DriverOptions.cpp
  clang/lib/Driver/ToolChains/Gnu.cpp
  clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp
  lld/COFF/Driver.h
  lld/COFF/DriverUtils.cpp
  lld/ELF/Driver.h
  lld/ELF/DriverUtils.cpp
  lld/MachO/Driver.h
  lld/MachO/DriverUtils.cpp
  lld/MinGW/Driver.cpp
  lld/wasm/Driver.cpp
  lldb/tools/driver/Driver.cpp
  lldb/tools/lldb-server/lldb-gdbserver.cpp
  lldb/tools/lldb-vscode/lldb-vscode.cpp
  llvm/include/llvm/Option/OptTable.h
  llvm/lib/ExecutionEngine/JITLink/COFFDirectiveParser.cpp
  llvm/lib/Option/OptTable.cpp
  llvm/lib/ToolDrivers/llvm-dlltool/DlltoolDriver.cpp
  llvm/lib/ToolDrivers/llvm-lib/LibDriver.cpp
  llvm/tools/dsymutil/dsymutil.cpp
  llvm/tools/llvm-cvtres/llvm-cvtres.cpp
  llvm/tools/llvm-cxxfilt/llvm-cxxfilt.cpp
  llvm/tools/llvm-dwarfutil/llvm-dwarfutil.cpp
  llvm/tools/llvm-ifs/llvm-ifs.cpp
  llvm/tools/llvm-lipo/llvm-lipo.cpp
  llvm/tools/llvm-ml/llvm-ml.cpp
  llvm/tools/llvm-mt/llvm-mt.cpp
  llvm/tools/llvm-nm/llvm-nm.cpp
  llvm/tools/llvm-objcopy/ObjcopyOptions.cpp
  llvm/tools/llvm-objdump/llvm-objdump.cpp
  llvm/tools/llvm-rc/llvm-rc.cpp
  llvm/tools/llvm-readobj/llvm-readobj.cpp
  llvm/tools/llvm-size/llvm-size.cpp
  llvm/tools/llvm-strings/llvm-strings.cpp
  llvm/tools/llvm-symbolizer/llvm-symbolizer.cpp
  llvm/tools/llvm-tli-checker/llvm-tli-checker.cpp
  llvm/unittests/Option/OptionParsingTest.cpp
  llvm/utils/TableGen/OptParserEmitter.cpp

Index: llvm/utils/TableGen/OptParserEmitter.cpp
===
--- llvm/utils/TableGen/OptParserEmitter.cpp
+++ llvm/utils/TableGen/OptParserEmitter.cpp
@@ -237,8 +237,14 @@
   CurPrefix = NewPrefix;
   }
 
-  // Dump prefixes.
+  DenseSet PrefixesUnionSet;
+  for (const auto &Prefix : Prefixes)
+PrefixesUnionSet.insert(Prefix.first.begin(), Prefix.first.end());
+  SmallVector PrefixesUnion(PrefixesUnionSet.begin(),
+   PrefixesUnionSet.end());
+  array_pod_sort(PrefixesUnion.begin(), PrefixesUnion.end());
 
+  // Dump prefixes.
   OS << "/\n";
   OS << "// Prefixes\n\n";
   OS << "#ifdef PREFIX\n";
@@ -259,6 +265,20 @@
   OS << "#undef COMMA\n";
   OS << "#endif // PREFIX\n\n";
 
+  // Dump prefix unions.
+  OS << "/\n";
+  OS << "// Prefix Union\n\n";
+  OS << "#ifdef PREFIX_UNION\n";
+  OS << "#define COMMA ,\n";
+  OS << "PREFIX_UNION({\n";
+  for (const auto &Prefix : PrefixesUnion) {
+OS << "llvm::StringLiteral(\"" << Prefix << "\") COMMA ";
+  }
+  OS << "llvm::StringLiteral(\"\")})\n";
+  OS << "#undef COMMA\n";
+  OS << "#endif // PREFIX_UNION\n\n";
+
+  // Dump groups.
   OS << "/\n";
   OS << "// ValuesCode\n\n";
   OS << "#ifdef OPTTABLE_VALUES_CODE\n";
Index: llvm/unittests/Option/OptionParsingTest.cpp
===
--- llvm/unittests/Option/OptionParsingTest.cpp
+++ llvm/unittests/Option/OptionParsingTest.cpp
@@ -32,6 +32,14 @@
 #include "Opts.inc"
 #undef PREFIX
 
+static constexpr const StringLiteral PrefixTable_init[] =
+#define PREFIX_UNION(VALUES) VALUES
+#include "Opts.inc"
+#undef PREFIX_UNION
+;
+static constexpr const ArrayRef
+PrefixTable(PrefixTable_init, std::size(PrefixTable_init) - 1);
+
 enum OptionFlags {
   OptFlag1 = (1 << 4),
   OptFlag2 = (1 << 5),
@@ -48,10 +56,16 @@
 };
 
 namespace {
-class TestOptTable : public OptTable {
+class TestOptTable : public GenericOptTable {
 public:
   TestOptTable(bool IgnoreCase = false)
-: OptTable(InfoTable, IgnoreCase) {}
+  : GenericOptTable(InfoTable, IgnoreCase) {}
+};
+
+class TestPrecomputedOptTable : public PrecomputedOptTable {
+public:
+  TestPrecomputedOptTable(bool IgnoreCase = false)
+  : PrecomputedOptTable(InfoTable, PrefixTable, IgnoreCase) {}
 };
 }
 
@@ -67,8 +81,20 @@
   "-Gchuu", "2"
   };
 
-TEST(Option, OptionParsing) {
-  TestOptTable T;
+// Test fixture
+template  class OptTableTest : public ::testing::Test {};
+
+template  class DISABLED_OptTableTest : public ::testing::Test {};
+
+// Test both precomputed and computed OptTables with the same suite of tests.
+using OptTableTestTypes =
+::testing::Types;
+
+TYPED_TEST_SUITE(OptTableTest, OptTableTestTypes, );
+TYPED_TEST_SUITE(DISABLED_OptTableTest, OptTableTestTypes, );
+
+TYPED_TEST(OptTableTest, OptionParsing) {
+  TypeParam T;
   unsigned MAI, MAC;
   InputArgList AL = T.ParseArgs(Args, MAI, MAC);
 
@@ -114,8 +140,8 @@
   EXPECT_EQ("desu", StringRef(ASL[1]));
 }
 
-TEST(Option, ParseWithFlagExclusions) {
-  TestOptTable T;
+TYPED_TEST(OptTableTest, ParseWithFlagExclusions) {
+  TypeParam T;
   unsigned MAI, MAC;
 
   // Exclude flag3 to avoid parsing as OPT_SLASH_C

[Lldb-commits] [PATCH] D140896: [WIP] Move from llvm::makeArrayRef to ArrayRef deduction guides

2023-01-03 Thread serge via Phabricator via lldb-commits
serge-sans-paille created this revision.
Herald added subscribers: libc-commits, hanchung, kadircet, Moerafaat, 
kmitropoulou, zero9178, Enna1, bzcheeseman, kosarev, mattd, gchakrabarti, 
ThomasRaoux, pmatos, asb, ayermolo, awarzynski, arjunp, sdasgup3, asavonic, 
carlosgalvezp, Groverkss, wenzhicui, wrengr, armkevincheng, ormris, foad, 
jsetoain, jsmolens, sjarus, eric-k256, cota, mravishankar, teijeong, 
frasercrmck, rdzhabarov, ecnelises, tatianashp, wenlei, mehdi_amini, jdoerfert, 
msifontes, jurahul, Kayjukh, grosul1, Joonsoo, kerbowa, liufengdb, aartbik, 
mgester, arpith-jacob, csigg, antiagainst, shauheen, rriddle, luismarques, 
apazos, sameer.abuasal, pengfei, s.egerton, Jim, jocewei, PkmX, arphaman, 
the_o, brucehoult, MartinMosbeck, rogfer01, steven_wu, atanasyan, edward-jones, 
zzheng, jrtc27, martong, niosHD, sabuasal, simoncook, johnrusso, rbar, 
fedor.sergeev, kbarton, hiraditya, jgravelle-google, arichardson, sbc100, 
jvesely, nemanjai, sdardis, emaste, dylanmckay, jyknight, dschuff, arsenm, 
qcolombet, MatzeB.
Herald added a reviewer: JDevlieghere.
Herald added a reviewer: alexander-shaposhnikov.
Herald added a reviewer: shafik.
Herald added a reviewer: jhenderson.
Herald added a reviewer: antiagainst.
Herald added a reviewer: rriddle.
Herald added a reviewer: antiagainst.
Herald added a reviewer: aartbik.
Herald added a reviewer: MaskRay.
Herald added a reviewer: jpienaar.
Herald added a reviewer: ftynse.
Herald added a reviewer: awarzynski.
Herald added a reviewer: bondhugula.
Herald added a reviewer: rafauler.
Herald added a reviewer: Amir.
Herald added a reviewer: maksfb.
Herald added a reviewer: ThomasRaoux.
Herald added a reviewer: NoQ.
Herald added a reviewer: njames93.
Herald added projects: libc-project, Flang, All.
serge-sans-paille requested review of this revision.
Herald added subscribers: cfe-commits, llvm-commits, lldb-commits, 
pcwang-thead, yota9, StephenFan, stephenneuendorffer, nicolasvasilache, 
aheejin, jholewinski.
Herald added a reviewer: nicolasvasilache.
Herald added a reviewer: herhut.
Herald added a reviewer: dcaballe.
Herald added projects: clang, LLDB, MLIR, LLVM, clang-tools-extra.

Since we're now requiring C++17, Let's get rid of `makeXXX` functions like 
`makeArrayRef`, and use deduction guides instead.

Apart from codebase modernization, there isn't much benefit from that
move, but I can still mention that it would slightly (probably
negligibly) decrease the number of symbols / debug info, as deduction
guides don't generate new code.

The only non-automatic changes have been:

1. Write the deduction guides
2. `ArrayRef(some_uint8_pointer, 0)` needs to be changed into 
`ArrayRef(some_uint8_pointer, (size_t)0)` to avoid an ambiguous call with 
`ArrayRef((uint8_t*), (uint8_t*))`
3. `CVSymbol sym(makeArrayRef(symStorage));` needed to be rewritten as 
`CVSymbol sym{ArrayRef(symStorage)};` otherwise the compiler is confused and 
thinks we have a (bad) function prototype. There was a few similar situation 
across the codebase.
4. ADL doesn't seem to work the same for deductio-guides and functions, so at 
some point the `llvm` namespace must be explicitly stated.
5. The "reference mode" of `makeArrayRef(ArrayRef &)` that acts as no-op is 
not supported (a constructor cannot achieve that).


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D140896

Files:
  bolt/tools/bat-dump/bat-dump.cpp
  bolt/tools/driver/llvm-bolt.cpp
  bolt/tools/heatmap/heatmap.cpp
  clang-tools-extra/clang-apply-replacements/tool/ClangApplyReplacementsMain.cpp
  clang-tools-extra/clang-tidy/bugprone/ArgumentCommentCheck.cpp
  clang-tools-extra/clang-tidy/bugprone/SignalHandlerCheck.cpp
  clang-tools-extra/clang-tidy/concurrency/MtUnsafeCheck.cpp
  clang-tools-extra/clang-tidy/modernize/AvoidBindCheck.cpp
  clang-tools-extra/clang-tidy/modernize/LoopConvertCheck.cpp
  clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.cpp
  clang-tools-extra/clang-tidy/utils/IncludeSorter.cpp
  clang-tools-extra/clangd/ClangdLSPServer.cpp
  clang-tools-extra/clangd/CompileCommands.cpp
  clang-tools-extra/clangd/FindSymbols.cpp
  clang-tools-extra/clangd/Preamble.cpp
  clang-tools-extra/clangd/Selection.cpp
  clang-tools-extra/clangd/XRefs.cpp
  clang-tools-extra/clangd/refactor/tweaks/DefineOutline.cpp
  clang-tools-extra/clangd/tool/Check.cpp
  clang-tools-extra/clangd/unittests/CompileCommandsTests.cpp
  clang-tools-extra/include-cleaner/lib/HTMLReport.cpp
  clang-tools-extra/pseudo/include/clang-pseudo/Forest.h
  clang-tools-extra/pseudo/include/clang-pseudo/GLR.h
  clang-tools-extra/pseudo/include/clang-pseudo/grammar/LRTable.h
  clang-tools-extra/pseudo/lib/Forest.cpp
  clang-tools-extra/pseudo/lib/GLR.cpp
  clang-tools-extra/pseudo/lib/grammar/Grammar.cpp
  clang-tools-extra/unittests/clang-tidy/ClangTidyOptionsTest.cpp
  clang/include/clang/AST/Decl.h
  clang/include/clang/AST/DeclCXX.h
  clang/include/clang/AST/DeclObjC.h
  clang/include/clang/AST/DeclOpenMP.h
  clang/includ

[Lldb-commits] [PATCH] D140896: [WIP] Move from llvm::makeArrayRef to ArrayRef deduction guides

2023-01-03 Thread serge via Phabricator via lldb-commits
serge-sans-paille updated this revision to Diff 486049.
serge-sans-paille added a comment.

+ keep deprecated version, flagged appropriately


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D140896/new/

https://reviews.llvm.org/D140896

Files:
  bolt/tools/bat-dump/bat-dump.cpp
  bolt/tools/driver/llvm-bolt.cpp
  bolt/tools/heatmap/heatmap.cpp
  clang-tools-extra/clang-apply-replacements/tool/ClangApplyReplacementsMain.cpp
  clang-tools-extra/clang-tidy/bugprone/ArgumentCommentCheck.cpp
  clang-tools-extra/clang-tidy/bugprone/SignalHandlerCheck.cpp
  clang-tools-extra/clang-tidy/concurrency/MtUnsafeCheck.cpp
  clang-tools-extra/clang-tidy/modernize/AvoidBindCheck.cpp
  clang-tools-extra/clang-tidy/modernize/LoopConvertCheck.cpp
  clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.cpp
  clang-tools-extra/clang-tidy/utils/IncludeSorter.cpp
  clang-tools-extra/clangd/ClangdLSPServer.cpp
  clang-tools-extra/clangd/CompileCommands.cpp
  clang-tools-extra/clangd/FindSymbols.cpp
  clang-tools-extra/clangd/Preamble.cpp
  clang-tools-extra/clangd/Selection.cpp
  clang-tools-extra/clangd/XRefs.cpp
  clang-tools-extra/clangd/refactor/tweaks/DefineOutline.cpp
  clang-tools-extra/clangd/tool/Check.cpp
  clang-tools-extra/clangd/unittests/CompileCommandsTests.cpp
  clang-tools-extra/include-cleaner/lib/HTMLReport.cpp
  clang-tools-extra/pseudo/include/clang-pseudo/Forest.h
  clang-tools-extra/pseudo/include/clang-pseudo/GLR.h
  clang-tools-extra/pseudo/include/clang-pseudo/grammar/LRTable.h
  clang-tools-extra/pseudo/lib/Forest.cpp
  clang-tools-extra/pseudo/lib/GLR.cpp
  clang-tools-extra/pseudo/lib/grammar/Grammar.cpp
  clang-tools-extra/unittests/clang-tidy/ClangTidyOptionsTest.cpp
  clang/include/clang/AST/Decl.h
  clang/include/clang/AST/DeclCXX.h
  clang/include/clang/AST/DeclObjC.h
  clang/include/clang/AST/DeclOpenMP.h
  clang/include/clang/AST/DeclTemplate.h
  clang/include/clang/AST/Expr.h
  clang/include/clang/AST/ExprCXX.h
  clang/include/clang/AST/ExprObjC.h
  clang/include/clang/AST/ExprOpenMP.h
  clang/include/clang/AST/OpenMPClause.h
  clang/include/clang/AST/PropertiesBase.td
  clang/include/clang/AST/Stmt.h
  clang/include/clang/AST/StmtOpenMP.h
  clang/include/clang/AST/TemplateBase.h
  clang/include/clang/AST/TemplateName.h
  clang/include/clang/AST/Type.h
  clang/include/clang/AST/TypeLoc.h
  clang/include/clang/Analysis/Analyses/ThreadSafetyTIL.h
  clang/include/clang/Basic/Diagnostic.h
  clang/include/clang/Basic/SyncScope.h
  clang/include/clang/CodeGen/CGFunctionInfo.h
  clang/include/clang/Lex/MacroInfo.h
  clang/include/clang/Parse/Parser.h
  clang/include/clang/Sema/DeclSpec.h
  clang/include/clang/Sema/DelayedDiagnostic.h
  clang/include/clang/Sema/Sema.h
  clang/include/clang/Serialization/ASTRecordReader.h
  clang/include/clang/Tooling/Refactoring/Rename/SymbolOccurrences.h
  clang/include/clang/Tooling/Transformer/RewriteRule.h
  clang/lib/AST/APValue.cpp
  clang/lib/AST/ASTContext.cpp
  clang/lib/AST/ASTDiagnostic.cpp
  clang/lib/AST/ASTImporter.cpp
  clang/lib/AST/CommentParser.cpp
  clang/lib/AST/CommentSema.cpp
  clang/lib/AST/ComputeDependence.cpp
  clang/lib/AST/Decl.cpp
  clang/lib/AST/DeclCXX.cpp
  clang/lib/AST/DeclTemplate.cpp
  clang/lib/AST/ExprCXX.cpp
  clang/lib/AST/ExprConstant.cpp
  clang/lib/AST/OpenMPClause.cpp
  clang/lib/AST/ParentMapContext.cpp
  clang/lib/AST/TemplateName.cpp
  clang/lib/AST/Type.cpp
  clang/lib/ASTMatchers/Dynamic/Marshallers.cpp
  clang/lib/Analysis/CFG.cpp
  clang/lib/Analysis/CalledOnceCheck.cpp
  clang/lib/Analysis/FlowSensitive/DataflowEnvironment.cpp
  clang/lib/Basic/Module.cpp
  clang/lib/Basic/Targets/AArch64.cpp
  clang/lib/Basic/Targets/AMDGPU.cpp
  clang/lib/Basic/Targets/ARC.h
  clang/lib/Basic/Targets/ARM.cpp
  clang/lib/Basic/Targets/AVR.h
  clang/lib/Basic/Targets/BPF.cpp
  clang/lib/Basic/Targets/CSKY.cpp
  clang/lib/Basic/Targets/Hexagon.cpp
  clang/lib/Basic/Targets/Lanai.cpp
  clang/lib/Basic/Targets/LoongArch.cpp
  clang/lib/Basic/Targets/M68k.cpp
  clang/lib/Basic/Targets/MSP430.cpp
  clang/lib/Basic/Targets/MSP430.h
  clang/lib/Basic/Targets/Mips.cpp
  clang/lib/Basic/Targets/Mips.h
  clang/lib/Basic/Targets/NVPTX.cpp
  clang/lib/Basic/Targets/PPC.cpp
  clang/lib/Basic/Targets/RISCV.cpp
  clang/lib/Basic/Targets/Sparc.cpp
  clang/lib/Basic/Targets/SystemZ.cpp
  clang/lib/Basic/Targets/VE.cpp
  clang/lib/Basic/Targets/VE.h
  clang/lib/Basic/Targets/WebAssembly.cpp
  clang/lib/Basic/Targets/X86.cpp
  clang/lib/Basic/Targets/XCore.cpp
  clang/lib/Basic/Targets/XCore.h
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/lib/CodeGen/CGExprConstant.cpp
  clang/lib/CodeGen/CGExprScalar.cpp
  clang/lib/CodeGen/CGObjCGNU.cpp
  clang/lib/CodeGen/CGOpenMPRuntime.cpp
  clang/lib/CodeGen/CGStmtOpenMP.cpp
  clang/lib/CodeGen/CodeGenFunction.cpp
  clang/lib/CodeGen/CodeGenModule.cpp
  clang/lib/CodeGen/CodeGenPGO.cpp
  clang/lib/CodeGen/CodeGenTypes.cpp
  clang/lib/CodeGen/ConstantInitBuilder.cpp
  clang/lib/CodeGen/CoverageMappingG

[Lldb-commits] [PATCH] D140896: [WIP] Move from llvm::makeArrayRef to ArrayRef deduction guides

2023-01-03 Thread serge via Phabricator via lldb-commits
serge-sans-paille updated this revision to Diff 486172.
serge-sans-paille added a comment.

Split the original patch in pieces: first just introduce the deduction guide.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D140896/new/

https://reviews.llvm.org/D140896

Files:
  llvm/include/llvm/ADT/ArrayRef.h


Index: llvm/include/llvm/ADT/ArrayRef.h
===
--- llvm/include/llvm/ADT/ArrayRef.h
+++ llvm/include/llvm/ADT/ArrayRef.h
@@ -466,9 +466,44 @@
 ~OwningArrayRef() { delete[] this->data(); }
   };
 
-  /// @name ArrayRef Convenience constructors
+  /// @name ArrayRef Deduction guides
   /// @{
+  /// Deduction guide to construct an ArrayRef from a single element.
+  template  ArrayRef(const T &OneElt) -> ArrayRef;
+
+  /// Deduction guide to construct an ArrayRef from a pointer and length
+  template  ArrayRef(const T *data, size_t length) -> ArrayRef;
+
+  /// Deduction guide to construct an ArrayRef from a range
+  template  ArrayRef(const T *data, const T *end) -> ArrayRef;
+
+  /// Deduction guide to construct an ArrayRef from a SmallVector
+  template  ArrayRef(const SmallVectorImpl &Vec) -> ArrayRef;
+
+  /// Deduction guide to construct an ArrayRef from a SmallVector
+  template 
+  ArrayRef(const SmallVector &Vec) -> ArrayRef;
+
+  /// Deduction guide to construct an ArrayRef from a std::vector
+  template  ArrayRef(const std::vector &Vec) -> ArrayRef;
+
+  /// Deduction guide to construct an ArrayRef from a std::array
+  template 
+  ArrayRef(const std::array &Vec) -> ArrayRef;
+
+  /// Deduction guide to construct an ArrayRef from an ArrayRef (no-op) (const)
+  template  ArrayRef(const ArrayRef &Vec) -> ArrayRef;
+
+  /// Deduction guide to construct an ArrayRef from an ArrayRef (no-op)
+  template  ArrayRef(ArrayRef &Vec) -> ArrayRef;
+
+  /// Deduction guide to construct an ArrayRef from a C array.
+  template  ArrayRef(const T (&Arr)[N]) -> ArrayRef;
 
+  /// @}
+
+  /// @name ArrayRef Convenience constructors
+  /// @{
   /// Construct an ArrayRef from a single element.
   template
   ArrayRef makeArrayRef(const T &OneElt) {


Index: llvm/include/llvm/ADT/ArrayRef.h
===
--- llvm/include/llvm/ADT/ArrayRef.h
+++ llvm/include/llvm/ADT/ArrayRef.h
@@ -466,9 +466,44 @@
 ~OwningArrayRef() { delete[] this->data(); }
   };
 
-  /// @name ArrayRef Convenience constructors
+  /// @name ArrayRef Deduction guides
   /// @{
+  /// Deduction guide to construct an ArrayRef from a single element.
+  template  ArrayRef(const T &OneElt) -> ArrayRef;
+
+  /// Deduction guide to construct an ArrayRef from a pointer and length
+  template  ArrayRef(const T *data, size_t length) -> ArrayRef;
+
+  /// Deduction guide to construct an ArrayRef from a range
+  template  ArrayRef(const T *data, const T *end) -> ArrayRef;
+
+  /// Deduction guide to construct an ArrayRef from a SmallVector
+  template  ArrayRef(const SmallVectorImpl &Vec) -> ArrayRef;
+
+  /// Deduction guide to construct an ArrayRef from a SmallVector
+  template 
+  ArrayRef(const SmallVector &Vec) -> ArrayRef;
+
+  /// Deduction guide to construct an ArrayRef from a std::vector
+  template  ArrayRef(const std::vector &Vec) -> ArrayRef;
+
+  /// Deduction guide to construct an ArrayRef from a std::array
+  template 
+  ArrayRef(const std::array &Vec) -> ArrayRef;
+
+  /// Deduction guide to construct an ArrayRef from an ArrayRef (no-op) (const)
+  template  ArrayRef(const ArrayRef &Vec) -> ArrayRef;
+
+  /// Deduction guide to construct an ArrayRef from an ArrayRef (no-op)
+  template  ArrayRef(ArrayRef &Vec) -> ArrayRef;
+
+  /// Deduction guide to construct an ArrayRef from a C array.
+  template  ArrayRef(const T (&Arr)[N]) -> ArrayRef;
 
+  /// @}
+
+  /// @name ArrayRef Convenience constructors
+  /// @{
   /// Construct an ArrayRef from a single element.
   template
   ArrayRef makeArrayRef(const T &OneElt) {
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D140896: [WIP] Move from llvm::makeArrayRef to ArrayRef deduction guides

2023-01-03 Thread serge via Phabricator via lldb-commits
This revision was not accepted when it landed; it landed in state "Needs 
Review".
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG3677ee65d192: Move from llvm::makeArrayRef to ArrayRef 
deduction guides (authored by serge-sans-paille).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D140896/new/

https://reviews.llvm.org/D140896

Files:
  llvm/include/llvm/ADT/ArrayRef.h


Index: llvm/include/llvm/ADT/ArrayRef.h
===
--- llvm/include/llvm/ADT/ArrayRef.h
+++ llvm/include/llvm/ADT/ArrayRef.h
@@ -466,9 +466,44 @@
 ~OwningArrayRef() { delete[] this->data(); }
   };
 
-  /// @name ArrayRef Convenience constructors
+  /// @name ArrayRef Deduction guides
   /// @{
+  /// Deduction guide to construct an ArrayRef from a single element.
+  template  ArrayRef(const T &OneElt) -> ArrayRef;
+
+  /// Deduction guide to construct an ArrayRef from a pointer and length
+  template  ArrayRef(const T *data, size_t length) -> ArrayRef;
+
+  /// Deduction guide to construct an ArrayRef from a range
+  template  ArrayRef(const T *data, const T *end) -> ArrayRef;
+
+  /// Deduction guide to construct an ArrayRef from a SmallVector
+  template  ArrayRef(const SmallVectorImpl &Vec) -> ArrayRef;
+
+  /// Deduction guide to construct an ArrayRef from a SmallVector
+  template 
+  ArrayRef(const SmallVector &Vec) -> ArrayRef;
+
+  /// Deduction guide to construct an ArrayRef from a std::vector
+  template  ArrayRef(const std::vector &Vec) -> ArrayRef;
+
+  /// Deduction guide to construct an ArrayRef from a std::array
+  template 
+  ArrayRef(const std::array &Vec) -> ArrayRef;
+
+  /// Deduction guide to construct an ArrayRef from an ArrayRef (no-op) (const)
+  template  ArrayRef(const ArrayRef &Vec) -> ArrayRef;
+
+  /// Deduction guide to construct an ArrayRef from an ArrayRef (no-op)
+  template  ArrayRef(ArrayRef &Vec) -> ArrayRef;
+
+  /// Deduction guide to construct an ArrayRef from a C array.
+  template  ArrayRef(const T (&Arr)[N]) -> ArrayRef;
 
+  /// @}
+
+  /// @name ArrayRef Convenience constructors
+  /// @{
   /// Construct an ArrayRef from a single element.
   template
   ArrayRef makeArrayRef(const T &OneElt) {


Index: llvm/include/llvm/ADT/ArrayRef.h
===
--- llvm/include/llvm/ADT/ArrayRef.h
+++ llvm/include/llvm/ADT/ArrayRef.h
@@ -466,9 +466,44 @@
 ~OwningArrayRef() { delete[] this->data(); }
   };
 
-  /// @name ArrayRef Convenience constructors
+  /// @name ArrayRef Deduction guides
   /// @{
+  /// Deduction guide to construct an ArrayRef from a single element.
+  template  ArrayRef(const T &OneElt) -> ArrayRef;
+
+  /// Deduction guide to construct an ArrayRef from a pointer and length
+  template  ArrayRef(const T *data, size_t length) -> ArrayRef;
+
+  /// Deduction guide to construct an ArrayRef from a range
+  template  ArrayRef(const T *data, const T *end) -> ArrayRef;
+
+  /// Deduction guide to construct an ArrayRef from a SmallVector
+  template  ArrayRef(const SmallVectorImpl &Vec) -> ArrayRef;
+
+  /// Deduction guide to construct an ArrayRef from a SmallVector
+  template 
+  ArrayRef(const SmallVector &Vec) -> ArrayRef;
+
+  /// Deduction guide to construct an ArrayRef from a std::vector
+  template  ArrayRef(const std::vector &Vec) -> ArrayRef;
+
+  /// Deduction guide to construct an ArrayRef from a std::array
+  template 
+  ArrayRef(const std::array &Vec) -> ArrayRef;
+
+  /// Deduction guide to construct an ArrayRef from an ArrayRef (no-op) (const)
+  template  ArrayRef(const ArrayRef &Vec) -> ArrayRef;
+
+  /// Deduction guide to construct an ArrayRef from an ArrayRef (no-op)
+  template  ArrayRef(ArrayRef &Vec) -> ArrayRef;
+
+  /// Deduction guide to construct an ArrayRef from a C array.
+  template  ArrayRef(const T (&Arr)[N]) -> ArrayRef;
 
+  /// @}
+
+  /// @name ArrayRef Convenience constructors
+  /// @{
   /// Construct an ArrayRef from a single element.
   template
   ArrayRef makeArrayRef(const T &OneElt) {
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D141298: Move from llvm::makeArrayRef to ArrayRef deduction guides - last part

2023-01-09 Thread serge via Phabricator via lldb-commits
serge-sans-paille added a comment.
Herald added subscribers: Michael137, JDevlieghere.

Once that patch lands, I'll mark `makeArrayRef` as deprecated.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D141298/new/

https://reviews.llvm.org/D141298

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D140800: [OptTable] Precompute OptTable prefixes union table through tablegen

2023-01-09 Thread serge via Phabricator via lldb-commits
serge-sans-paille added a comment.

@nikic : gentle ping :-)


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D140800/new/

https://reviews.llvm.org/D140800

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D140800: [OptTable] Precompute OptTable prefixes union table through tablegen

2023-01-11 Thread serge via Phabricator via lldb-commits
serge-sans-paille updated this revision to Diff 488344.
serge-sans-paille added a comment.

Nits + rebase on main branch


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D140800/new/

https://reviews.llvm.org/D140800

Files:
  clang/lib/Driver/DriverOptions.cpp
  clang/lib/Driver/ToolChains/Gnu.cpp
  clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp
  lld/COFF/Driver.h
  lld/COFF/DriverUtils.cpp
  lld/ELF/Driver.h
  lld/ELF/DriverUtils.cpp
  lld/MachO/Driver.h
  lld/MachO/DriverUtils.cpp
  lld/MinGW/Driver.cpp
  lld/wasm/Driver.cpp
  lldb/tools/driver/Driver.cpp
  lldb/tools/lldb-server/lldb-gdbserver.cpp
  lldb/tools/lldb-vscode/lldb-vscode.cpp
  llvm/include/llvm/Option/OptTable.h
  llvm/lib/ExecutionEngine/JITLink/COFFDirectiveParser.cpp
  llvm/lib/Option/OptTable.cpp
  llvm/lib/ToolDrivers/llvm-dlltool/DlltoolDriver.cpp
  llvm/lib/ToolDrivers/llvm-lib/LibDriver.cpp
  llvm/tools/dsymutil/dsymutil.cpp
  llvm/tools/llvm-cvtres/llvm-cvtres.cpp
  llvm/tools/llvm-cxxfilt/llvm-cxxfilt.cpp
  llvm/tools/llvm-dwarfutil/llvm-dwarfutil.cpp
  llvm/tools/llvm-ifs/llvm-ifs.cpp
  llvm/tools/llvm-lipo/llvm-lipo.cpp
  llvm/tools/llvm-ml/llvm-ml.cpp
  llvm/tools/llvm-mt/llvm-mt.cpp
  llvm/tools/llvm-nm/llvm-nm.cpp
  llvm/tools/llvm-objcopy/ObjcopyOptions.cpp
  llvm/tools/llvm-objdump/llvm-objdump.cpp
  llvm/tools/llvm-rc/llvm-rc.cpp
  llvm/tools/llvm-readobj/llvm-readobj.cpp
  llvm/tools/llvm-size/llvm-size.cpp
  llvm/tools/llvm-strings/llvm-strings.cpp
  llvm/tools/llvm-symbolizer/llvm-symbolizer.cpp
  llvm/tools/llvm-tli-checker/llvm-tli-checker.cpp
  llvm/unittests/Option/OptionParsingTest.cpp
  llvm/utils/TableGen/OptParserEmitter.cpp

Index: llvm/utils/TableGen/OptParserEmitter.cpp
===
--- llvm/utils/TableGen/OptParserEmitter.cpp
+++ llvm/utils/TableGen/OptParserEmitter.cpp
@@ -237,8 +237,14 @@
   CurPrefix = NewPrefix;
   }
 
-  // Dump prefixes.
+  DenseSet PrefixesUnionSet;
+  for (const auto &Prefix : Prefixes)
+PrefixesUnionSet.insert(Prefix.first.begin(), Prefix.first.end());
+  SmallVector PrefixesUnion(PrefixesUnionSet.begin(),
+   PrefixesUnionSet.end());
+  array_pod_sort(PrefixesUnion.begin(), PrefixesUnion.end());
 
+  // Dump prefixes.
   OS << "/\n";
   OS << "// Prefixes\n\n";
   OS << "#ifdef PREFIX\n";
@@ -259,6 +265,20 @@
   OS << "#undef COMMA\n";
   OS << "#endif // PREFIX\n\n";
 
+  // Dump prefix unions.
+  OS << "/\n";
+  OS << "// Prefix Union\n\n";
+  OS << "#ifdef PREFIX_UNION\n";
+  OS << "#define COMMA ,\n";
+  OS << "PREFIX_UNION({\n";
+  for (const auto &Prefix : PrefixesUnion) {
+OS << "llvm::StringLiteral(\"" << Prefix << "\") COMMA ";
+  }
+  OS << "llvm::StringLiteral(\"\")})\n";
+  OS << "#undef COMMA\n";
+  OS << "#endif // PREFIX_UNION\n\n";
+
+  // Dump groups.
   OS << "/\n";
   OS << "// ValuesCode\n\n";
   OS << "#ifdef OPTTABLE_VALUES_CODE\n";
Index: llvm/unittests/Option/OptionParsingTest.cpp
===
--- llvm/unittests/Option/OptionParsingTest.cpp
+++ llvm/unittests/Option/OptionParsingTest.cpp
@@ -32,6 +32,14 @@
 #include "Opts.inc"
 #undef PREFIX
 
+static constexpr const StringLiteral PrefixTable_init[] =
+#define PREFIX_UNION(VALUES) VALUES
+#include "Opts.inc"
+#undef PREFIX_UNION
+;
+static constexpr const ArrayRef
+PrefixTable(PrefixTable_init, std::size(PrefixTable_init) - 1);
+
 enum OptionFlags {
   OptFlag1 = (1 << 4),
   OptFlag2 = (1 << 5),
@@ -48,10 +56,16 @@
 };
 
 namespace {
-class TestOptTable : public OptTable {
+class TestOptTable : public GenericOptTable {
 public:
   TestOptTable(bool IgnoreCase = false)
-: OptTable(InfoTable, IgnoreCase) {}
+  : GenericOptTable(InfoTable, IgnoreCase) {}
+};
+
+class TestPrecomputedOptTable : public PrecomputedOptTable {
+public:
+  TestPrecomputedOptTable(bool IgnoreCase = false)
+  : PrecomputedOptTable(InfoTable, PrefixTable, IgnoreCase) {}
 };
 }
 
@@ -67,8 +81,20 @@
   "-Gchuu", "2"
   };
 
-TEST(Option, OptionParsing) {
-  TestOptTable T;
+// Test fixture
+template  class OptTableTest : public ::testing::Test {};
+
+template  class DISABLED_OptTableTest : public ::testing::Test {};
+
+// Test both precomputed and computed OptTables with the same suite of tests.
+using OptTableTestTypes =
+::testing::Types;
+
+TYPED_TEST_SUITE(OptTableTest, OptTableTestTypes, );
+TYPED_TEST_SUITE(DISABLED_OptTableTest, OptTableTestTypes, );
+
+TYPED_TEST(OptTableTest, OptionParsing) {
+  TypeParam T;
   unsigned MAI, MAC;
   InputArgList AL = T.ParseArgs(Args, MAI, MAC);
 
@@ -114,8 +140,8 @@
   EXPECT_EQ("desu", StringRef(ASL[1]));
 }
 
-TEST(Option, ParseWithFlagExclusions) {
-  TestOptTable T;
+TYPED_TEST(OptTableTest, ParseWithFlagExclusions) {
+  TypeParam T;
   unsigned MAI, MAC;
 
   // Exclude flag3 to avoid parsing as OPT_SLASH_C.
@@ -142,8 +168,8 @@
   EXPECT_EQ("bar", AL.getLastArgValue(OPT_C

[Lldb-commits] [PATCH] D140800: [OptTable] Precompute OptTable prefixes union table through tablegen

2023-01-11 Thread serge via Phabricator via lldb-commits
serge-sans-paille marked 2 inline comments as done.
serge-sans-paille added a comment.

In D140800#4043723 , @nikic wrote:

> Just to check, this isn't going to cause some warning spew about all those 
> OptTable implementations being non-final?

nope. Why would there be?




Comment at: llvm/unittests/Option/OptionParsingTest.cpp:327
 
-TEST(DISABLED_Option, FindNearestFIXME) {
-  TestOptTable T;

@nikic: the `DISABLED_` prefix seems to be a gtest convention, see 
https://github.com/google/googletest/blob/main/docs/advanced.md#temporarily-disabling-tests


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D140800/new/

https://reviews.llvm.org/D140800

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D140800: [OptTable] Precompute OptTable prefixes union table through tablegen

2023-01-12 Thread serge via Phabricator via lldb-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG07bb29d8ffc3: [OptTable] Precompute OptTable prefixes union 
table through tablegen (authored by serge-sans-paille).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D140800/new/

https://reviews.llvm.org/D140800

Files:
  clang/lib/Driver/DriverOptions.cpp
  clang/lib/Driver/ToolChains/Gnu.cpp
  clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp
  lld/COFF/Driver.h
  lld/COFF/DriverUtils.cpp
  lld/ELF/Driver.h
  lld/ELF/DriverUtils.cpp
  lld/MachO/Driver.h
  lld/MachO/DriverUtils.cpp
  lld/MinGW/Driver.cpp
  lld/wasm/Driver.cpp
  lldb/tools/driver/Driver.cpp
  lldb/tools/lldb-server/lldb-gdbserver.cpp
  lldb/tools/lldb-vscode/lldb-vscode.cpp
  llvm/include/llvm/Option/OptTable.h
  llvm/lib/ExecutionEngine/JITLink/COFFDirectiveParser.cpp
  llvm/lib/Option/OptTable.cpp
  llvm/lib/ToolDrivers/llvm-dlltool/DlltoolDriver.cpp
  llvm/lib/ToolDrivers/llvm-lib/LibDriver.cpp
  llvm/tools/dsymutil/dsymutil.cpp
  llvm/tools/llvm-cvtres/llvm-cvtres.cpp
  llvm/tools/llvm-cxxfilt/llvm-cxxfilt.cpp
  llvm/tools/llvm-dwarfutil/llvm-dwarfutil.cpp
  llvm/tools/llvm-ifs/llvm-ifs.cpp
  llvm/tools/llvm-lipo/llvm-lipo.cpp
  llvm/tools/llvm-ml/llvm-ml.cpp
  llvm/tools/llvm-mt/llvm-mt.cpp
  llvm/tools/llvm-nm/llvm-nm.cpp
  llvm/tools/llvm-objcopy/ObjcopyOptions.cpp
  llvm/tools/llvm-objdump/llvm-objdump.cpp
  llvm/tools/llvm-rc/llvm-rc.cpp
  llvm/tools/llvm-readobj/llvm-readobj.cpp
  llvm/tools/llvm-size/llvm-size.cpp
  llvm/tools/llvm-strings/llvm-strings.cpp
  llvm/tools/llvm-symbolizer/llvm-symbolizer.cpp
  llvm/tools/llvm-tli-checker/llvm-tli-checker.cpp
  llvm/unittests/Option/OptionParsingTest.cpp
  llvm/utils/TableGen/OptParserEmitter.cpp

Index: llvm/utils/TableGen/OptParserEmitter.cpp
===
--- llvm/utils/TableGen/OptParserEmitter.cpp
+++ llvm/utils/TableGen/OptParserEmitter.cpp
@@ -237,8 +237,14 @@
   CurPrefix = NewPrefix;
   }
 
-  // Dump prefixes.
+  DenseSet PrefixesUnionSet;
+  for (const auto &Prefix : Prefixes)
+PrefixesUnionSet.insert(Prefix.first.begin(), Prefix.first.end());
+  SmallVector PrefixesUnion(PrefixesUnionSet.begin(),
+   PrefixesUnionSet.end());
+  array_pod_sort(PrefixesUnion.begin(), PrefixesUnion.end());
 
+  // Dump prefixes.
   OS << "/\n";
   OS << "// Prefixes\n\n";
   OS << "#ifdef PREFIX\n";
@@ -259,6 +265,20 @@
   OS << "#undef COMMA\n";
   OS << "#endif // PREFIX\n\n";
 
+  // Dump prefix unions.
+  OS << "/\n";
+  OS << "// Prefix Union\n\n";
+  OS << "#ifdef PREFIX_UNION\n";
+  OS << "#define COMMA ,\n";
+  OS << "PREFIX_UNION({\n";
+  for (const auto &Prefix : PrefixesUnion) {
+OS << "llvm::StringLiteral(\"" << Prefix << "\") COMMA ";
+  }
+  OS << "llvm::StringLiteral(\"\")})\n";
+  OS << "#undef COMMA\n";
+  OS << "#endif // PREFIX_UNION\n\n";
+
+  // Dump groups.
   OS << "/\n";
   OS << "// ValuesCode\n\n";
   OS << "#ifdef OPTTABLE_VALUES_CODE\n";
Index: llvm/unittests/Option/OptionParsingTest.cpp
===
--- llvm/unittests/Option/OptionParsingTest.cpp
+++ llvm/unittests/Option/OptionParsingTest.cpp
@@ -32,6 +32,14 @@
 #include "Opts.inc"
 #undef PREFIX
 
+static constexpr const StringLiteral PrefixTable_init[] =
+#define PREFIX_UNION(VALUES) VALUES
+#include "Opts.inc"
+#undef PREFIX_UNION
+;
+static constexpr const ArrayRef
+PrefixTable(PrefixTable_init, std::size(PrefixTable_init) - 1);
+
 enum OptionFlags {
   OptFlag1 = (1 << 4),
   OptFlag2 = (1 << 5),
@@ -48,10 +56,16 @@
 };
 
 namespace {
-class TestOptTable : public OptTable {
+class TestOptTable : public GenericOptTable {
 public:
   TestOptTable(bool IgnoreCase = false)
-: OptTable(InfoTable, IgnoreCase) {}
+  : GenericOptTable(InfoTable, IgnoreCase) {}
+};
+
+class TestPrecomputedOptTable : public PrecomputedOptTable {
+public:
+  TestPrecomputedOptTable(bool IgnoreCase = false)
+  : PrecomputedOptTable(InfoTable, PrefixTable, IgnoreCase) {}
 };
 }
 
@@ -67,8 +81,20 @@
   "-Gchuu", "2"
   };
 
-TEST(Option, OptionParsing) {
-  TestOptTable T;
+// Test fixture
+template  class OptTableTest : public ::testing::Test {};
+
+template  class DISABLED_OptTableTest : public ::testing::Test {};
+
+// Test both precomputed and computed OptTables with the same suite of tests.
+using OptTableTestTypes =
+::testing::Types;
+
+TYPED_TEST_SUITE(OptTableTest, OptTableTestTypes, );
+TYPED_TEST_SUITE(DISABLED_OptTableTest, OptTableTestTypes, );
+
+TYPED_TEST(OptTableTest, OptionParsing) {
+  TypeParam T;
   unsigned MAI, MAC;
   InputArgList AL = T.ParseArgs(Args, MAI, MAC);
 
@@ -114,8 +140,8 @@
   EXPECT_EQ("desu", StringRef(ASL[1]));
 }
 
-TEST(Option, ParseWithFlagExclusions) {
-  TestOptTable T;
+TYPED_TEST(OptTableTest, P

[Lldb-commits] [PATCH] D141814: [llvm][ADT] Replace uses of `makeMutableArrayRef` with deduction guides

2023-01-15 Thread serge via Phabricator via lldb-commits
serge-sans-paille added a comment.

LGTM




Comment at: lldb/source/Host/common/NativeProcessProtocol.cpp:652
 
   auto data =
+  llvm::MutableArrayRef(static_cast(buf), bytes_read);

random nit: This could be rewritten as

```
llvm::MutableArrayRef data(static_cast(buf), bytes_read);
```

now


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D141814/new/

https://reviews.llvm.org/D141814

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D142862: [Support] change StringMap hash function from djbHash to xxHash

2023-01-30 Thread serge via Phabricator via lldb-commits
serge-sans-paille added a comment.

Can  you take a shot against https://llvm-compile-time-tracker.com/ so that we 
get an hint of the practical speedup?

Looks like xxhash.h is missing from the patch.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D142862/new/

https://reviews.llvm.org/D142862

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D142862: [Support] change StringMap hash function from djbHash to xxHash

2023-01-30 Thread serge via Phabricator via lldb-commits
serge-sans-paille added a comment.

Do you intend to (optionnaly) provide XXH3 as described in 
https://github.com/Cyan4973/xxHash ?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D142862/new/

https://reviews.llvm.org/D142862

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D142862: [Support] change StringMap hash function from djbHash to xxHash

2023-02-01 Thread serge via Phabricator via lldb-commits
serge-sans-paille added a comment.

https://llvm-compile-time-tracker.com/compare.php?from=1a17739d3aa78599c32f6106e05dcfa7f3f9e823&to=9c1adc5fcca177d6628bdb22c72e7546c7b691aa&stat=instructions:u

looks good to me!


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D142862/new/

https://reviews.llvm.org/D142862

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D134877: [lldb] Fixes for swig-4.1.0 macro definition correction

2022-09-29 Thread serge via Phabricator via lldb-commits
serge-sans-paille created this revision.
serge-sans-paille added reviewers: clayborg, jingham.
Herald added a project: All.
serge-sans-paille requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

For swig-4.1.0 change:

  #2193 -DFOO on the SWIG command line now sets FOO to 1 for
  consistency with C/C++ compiler preprocessors.  Previously
  SWIG set FOO to an empty value.
  
  Existing invocations of SWIG with `-DFOO` where the empty value
  matters can be updated to `-DFOO=` which should work with both
  old and new releases of SWIG.
  
  *** POTENTIAL INCOMPATIBILITY ***

See https://github.com/swig/swig/issues/2193

This patch is backwards compatible with older versions of SWIG.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D134877

Files:
  lldb/bindings/CMakeLists.txt


Index: lldb/bindings/CMakeLists.txt
===
--- lldb/bindings/CMakeLists.txt
+++ lldb/bindings/CMakeLists.txt
@@ -26,8 +26,8 @@
   -features autodoc
   -I${LLDB_SOURCE_DIR}/include
   -I${CMAKE_CURRENT_SOURCE_DIR}
-  -D__STDC_LIMIT_MACROS
-  -D__STDC_CONSTANT_MACROS
+  -D__STDC_LIMIT_MACROS=
+  -D__STDC_CONSTANT_MACROS=
   ${DARWIN_EXTRAS}
 )
 


Index: lldb/bindings/CMakeLists.txt
===
--- lldb/bindings/CMakeLists.txt
+++ lldb/bindings/CMakeLists.txt
@@ -26,8 +26,8 @@
   -features autodoc
   -I${LLDB_SOURCE_DIR}/include
   -I${CMAKE_CURRENT_SOURCE_DIR}
-  -D__STDC_LIMIT_MACROS
-  -D__STDC_CONSTANT_MACROS
+  -D__STDC_LIMIT_MACROS=
+  -D__STDC_CONSTANT_MACROS=
   ${DARWIN_EXTRAS}
 )
 
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D134877: [lldb] Fixes for swig-4.1.0 macro definition correction

2022-09-29 Thread serge via Phabricator via lldb-commits
serge-sans-paille added a comment.

In D134877#3823855 , @labath wrote:

> Looking at https://bugzilla.redhat.com/show_bug.cgi?id=2128646, I'd say that 
> the real bug is that we're defining this macro in two places. How about we 
> leave these definitions as they are, and remove the one at 
> `bindings/interfaces.swig:5` ?

In that case I would advocate for keeping the definition in the header, as it's 
commented (which means adding a definition for __STDC_CONSTANT_MACROS in the 
interface too).


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D134877/new/

https://reviews.llvm.org/D134877

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D134877: [lldb] Get rid of __STDC_LIMIT_MACROS and __STDC_CONSTANT_MACROS

2022-09-29 Thread serge via Phabricator via lldb-commits
serge-sans-paille updated this revision to Diff 463999.
serge-sans-paille retitled this revision from "[lldb] Fixes for swig-4.1.0 
macro definition correction" to "[lldb] Get rid of __STDC_LIMIT_MACROS and 
__STDC_CONSTANT_MACROS".
serge-sans-paille edited the summary of this revision.
serge-sans-paille added a comment.

It turns out that the culprint macro are actually obsolete in C++11, so just 
get rid of them.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D134877/new/

https://reviews.llvm.org/D134877

Files:
  lldb/bindings/CMakeLists.txt
  lldb/bindings/interfaces.swig


Index: lldb/bindings/interfaces.swig
===
--- lldb/bindings/interfaces.swig
+++ lldb/bindings/interfaces.swig
@@ -1,8 +1,5 @@
 /* Various liblldb typedefs that SWIG needs to know about.  */
 #define __extension__ /* Undefine GCC keyword to make Swig happy when 
processing glibc's stdint.h. */
-/* The ISO C99 standard specifies that in C++ implementations limit macros such
-   as INT32_MAX should only be defined if __STDC_LIMIT_MACROS is. */
-#define __STDC_LIMIT_MACROS
 %include "stdint.i"
 
 %include "lldb/lldb-defines.h"
Index: lldb/bindings/CMakeLists.txt
===
--- lldb/bindings/CMakeLists.txt
+++ lldb/bindings/CMakeLists.txt
@@ -26,8 +26,6 @@
   -features autodoc
   -I${LLDB_SOURCE_DIR}/include
   -I${CMAKE_CURRENT_SOURCE_DIR}
-  -D__STDC_LIMIT_MACROS
-  -D__STDC_CONSTANT_MACROS
   ${DARWIN_EXTRAS}
 )
 


Index: lldb/bindings/interfaces.swig
===
--- lldb/bindings/interfaces.swig
+++ lldb/bindings/interfaces.swig
@@ -1,8 +1,5 @@
 /* Various liblldb typedefs that SWIG needs to know about.  */
 #define __extension__ /* Undefine GCC keyword to make Swig happy when processing glibc's stdint.h. */
-/* The ISO C99 standard specifies that in C++ implementations limit macros such
-   as INT32_MAX should only be defined if __STDC_LIMIT_MACROS is. */
-#define __STDC_LIMIT_MACROS
 %include "stdint.i"
 
 %include "lldb/lldb-defines.h"
Index: lldb/bindings/CMakeLists.txt
===
--- lldb/bindings/CMakeLists.txt
+++ lldb/bindings/CMakeLists.txt
@@ -26,8 +26,6 @@
   -features autodoc
   -I${LLDB_SOURCE_DIR}/include
   -I${CMAKE_CURRENT_SOURCE_DIR}
-  -D__STDC_LIMIT_MACROS
-  -D__STDC_CONSTANT_MACROS
   ${DARWIN_EXTRAS}
 )
 
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D134877: [lldb] Get rid of __STDC_LIMIT_MACROS and __STDC_CONSTANT_MACROS

2022-09-30 Thread serge via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG81fc5f7909a4: [lldb] Get rid of __STDC_LIMIT_MACROS and 
__STDC_CONSTANT_MACROS (authored by serge-sans-paille).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D134877/new/

https://reviews.llvm.org/D134877

Files:
  lldb/bindings/CMakeLists.txt
  lldb/bindings/interfaces.swig


Index: lldb/bindings/interfaces.swig
===
--- lldb/bindings/interfaces.swig
+++ lldb/bindings/interfaces.swig
@@ -1,8 +1,5 @@
 /* Various liblldb typedefs that SWIG needs to know about.  */
 #define __extension__ /* Undefine GCC keyword to make Swig happy when 
processing glibc's stdint.h. */
-/* The ISO C99 standard specifies that in C++ implementations limit macros such
-   as INT32_MAX should only be defined if __STDC_LIMIT_MACROS is. */
-#define __STDC_LIMIT_MACROS
 %include "stdint.i"
 
 %include "lldb/lldb-defines.h"
Index: lldb/bindings/CMakeLists.txt
===
--- lldb/bindings/CMakeLists.txt
+++ lldb/bindings/CMakeLists.txt
@@ -26,8 +26,6 @@
   -features autodoc
   -I${LLDB_SOURCE_DIR}/include
   -I${CMAKE_CURRENT_SOURCE_DIR}
-  -D__STDC_LIMIT_MACROS
-  -D__STDC_CONSTANT_MACROS
   ${DARWIN_EXTRAS}
 )
 


Index: lldb/bindings/interfaces.swig
===
--- lldb/bindings/interfaces.swig
+++ lldb/bindings/interfaces.swig
@@ -1,8 +1,5 @@
 /* Various liblldb typedefs that SWIG needs to know about.  */
 #define __extension__ /* Undefine GCC keyword to make Swig happy when processing glibc's stdint.h. */
-/* The ISO C99 standard specifies that in C++ implementations limit macros such
-   as INT32_MAX should only be defined if __STDC_LIMIT_MACROS is. */
-#define __STDC_LIMIT_MACROS
 %include "stdint.i"
 
 %include "lldb/lldb-defines.h"
Index: lldb/bindings/CMakeLists.txt
===
--- lldb/bindings/CMakeLists.txt
+++ lldb/bindings/CMakeLists.txt
@@ -26,8 +26,6 @@
   -features autodoc
   -I${LLDB_SOURCE_DIR}/include
   -I${CMAKE_CURRENT_SOURCE_DIR}
-  -D__STDC_LIMIT_MACROS
-  -D__STDC_CONSTANT_MACROS
   ${DARWIN_EXTRAS}
 )
 
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D125860: [clang] Only use major version in resource dir

2022-11-03 Thread serge via Phabricator via lldb-commits
serge-sans-paille added a comment.

The consensus in the discourse thread you mention is not super strong, but I 
tend to agree with that patch. +1 for me.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D125860/new/

https://reviews.llvm.org/D125860

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D104856: [lldb] replace gethostbyname call by getaddrinfo

2021-06-24 Thread serge via Phabricator via lldb-commits
serge-sans-paille created this revision.
serge-sans-paille requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

According to the manpage

  The gethostbyname*() and gethostbyaddr*() functions are obsolete. Applications
  should use getaddrinfo(3) and getnameinfo(3) instead.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D104856

Files:
  lldb/tools/debugserver/source/RNBSocket.cpp


Index: lldb/tools/debugserver/source/RNBSocket.cpp
===
--- lldb/tools/debugserver/source/RNBSocket.cpp
+++ lldb/tools/debugserver/source/RNBSocket.cpp
@@ -50,10 +50,9 @@
 if (inet_pton_result == 1)
   return true;
 
-struct hostent *host_entry = gethostbyname(hostname);
-if (host_entry) {
-  std::string ip_str(
-  ::inet_ntoa(*(struct in_addr *)*host_entry->h_addr_list));
+struct addrinfo *addr = nullptr;
+if (getaddrinfo(hostname, nullptr, 0, &addr) == 0) {
+  std::string ip_str(::inet_ntoa(addr->ai_addr->sin_addr);
   inet_pton_result = ::inet_pton(AF_INET, ip_str.c_str(), &addr);
   if (inet_pton_result == 1)
 return true;


Index: lldb/tools/debugserver/source/RNBSocket.cpp
===
--- lldb/tools/debugserver/source/RNBSocket.cpp
+++ lldb/tools/debugserver/source/RNBSocket.cpp
@@ -50,10 +50,9 @@
 if (inet_pton_result == 1)
   return true;
 
-struct hostent *host_entry = gethostbyname(hostname);
-if (host_entry) {
-  std::string ip_str(
-  ::inet_ntoa(*(struct in_addr *)*host_entry->h_addr_list));
+struct addrinfo *addr = nullptr;
+if (getaddrinfo(hostname, nullptr, 0, &addr) == 0) {
+  std::string ip_str(::inet_ntoa(addr->ai_addr->sin_addr);
   inet_pton_result = ::inet_pton(AF_INET, ip_str.c_str(), &addr);
   if (inet_pton_result == 1)
 return true;
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D104856: [NFC] Remove unreferenced function ResolveIPV4HostName

2021-06-25 Thread serge via Phabricator via lldb-commits
serge-sans-paille updated this revision to Diff 354443.
serge-sans-paille retitled this revision from "[lldb] replace gethostbyname 
call by getaddrinfo" to "[NFC] Remove unreferenced function 
ResolveIPV4HostName".
serge-sans-paille edited the summary of this revision.
serge-sans-paille added a comment.

Just remove the function


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D104856/new/

https://reviews.llvm.org/D104856

Files:
  lldb/tools/debugserver/source/RNBSocket.cpp


Index: lldb/tools/debugserver/source/RNBSocket.cpp
===
--- lldb/tools/debugserver/source/RNBSocket.cpp
+++ lldb/tools/debugserver/source/RNBSocket.cpp
@@ -30,38 +30,6 @@
 #include "lockdown.h"
 #endif
 
-/* Once we have a RNBSocket object with a port # specified,
-   this function is called to wait for an incoming connection.
-   This function blocks while waiting for that connection.  */
-
-bool ResolveIPV4HostName(const char *hostname, in_addr_t &addr) {
-  if (hostname == NULL || hostname[0] == '\0' ||
-  strcmp(hostname, "localhost") == 0 ||
-  strcmp(hostname, "127.0.0.1") == 0) {
-addr = htonl(INADDR_LOOPBACK);
-return true;
-  } else if (strcmp(hostname, "*") == 0) {
-addr = htonl(INADDR_ANY);
-return true;
-  } else {
-// See if an IP address was specified as numbers
-int inet_pton_result = ::inet_pton(AF_INET, hostname, &addr);
-
-if (inet_pton_result == 1)
-  return true;
-
-struct hostent *host_entry = gethostbyname(hostname);
-if (host_entry) {
-  std::string ip_str(
-  ::inet_ntoa(*(struct in_addr *)*host_entry->h_addr_list));
-  inet_pton_result = ::inet_pton(AF_INET, ip_str.c_str(), &addr);
-  if (inet_pton_result == 1)
-return true;
-}
-  }
-  return false;
-}
-
 rnb_err_t RNBSocket::Listen(const char *listen_host, uint16_t port,
 PortBoundCallback callback,
 const void *callback_baton) {


Index: lldb/tools/debugserver/source/RNBSocket.cpp
===
--- lldb/tools/debugserver/source/RNBSocket.cpp
+++ lldb/tools/debugserver/source/RNBSocket.cpp
@@ -30,38 +30,6 @@
 #include "lockdown.h"
 #endif
 
-/* Once we have a RNBSocket object with a port # specified,
-   this function is called to wait for an incoming connection.
-   This function blocks while waiting for that connection.  */
-
-bool ResolveIPV4HostName(const char *hostname, in_addr_t &addr) {
-  if (hostname == NULL || hostname[0] == '\0' ||
-  strcmp(hostname, "localhost") == 0 ||
-  strcmp(hostname, "127.0.0.1") == 0) {
-addr = htonl(INADDR_LOOPBACK);
-return true;
-  } else if (strcmp(hostname, "*") == 0) {
-addr = htonl(INADDR_ANY);
-return true;
-  } else {
-// See if an IP address was specified as numbers
-int inet_pton_result = ::inet_pton(AF_INET, hostname, &addr);
-
-if (inet_pton_result == 1)
-  return true;
-
-struct hostent *host_entry = gethostbyname(hostname);
-if (host_entry) {
-  std::string ip_str(
-  ::inet_ntoa(*(struct in_addr *)*host_entry->h_addr_list));
-  inet_pton_result = ::inet_pton(AF_INET, ip_str.c_str(), &addr);
-  if (inet_pton_result == 1)
-return true;
-}
-  }
-  return false;
-}
-
 rnb_err_t RNBSocket::Listen(const char *listen_host, uint16_t port,
 PortBoundCallback callback,
 const void *callback_baton) {
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D104856: [NFC] Remove unreferenced function ResolveIPV4HostName

2021-06-25 Thread serge via Phabricator via lldb-commits
serge-sans-paille added a comment.

What a simpler patch!


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D104856/new/

https://reviews.llvm.org/D104856

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D104856: [NFC] Remove unreferenced function ResolveIPV4HostName

2021-06-25 Thread serge via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGf7b1fa6f5ebe: [NFC] remove unreferenced function 
ResolveIPV4HostName (authored by serge-sans-paille).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D104856/new/

https://reviews.llvm.org/D104856

Files:
  lldb/tools/debugserver/source/RNBSocket.cpp


Index: lldb/tools/debugserver/source/RNBSocket.cpp
===
--- lldb/tools/debugserver/source/RNBSocket.cpp
+++ lldb/tools/debugserver/source/RNBSocket.cpp
@@ -30,38 +30,6 @@
 #include "lockdown.h"
 #endif
 
-/* Once we have a RNBSocket object with a port # specified,
-   this function is called to wait for an incoming connection.
-   This function blocks while waiting for that connection.  */
-
-bool ResolveIPV4HostName(const char *hostname, in_addr_t &addr) {
-  if (hostname == NULL || hostname[0] == '\0' ||
-  strcmp(hostname, "localhost") == 0 ||
-  strcmp(hostname, "127.0.0.1") == 0) {
-addr = htonl(INADDR_LOOPBACK);
-return true;
-  } else if (strcmp(hostname, "*") == 0) {
-addr = htonl(INADDR_ANY);
-return true;
-  } else {
-// See if an IP address was specified as numbers
-int inet_pton_result = ::inet_pton(AF_INET, hostname, &addr);
-
-if (inet_pton_result == 1)
-  return true;
-
-struct hostent *host_entry = gethostbyname(hostname);
-if (host_entry) {
-  std::string ip_str(
-  ::inet_ntoa(*(struct in_addr *)*host_entry->h_addr_list));
-  inet_pton_result = ::inet_pton(AF_INET, ip_str.c_str(), &addr);
-  if (inet_pton_result == 1)
-return true;
-}
-  }
-  return false;
-}
-
 rnb_err_t RNBSocket::Listen(const char *listen_host, uint16_t port,
 PortBoundCallback callback,
 const void *callback_baton) {


Index: lldb/tools/debugserver/source/RNBSocket.cpp
===
--- lldb/tools/debugserver/source/RNBSocket.cpp
+++ lldb/tools/debugserver/source/RNBSocket.cpp
@@ -30,38 +30,6 @@
 #include "lockdown.h"
 #endif
 
-/* Once we have a RNBSocket object with a port # specified,
-   this function is called to wait for an incoming connection.
-   This function blocks while waiting for that connection.  */
-
-bool ResolveIPV4HostName(const char *hostname, in_addr_t &addr) {
-  if (hostname == NULL || hostname[0] == '\0' ||
-  strcmp(hostname, "localhost") == 0 ||
-  strcmp(hostname, "127.0.0.1") == 0) {
-addr = htonl(INADDR_LOOPBACK);
-return true;
-  } else if (strcmp(hostname, "*") == 0) {
-addr = htonl(INADDR_ANY);
-return true;
-  } else {
-// See if an IP address was specified as numbers
-int inet_pton_result = ::inet_pton(AF_INET, hostname, &addr);
-
-if (inet_pton_result == 1)
-  return true;
-
-struct hostent *host_entry = gethostbyname(hostname);
-if (host_entry) {
-  std::string ip_str(
-  ::inet_ntoa(*(struct in_addr *)*host_entry->h_addr_list));
-  inet_pton_result = ::inet_pton(AF_INET, ip_str.c_str(), &addr);
-  if (inet_pton_result == 1)
-return true;
-}
-  }
-  return false;
-}
-
 rnb_err_t RNBSocket::Listen(const char *listen_host, uint16_t port,
 PortBoundCallback callback,
 const void *callback_baton) {
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D69230: RFC: specialized Optional for T that can represent its own invalid state

2019-10-21 Thread serge via Phabricator via lldb-commits
serge-sans-paille added a comment.

(keeping the ball rolling) lYou want to exploit the presence of a sentinel in 
the domain of values of a given type. Maybe make that explicit through the 
method naming instead of using the `isValid` theme.

Some bibliography on the subject: 
https://groups.google.com/a/isocpp.org/forum/#!topic/std-proposals/46J1onhWJ-s/discussion.

On a personal note, as much as I like the idea (and I really do like it), I'd 
rather have llvm::optional sticking to std::optional interface.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69230/new/

https://reviews.llvm.org/D69230



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D69230: RFC: specialized Optional for T that can represent its own invalid state

2019-10-22 Thread serge via Phabricator via lldb-commits
serge-sans-paille added inline comments.



Comment at: llvm/include/llvm/ADT/Optional.h:216
+  OptionalStorage &operator=(T const &y) {
+assert(Info::is_valid(y));
+value = y;

Slight note (borrowed from [this 
thread](https://groups.google.com/a/isocpp.org/forum/#!topic/std-proposals/46J1onhWJ-s/discussion).

This implementation, compared to the generic one, is not type-safe and relies 
on an assert on `y` to check whether it's the sentinel or not. This is a slight 
change that may matter (somehow trading type-safety for performance).

Possible exploration path: if the sentinel has its own type (e.g. 
std::nullptr_t) we somehow improve type safety, but still don't have the same 
guarantee as the generic implementation.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69230/new/

https://reviews.llvm.org/D69230



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D69793: Bundle libedit-compatible readline replacement

2019-11-04 Thread serge via Phabricator via lldb-commits
serge-sans-paille created this revision.
serge-sans-paille added reviewers: labath, JDevlieghere.
serge-sans-paille added a project: LLDB.
Herald added subscribers: lldb-commits, mgorny.

Fix https://bugs.llvm.org/show_bug.cgi?id=43830 while avoiding polluting the 
global Python namespace.

This both reverts r357277 to rebundle a version of Python's readline module 
based on libedit.

However, this patch also provides two improvements over the previous 
implementation:

1. use PyMem_RawMalloc instead of PyMem_Malloc, as expected by PyOS_Readline 
(prevents to segfault upon exit of interactive session)
2. patch the readline module upon embedded interpreter loading, instead of 
patching it globally, which should prevent any side effect on other 
modules/packages


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D69793

Files:
  lldb/source/Plugins/ScriptInterpreter/Python/CMakeLists.txt
  lldb/source/Plugins/ScriptInterpreter/Python/PythonReadline.cpp
  lldb/source/Plugins/ScriptInterpreter/Python/PythonReadline.h
  lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp

Index: lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
===
--- lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
+++ lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
@@ -17,6 +17,7 @@
 
 #include "PythonDataObjects.h"
 #include "PythonExceptionState.h"
+#include "PythonReadline.h"
 #include "ScriptInterpreterPythonImpl.h"
 
 #include "lldb/API/SBFrame.h"
@@ -207,6 +208,20 @@
 
 InitializePythonHome();
 
+// Python's readline is incompatible with libedit being linked into lldb.
+// Provide a patched version local to the embedded interpreter.
+bool ReadlinePatched = false;
+for (auto *p = PyImport_Inittab; p->name != NULL; p++) {
+  if (strcmp(p->name, "readline") == 0) {
+p->initfunc = initlldb_readline;
+break;
+  }
+}
+if (!ReadlinePatched) {
+  PyImport_AppendInittab("readline", initlldb_readline);
+  ReadlinePatched = true;
+}
+
 // Register _lldb as a built-in module.
 PyImport_AppendInittab("_lldb", LLDBSwigPyInit);
 
Index: lldb/source/Plugins/ScriptInterpreter/Python/PythonReadline.h
===
--- /dev/null
+++ lldb/source/Plugins/ScriptInterpreter/Python/PythonReadline.h
@@ -0,0 +1,15 @@
+//===-- PythonReadline.h ---*- C++
+//-*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#ifndef LLDB_PLUGINS_SCRIPTINTERPRETER_PYTHON_PYTHONREADLINE_H
+#define LLDB_PLUGINS_SCRIPTINTERPRETER_PYTHON_PYTHONREADLINE_H
+
+extern "C" PyMODINIT_FUNC initlldb_readline(void);
+
+#endif // LLDB_PLUGINS_SCRIPTINTERPRETER_PYTHON_PYTHONREADLINE_H
Index: lldb/source/Plugins/ScriptInterpreter/Python/PythonReadline.cpp
===
--- /dev/null
+++ lldb/source/Plugins/ScriptInterpreter/Python/PythonReadline.cpp
@@ -0,0 +1,89 @@
+// NOTE: Since Python may define some pre-processor definitions which affect the
+// standard headers on some systems, you must include Python.h before any
+// standard headers are included.
+#include "Python.h"
+
+#include 
+
+#ifndef LLDB_DISABLE_LIBEDIT
+#include 
+#endif
+
+// Simple implementation of the Python readline module using libedit.
+// In the event that libedit is excluded from the build, this turns
+// back into a null implementation that blocks the module from pulling
+// in the GNU readline shared lib, which causes linkage confusion when
+// both readline and libedit's readline compatibility symbols collide.
+//
+// Currently it only installs a PyOS_ReadlineFunctionPointer, without
+// implementing any of the readline module methods. This is meant to
+// work around LLVM pr18841 to avoid seg faults in the stock Python
+// readline.so linked against GNU readline.
+
+#ifndef LLDB_DISABLE_LIBEDIT
+PyDoc_STRVAR(moduleDocumentation,
+ "Simple readline module implementation based on libedit.");
+#else
+PyDoc_STRVAR(moduleDocumentation,
+ "Stub module meant to avoid linking GNU readline.");
+#endif
+
+#if PY_MAJOR_VERSION >= 3
+static struct PyModuleDef readline_module = {
+PyModuleDef_HEAD_INIT, // m_base
+"lldb_editline",   // m_name
+moduleDocumentation,   // m_doc
+-1,// m_size
+nullptr,   // m_methods
+nullptr,   // m_reload
+nullptr,   // m_traverse
+nullptr,   // m_clear
+nullptr,   // m_free
+};
+#else
+static struct PyMethodDef moduleMetho

[Lldb-commits] [PATCH] D69793: Bundle libedit-compatible readline replacement

2019-11-04 Thread serge via Phabricator via lldb-commits
serge-sans-paille updated this revision to Diff 227695.
serge-sans-paille edited the summary of this revision.

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69793/new/

https://reviews.llvm.org/D69793

Files:
  lldb/source/Plugins/ScriptInterpreter/Python/CMakeLists.txt
  lldb/source/Plugins/ScriptInterpreter/Python/PythonReadline.cpp
  lldb/source/Plugins/ScriptInterpreter/Python/PythonReadline.h
  lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp

Index: lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
===
--- lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
+++ lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
@@ -17,6 +17,7 @@
 
 #include "PythonDataObjects.h"
 #include "PythonExceptionState.h"
+#include "PythonReadline.h"
 #include "ScriptInterpreterPythonImpl.h"
 
 #include "lldb/API/SBFrame.h"
@@ -207,6 +208,22 @@
 
 InitializePythonHome();
 
+#ifndef LLDB_DISABLE_LIBEDIT
+// Python's readline is incompatible with libedit being linked into lldb.
+// Provide a patched version local to the embedded interpreter.
+bool ReadlinePatched = false;
+for (auto *p = PyImport_Inittab; p->name != NULL; p++) {
+  if (strcmp(p->name, "readline") == 0) {
+p->initfunc = initlldb_readline;
+break;
+  }
+}
+if (!ReadlinePatched) {
+  PyImport_AppendInittab("readline", initlldb_readline);
+  ReadlinePatched = true;
+}
+#endif
+
 // Register _lldb as a built-in module.
 PyImport_AppendInittab("_lldb", LLDBSwigPyInit);
 
Index: lldb/source/Plugins/ScriptInterpreter/Python/PythonReadline.h
===
--- /dev/null
+++ lldb/source/Plugins/ScriptInterpreter/Python/PythonReadline.h
@@ -0,0 +1,17 @@
+//===-- PythonReadline.h ---*- C++
+//-*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#ifndef LLDB_PLUGINS_SCRIPTINTERPRETER_PYTHON_PYTHONREADLINE_H
+#define LLDB_PLUGINS_SCRIPTINTERPRETER_PYTHON_PYTHONREADLINE_H
+
+#ifndef LLDB_DISABLE_LIBEDIT
+extern "C" PyMODINIT_FUNC initlldb_readline(void);
+#endif
+
+#endif // LLDB_PLUGINS_SCRIPTINTERPRETER_PYTHON_PYTHONREADLINE_H
Index: lldb/source/Plugins/ScriptInterpreter/Python/PythonReadline.cpp
===
--- /dev/null
+++ lldb/source/Plugins/ScriptInterpreter/Python/PythonReadline.cpp
@@ -0,0 +1,93 @@
+#ifdef LLDB_DISABLE_LIBEDIT
+
+// no need to hack into Python's readline module if libedit isn't used.
+
+#else
+// NOTE: Since Python may define some pre-processor definitions which affect the
+// standard headers on some systems, you must include Python.h before any
+// standard headers are included.
+#include "Python.h"
+
+#include 
+
+#include 
+
+// Simple implementation of the Python readline module using libedit.
+// In the event that libedit is excluded from the build, this turns
+// back into a null implementation that blocks the module from pulling
+// in the GNU readline shared lib, which causes linkage confusion when
+// both readline and libedit's readline compatibility symbols collide.
+//
+// Currently it only installs a PyOS_ReadlineFunctionPointer, without
+// implementing any of the readline module methods. This is meant to
+// work around LLVM pr18841 to avoid seg faults in the stock Python
+// readline.so linked against GNU readline.
+
+#ifndef LLDB_DISABLE_LIBEDIT
+PyDoc_STRVAR(moduleDocumentation,
+ "Simple readline module implementation based on libedit.");
+#else
+PyDoc_STRVAR(moduleDocumentation,
+ "Stub module meant to avoid linking GNU readline.");
+#endif
+
+#if PY_MAJOR_VERSION >= 3
+static struct PyModuleDef readline_module = {
+PyModuleDef_HEAD_INIT, // m_base
+"lldb_editline",   // m_name
+moduleDocumentation,   // m_doc
+-1,// m_size
+nullptr,   // m_methods
+nullptr,   // m_reload
+nullptr,   // m_traverse
+nullptr,   // m_clear
+nullptr,   // m_free
+};
+#else
+static struct PyMethodDef moduleMethods[] = {{nullptr, nullptr, 0, nullptr}};
+#endif
+
+#ifndef LLDB_DISABLE_LIBEDIT
+static char *
+#if PY_MAJOR_VERSION >= 3
+simple_readline(FILE *stdin, FILE *stdout, const char *prompt)
+#else
+simple_readline(FILE *stdin, FILE *stdout, char *prompt)
+#endif
+{
+  rl_instream = stdin;
+  rl_outstream = stdout;
+  char *line = readline(prompt);
+  if (!line) {
+char *ret = (char *)PyMem_RawMalloc(1);
+if (ret != NULL)
+  *ret = 

[Lldb-commits] [PATCH] D69793: Bundle libedit-compatible readline replacement

2019-11-04 Thread serge via Phabricator via lldb-commits
serge-sans-paille marked 2 inline comments as done.
serge-sans-paille added inline comments.



Comment at: lldb/source/Plugins/ScriptInterpreter/Python/PythonReadline.h:13-15
+#ifndef LLDB_DISABLE_LIBEDIT
+extern "C" PyMODINIT_FUNC initlldb_readline(void);
+#endif

labath wrote:
> How about if this file just exposes a single function like 
> `WorkAroundLibeditIncompatibilityIfNeeded`? Then this function can be just a 
> no-op if no work is needed, and there's no need for messy ifdefs anywhere...
I somehow achieved the same by centralizing the messy ifdefs in one explicit 
name :-)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69793/new/

https://reviews.llvm.org/D69793



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D69793: Bundle libedit-compatible readline replacement

2019-11-04 Thread serge via Phabricator via lldb-commits
serge-sans-paille updated this revision to Diff 227821.
serge-sans-paille marked 4 inline comments as done.

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69793/new/

https://reviews.llvm.org/D69793

Files:
  lldb/source/Plugins/ScriptInterpreter/Python/CMakeLists.txt
  lldb/source/Plugins/ScriptInterpreter/Python/PythonReadline.cpp
  lldb/source/Plugins/ScriptInterpreter/Python/PythonReadline.h
  lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp

Index: lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
===
--- lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
+++ lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
@@ -17,6 +17,7 @@
 
 #include "PythonDataObjects.h"
 #include "PythonExceptionState.h"
+#include "PythonReadline.h"
 #include "ScriptInterpreterPythonImpl.h"
 
 #include "lldb/API/SBFrame.h"
@@ -207,6 +208,22 @@
 
 InitializePythonHome();
 
+#ifdef LLDB_USE_LIBEDIT_READLINE_COMPAT_MODULE
+// Python's readline is incompatible with libedit being linked into lldb.
+// Provide a patched version local to the embedded interpreter.
+bool ReadlinePatched = false;
+for (auto *p = PyImport_Inittab; p->name != NULL; p++) {
+  if (strcmp(p->name, "readline") == 0) {
+p->initfunc = initlldb_readline;
+break;
+  }
+}
+if (!ReadlinePatched) {
+  PyImport_AppendInittab("readline", initlldb_readline);
+  ReadlinePatched = true;
+}
+#endif
+
 // Register _lldb as a built-in module.
 PyImport_AppendInittab("_lldb", LLDBSwigPyInit);
 
Index: lldb/source/Plugins/ScriptInterpreter/Python/PythonReadline.h
===
--- /dev/null
+++ lldb/source/Plugins/ScriptInterpreter/Python/PythonReadline.h
@@ -0,0 +1,26 @@
+//===-- PythonReadline.h *- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#ifndef LLDB_PLUGINS_SCRIPTINTERPRETER_PYTHON_PYTHONREADLINE_H
+#define LLDB_PLUGINS_SCRIPTINTERPRETER_PYTHON_PYTHONREADLINE_H
+
+#if !defined(LLDB_DISABLE_LIBEDIT) && !defined(__APPLE__)
+// NOTE: Since Python may define some pre-processor definitions which affect the
+// standard headers on some systems, you must include Python.h before any
+// standard headers are included.
+#include "Python.h"
+
+// no need to hack into Python's readline module if libedit isn't used.
+//
+#define LLDB_USE_LIBEDIT_READLINE_COMPAT_MODULE 1
+
+extern "C" PyMODINIT_FUNC initlldb_readline(void);
+
+#endif
+
+#endif // LLDB_PLUGINS_SCRIPTINTERPRETER_PYTHON_PYTHONREADLINE_H
Index: lldb/source/Plugins/ScriptInterpreter/Python/PythonReadline.cpp
===
--- /dev/null
+++ lldb/source/Plugins/ScriptInterpreter/Python/PythonReadline.cpp
@@ -0,0 +1,78 @@
+#include "PythonReadline.h"
+
+#ifdef LLDB_USE_LIBEDIT_READLINE_COMPAT_MODULE
+
+#include 
+
+#include 
+
+// Simple implementation of the Python readline module using libedit.
+// In the event that libedit is excluded from the build, this turns
+// back into a null implementation that blocks the module from pulling
+// in the GNU readline shared lib, which causes linkage confusion when
+// both readline and libedit's readline compatibility symbols collide.
+//
+// Currently it only installs a PyOS_ReadlineFunctionPointer, without
+// implementing any of the readline module methods. This is meant to
+// work around LLVM pr18841 to avoid seg faults in the stock Python
+// readline.so linked against GNU readline.
+
+PyDoc_STRVAR(moduleDocumentation,
+ "Simple readline module implementation based on libedit.");
+
+#if PY_MAJOR_VERSION >= 3
+static struct PyModuleDef readline_module = {
+PyModuleDef_HEAD_INIT, // m_base
+"lldb_editline",   // m_name
+moduleDocumentation,   // m_doc
+-1,// m_size
+nullptr,   // m_methods
+nullptr,   // m_reload
+nullptr,   // m_traverse
+nullptr,   // m_clear
+nullptr,   // m_free
+};
+#else
+static struct PyMethodDef moduleMethods[] = {{nullptr, nullptr, 0, nullptr}};
+#endif
+
+static char *
+#if PY_MAJOR_VERSION >= 3
+simple_readline(FILE *stdin, FILE *stdout, const char *prompt)
+#else
+simple_readline(FILE *stdin, FILE *stdout, char *prompt)
+#endif
+{
+  rl_instream = stdin;
+  rl_outstream = stdout;
+  char *line = readline(prompt);
+  if (!line) {
+char *ret = (char *)PyMem_RawMalloc(1);
+if (ret != NULL)
+  *ret = '\0';
+return ret;
+  }
+  if (*lin

[Lldb-commits] [PATCH] D69793: Bundle libedit-compatible readline replacement

2019-11-05 Thread serge via Phabricator via lldb-commits
serge-sans-paille updated this revision to Diff 227823.
serge-sans-paille marked an inline comment as done.

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69793/new/

https://reviews.llvm.org/D69793

Files:
  lldb/source/Plugins/ScriptInterpreter/Python/CMakeLists.txt
  lldb/source/Plugins/ScriptInterpreter/Python/PythonReadline.cpp
  lldb/source/Plugins/ScriptInterpreter/Python/PythonReadline.h
  lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp

Index: lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
===
--- lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
+++ lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
@@ -17,6 +17,7 @@
 
 #include "PythonDataObjects.h"
 #include "PythonExceptionState.h"
+#include "PythonReadline.h"
 #include "ScriptInterpreterPythonImpl.h"
 
 #include "lldb/API/SBFrame.h"
@@ -207,6 +208,22 @@
 
 InitializePythonHome();
 
+#ifdef LLDB_USE_LIBEDIT_READLINE_COMPAT_MODULE
+// Python's readline is incompatible with libedit being linked into lldb.
+// Provide a patched version local to the embedded interpreter.
+bool ReadlinePatched = false;
+for (auto *p = PyImport_Inittab; p->name != NULL; p++) {
+  if (strcmp(p->name, "readline") == 0) {
+p->initfunc = initlldb_readline;
+break;
+  }
+}
+if (!ReadlinePatched) {
+  PyImport_AppendInittab("readline", initlldb_readline);
+  ReadlinePatched = true;
+}
+#endif
+
 // Register _lldb as a built-in module.
 PyImport_AppendInittab("_lldb", LLDBSwigPyInit);
 
Index: lldb/source/Plugins/ScriptInterpreter/Python/PythonReadline.h
===
--- /dev/null
+++ lldb/source/Plugins/ScriptInterpreter/Python/PythonReadline.h
@@ -0,0 +1,26 @@
+//===-- PythonReadline.h *- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#ifndef LLDB_PLUGINS_SCRIPTINTERPRETER_PYTHON_PYTHONREADLINE_H
+#define LLDB_PLUGINS_SCRIPTINTERPRETER_PYTHON_PYTHONREADLINE_H
+
+#if !defined(LLDB_DISABLE_LIBEDIT) && !defined(__APPLE__)
+// NOTE: Since Python may define some pre-processor definitions which affect the
+// standard headers on some systems, you must include Python.h before any
+// standard headers are included.
+#include "Python.h"
+
+// no need to hack into Python's readline module if libedit isn't used.
+//
+#define LLDB_USE_LIBEDIT_READLINE_COMPAT_MODULE 1
+
+extern "C" PyMODINIT_FUNC initlldb_readline(void);
+
+#endif
+
+#endif // LLDB_PLUGINS_SCRIPTINTERPRETER_PYTHON_PYTHONREADLINE_H
Index: lldb/source/Plugins/ScriptInterpreter/Python/PythonReadline.cpp
===
--- /dev/null
+++ lldb/source/Plugins/ScriptInterpreter/Python/PythonReadline.cpp
@@ -0,0 +1,80 @@
+#include "PythonReadline.h"
+
+#ifdef LLDB_USE_LIBEDIT_READLINE_COMPAT_MODULE
+
+#include 
+
+#include 
+
+// Simple implementation of the Python readline module using libedit.
+// In the event that libedit is excluded from the build, this turns
+// back into a null implementation that blocks the module from pulling
+// in the GNU readline shared lib, which causes linkage confusion when
+// both readline and libedit's readline compatibility symbols collide.
+//
+// Currently it only installs a PyOS_ReadlineFunctionPointer, without
+// implementing any of the readline module methods. This is meant to
+// work around LLVM pr18841 to avoid seg faults in the stock Python
+// readline.so linked against GNU readline.
+//
+// Bug on the cpython side: https://bugs.python.org/issue38634
+
+PyDoc_STRVAR(moduleDocumentation,
+ "Simple readline module implementation based on libedit.");
+
+#if PY_MAJOR_VERSION >= 3
+static struct PyModuleDef readline_module = {
+PyModuleDef_HEAD_INIT, // m_base
+"lldb_editline",   // m_name
+moduleDocumentation,   // m_doc
+-1,// m_size
+nullptr,   // m_methods
+nullptr,   // m_reload
+nullptr,   // m_traverse
+nullptr,   // m_clear
+nullptr,   // m_free
+};
+#else
+static struct PyMethodDef moduleMethods[] = {{nullptr, nullptr, 0, nullptr}};
+#endif
+
+static char *
+#if PY_MAJOR_VERSION >= 3
+simple_readline(FILE *stdin, FILE *stdout, const char *prompt)
+#else
+simple_readline(FILE *stdin, FILE *stdout, char *prompt)
+#endif
+{
+  rl_instream = stdin;
+  rl_outstream = stdout;
+  char *line = readline(prompt);
+  if (!line) {
+char *ret = (char *)PyMem_RawMalloc(1);
+if

[Lldb-commits] [PATCH] D69793: Bundle libedit-compatible readline replacement

2019-11-05 Thread serge via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG9357b5d08497: Revert and patch "[Python] Remove 
readline module" (authored by serge-sans-paille).

Changed prior to commit:
  https://reviews.llvm.org/D69793?vs=227823&id=227834#toc

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69793/new/

https://reviews.llvm.org/D69793

Files:
  lldb/source/Plugins/ScriptInterpreter/Python/CMakeLists.txt
  lldb/source/Plugins/ScriptInterpreter/Python/PythonReadline.cpp
  lldb/source/Plugins/ScriptInterpreter/Python/PythonReadline.h
  lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp

Index: lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
===
--- lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
+++ lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
@@ -16,6 +16,7 @@
 #include "lldb-python.h"
 
 #include "PythonDataObjects.h"
+#include "PythonReadline.h"
 #include "ScriptInterpreterPythonImpl.h"
 
 #include "lldb/API/SBFrame.h"
@@ -217,6 +218,22 @@
 
 InitializePythonHome();
 
+#ifdef LLDB_USE_LIBEDIT_READLINE_COMPAT_MODULE
+// Python's readline is incompatible with libedit being linked into lldb.
+// Provide a patched version local to the embedded interpreter.
+bool ReadlinePatched = false;
+for (auto *p = PyImport_Inittab; p->name != NULL; p++) {
+  if (strcmp(p->name, "readline") == 0) {
+p->initfunc = initlldb_readline;
+break;
+  }
+}
+if (!ReadlinePatched) {
+  PyImport_AppendInittab("readline", initlldb_readline);
+  ReadlinePatched = true;
+}
+#endif
+
 // Register _lldb as a built-in module.
 PyImport_AppendInittab("_lldb", LLDBSwigPyInit);
 
Index: lldb/source/Plugins/ScriptInterpreter/Python/PythonReadline.h
===
--- /dev/null
+++ lldb/source/Plugins/ScriptInterpreter/Python/PythonReadline.h
@@ -0,0 +1,26 @@
+//===-- PythonReadline.h *- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#ifndef LLDB_PLUGINS_SCRIPTINTERPRETER_PYTHON_PYTHONREADLINE_H
+#define LLDB_PLUGINS_SCRIPTINTERPRETER_PYTHON_PYTHONREADLINE_H
+
+#if !defined(LLDB_DISABLE_LIBEDIT) && !defined(__APPLE__)
+// NOTE: Since Python may define some pre-processor definitions which affect the
+// standard headers on some systems, you must include Python.h before any
+// standard headers are included.
+#include "Python.h"
+
+// no need to hack into Python's readline module if libedit isn't used.
+//
+#define LLDB_USE_LIBEDIT_READLINE_COMPAT_MODULE 1
+
+extern "C" PyMODINIT_FUNC initlldb_readline(void);
+
+#endif
+
+#endif // LLDB_PLUGINS_SCRIPTINTERPRETER_PYTHON_PYTHONREADLINE_H
Index: lldb/source/Plugins/ScriptInterpreter/Python/PythonReadline.cpp
===
--- /dev/null
+++ lldb/source/Plugins/ScriptInterpreter/Python/PythonReadline.cpp
@@ -0,0 +1,80 @@
+#include "PythonReadline.h"
+
+#ifdef LLDB_USE_LIBEDIT_READLINE_COMPAT_MODULE
+
+#include 
+
+#include 
+
+// Simple implementation of the Python readline module using libedit.
+// In the event that libedit is excluded from the build, this turns
+// back into a null implementation that blocks the module from pulling
+// in the GNU readline shared lib, which causes linkage confusion when
+// both readline and libedit's readline compatibility symbols collide.
+//
+// Currently it only installs a PyOS_ReadlineFunctionPointer, without
+// implementing any of the readline module methods. This is meant to
+// work around LLVM pr18841 to avoid seg faults in the stock Python
+// readline.so linked against GNU readline.
+//
+// Bug on the cpython side: https://bugs.python.org/issue38634
+
+PyDoc_STRVAR(moduleDocumentation,
+ "Simple readline module implementation based on libedit.");
+
+#if PY_MAJOR_VERSION >= 3
+static struct PyModuleDef readline_module = {
+PyModuleDef_HEAD_INIT, // m_base
+"lldb_editline",   // m_name
+moduleDocumentation,   // m_doc
+-1,// m_size
+nullptr,   // m_methods
+nullptr,   // m_reload
+nullptr,   // m_traverse
+nullptr,   // m_clear
+nullptr,   // m_free
+};
+#else
+static struct PyMethodDef moduleMethods[] = {{nullptr, nullptr, 0, nullptr}};
+#endif
+
+static char *
+#if PY_MAJOR_VERSION >= 3
+simple_readline(FILE *stdin, FILE *stdout, const char *prompt)
+#else
+simple_readline(FILE *stdin, FILE *stdout, char *prompt)
+#en

[Lldb-commits] [PATCH] D69793: Bundle libedit-compatible readline replacement

2019-11-05 Thread serge via Phabricator via lldb-commits
serge-sans-paille added a comment.

In D69793#1733672 , @labath wrote:

> > 1. use PyMem_RawMalloc instead of PyMem_Malloc, as expected by 
> > PyOS_Readline (prevents to segfault upon exit of interactive session)
>
> It looks like this is failing on python2, because it has no RawMalloc 
> function https://docs.python.org/2.7/c-api/memory.html. I guess this bit 
> should be `#ifdef PY2` ?


Should be fixed by 590498829d8c0d4f4f673569949fa3850485c9c, at least this one 
make it work for both py2 and py3 on my laptop.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69793/new/

https://reviews.llvm.org/D69793



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D69846: [lldb] [Python] Build readline override module only on Linux

2019-11-05 Thread serge via Phabricator via lldb-commits
serge-sans-paille added a comment.

Thanks for the fix o/


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69846/new/

https://reviews.llvm.org/D69846



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D67230: Remove call to obsolete gethostbyname, using getaddrinfo

2019-09-05 Thread serge via Phabricator via lldb-commits
serge-sans-paille created this revision.
serge-sans-paille added a reviewer: k8stone.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

>From the man page:

> The  gethostbyname*()  and  gethostbyaddr*()  functions  are  obsolete.
>  Applications should use getaddrinfo(3) and getnameinfo(3) instead.

That's what I did, using the canonical name as a relevant entry, which looks 
like the closer match to the original call.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D67230

Files:
  lldb/source/Host/posix/HostInfoPosix.cpp


Index: lldb/source/Host/posix/HostInfoPosix.cpp
===
--- lldb/source/Host/posix/HostInfoPosix.cpp
+++ lldb/source/Host/posix/HostInfoPosix.cpp
@@ -32,10 +32,16 @@
   char hostname[PATH_MAX];
   hostname[sizeof(hostname) - 1] = '\0';
   if (::gethostname(hostname, sizeof(hostname) - 1) == 0) {
-struct hostent *h = ::gethostbyname(hostname);
-if (h)
-  s.assign(h->h_name);
-else
+struct addrinfo hints;
+struct addrinfo *res = nullptr;
+std::memset(&hints, 0, sizeof(hints));
+hints.ai_flags = AI_CANONNAME;
+int err = ::getaddrinfo(hostname, nullptr, &hints, &res);
+if (err == 0) {
+  assert(res->ai_canonname && "getaddrinfo found a canonical name");
+  s.assign(res->ai_canonname);
+  freeaddrinfo(res);
+} else
   s.assign(hostname);
 return true;
   }


Index: lldb/source/Host/posix/HostInfoPosix.cpp
===
--- lldb/source/Host/posix/HostInfoPosix.cpp
+++ lldb/source/Host/posix/HostInfoPosix.cpp
@@ -32,10 +32,16 @@
   char hostname[PATH_MAX];
   hostname[sizeof(hostname) - 1] = '\0';
   if (::gethostname(hostname, sizeof(hostname) - 1) == 0) {
-struct hostent *h = ::gethostbyname(hostname);
-if (h)
-  s.assign(h->h_name);
-else
+struct addrinfo hints;
+struct addrinfo *res = nullptr;
+std::memset(&hints, 0, sizeof(hints));
+hints.ai_flags = AI_CANONNAME;
+int err = ::getaddrinfo(hostname, nullptr, &hints, &res);
+if (err == 0) {
+  assert(res->ai_canonname && "getaddrinfo found a canonical name");
+  s.assign(res->ai_canonname);
+  freeaddrinfo(res);
+} else
   s.assign(hostname);
 return true;
   }
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D67230: Remove call to obsolete gethostbyname, using getaddrinfo

2019-09-06 Thread serge via Phabricator via lldb-commits
serge-sans-paille added a comment.

@davezarzycki I tend to agree with you. We can just remove 35:44 and just keep 
the hostname.


Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D67230/new/

https://reviews.llvm.org/D67230



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D57830: Add functionality to trace a function within lldb

2019-05-27 Thread serge via Phabricator via lldb-commits
serge-sans-paille added a comment.

LGTM with respect to Python 2/3 compat, can't tell for the functionality though.


Repository:
  rLLDB LLDB

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D57830/new/

https://reviews.llvm.org/D57830



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D83580: [lldb] on s390x fix override issue

2020-07-10 Thread serge via Phabricator via lldb-commits
serge-sans-paille accepted this revision.
serge-sans-paille added a comment.
This revision is now accepted and ready to land.

Looks obviously good to me.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D83580/new/

https://reviews.llvm.org/D83580



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D83580: [lldb] on s390x fix override issue

2020-07-10 Thread serge via Phabricator via lldb-commits
serge-sans-paille added a comment.

Possible followup: shouldn't all the other `Get*` be flagged as `const` too?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D83580/new/

https://reviews.llvm.org/D83580



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D83857: Harmonize python shebang

2020-07-17 Thread serge via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG515bc8c1554f: Harmonize Python shebang (authored by 
serge-sans-paille).
Herald added projects: clang, Sanitizers, LLDB, libc++, OpenMP, libc-project.
Herald added subscribers: libc-commits, openmp-commits, libcxx-commits, 
lldb-commits, Sanitizers, cfe-commits.
Herald added a reviewer: libc++.

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D83857/new/

https://reviews.llvm.org/D83857

Files:
  clang/utils/clangdiag.py
  clang/utils/modfuzz.py
  compiler-rt/lib/sanitizer_common/scripts/litlint_test.py
  compiler-rt/test/sanitizer_common/android_commands/android_compile.py
  compiler-rt/test/sanitizer_common/android_commands/android_run.py
  compiler-rt/test/sanitizer_common/ios_commands/iossim_compile.py
  compiler-rt/test/sanitizer_common/ios_commands/iossim_env.py
  compiler-rt/test/sanitizer_common/ios_commands/iossim_prepare.py
  compiler-rt/test/sanitizer_common/ios_commands/iossim_run.py
  debuginfo-tests/dexter/dexter.py
  debuginfo-tests/llgdb-tests/llgdb.py
  libc/AOR_v20.02/math/tools/plot.py
  libcxx/utils/google-benchmark/mingw.py
  lldb/examples/darwin/heap_find/heap.py
  lldb/examples/python/armv7_cortex_m_target_defintion.py
  lldb/examples/python/bsd.py
  lldb/examples/python/cmdtemplate.py
  lldb/examples/python/crashlog.py
  lldb/examples/python/delta.py
  lldb/examples/python/disasm-stress-test.py
  lldb/examples/python/disasm.py
  lldb/examples/python/file_extract.py
  lldb/examples/python/gdbremote.py
  lldb/examples/python/globals.py
  lldb/examples/python/lldb_module_utils.py
  lldb/examples/python/lldbtk.py
  lldb/examples/python/mach_o.py
  lldb/examples/python/memory.py
  lldb/examples/python/operating_system.py
  lldb/examples/python/performance.py
  lldb/examples/python/process_events.py
  lldb/examples/python/sbvalue.py
  lldb/examples/python/shadow.py
  lldb/examples/python/sources.py
  lldb/examples/python/stacks.py
  lldb/examples/python/symbolication.py
  lldb/examples/python/types.py
  lldb/examples/python/x86_64_linux_target_definition.py
  lldb/examples/python/x86_64_qemu_target_definition.py
  lldb/examples/python/x86_64_target_definition.py
  lldb/scripts/analyze-project-deps.py
  lldb/scripts/reproducer-replay.py
  lldb/test/API/functionalities/plugins/python_os_plugin/operating_system.py
  lldb/test/API/functionalities/plugins/python_os_plugin/operating_system2.py
  
lldb/test/API/functionalities/plugins/python_os_plugin/stepping_plugin_threads/operating_system.py
  lldb/test/Shell/helper/build.py
  lldb/third_party/Python/module/progress/progress.py
  llvm/utils/DSAclean.py
  llvm/utils/DSAextract.py
  llvm/utils/benchmark/mingw.py
  llvm/utils/docker/scripts/llvm_checksum/llvm_checksum.py
  llvm/utils/lint/common_lint.py
  llvm/utils/lint/cpp_lint.py
  llvm/utils/lint/generic_lint.py
  llvm/utils/schedcover.py
  llvm/utils/testgen/mc-bundling-x86-gen.py
  openmp/runtime/tools/summarizeStats.py
  polly/test/update_check.py
  polly/utils/jscop2cloog.py
  polly/utils/pyscop/jscop2iscc.py

Index: polly/utils/pyscop/jscop2iscc.py
===
--- polly/utils/pyscop/jscop2iscc.py
+++ polly/utils/pyscop/jscop2iscc.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python
 import argparse, isl, os
 import json
 
Index: polly/utils/jscop2cloog.py
===
--- polly/utils/jscop2cloog.py
+++ polly/utils/jscop2cloog.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python
 import argparse, os
 import json
 
Index: polly/test/update_check.py
===
--- polly/test/update_check.py
+++ polly/test/update_check.py
@@ -1,4 +1,4 @@
-#! /usr/bin/env python3
+#!/usr/bin/env python3
 # -*- coding: UTF-8 -*-
 
 # Polly/LLVM update_check.py
Index: openmp/runtime/tools/summarizeStats.py
===
--- openmp/runtime/tools/summarizeStats.py
+++ openmp/runtime/tools/summarizeStats.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python
 
 import pandas as pd
 import numpy as np
Index: llvm/utils/testgen/mc-bundling-x86-gen.py
===
--- llvm/utils/testgen/mc-bundling-x86-gen.py
+++ llvm/utils/testgen/mc-bundling-x86-gen.py
@@ -1,5 +1,5 @@
 
-#!/usr/bin/python
+#!/usr/bin/env python
 
 # Auto-generates an exhaustive and repetitive test for correct bundle-locked
 # alignment on x86.
Index: llvm/utils/schedcover.py
===
--- llvm/utils/schedcover.py
+++ llvm/utils/schedcover.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python
 
 # This creates a CSV file from the output of the debug output of subtarget:
 #   llvm-tblgen --gen-subtarget --debug-only=subtarget-emitter
Index: llvm/utils/lint/g