[Lldb-commits] [PATCH] D92820: [lldb] Deal gracefully with concurrency in the API instrumentation.

2020-12-08 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere created this revision.
JDevlieghere added reviewers: friss, labath.
Herald added a subscriber: jfb.
JDevlieghere requested review of this revision.

Prevent lldb from crashing when multiple threads are concurrently accessing the 
SB API with reproducer capture enabled. The API instrumentation records both 
the input arguments and the return value, but it cannot block for the duration 
of the API call. Therefore we guarantee that the function id and its arguments 
are emitted as a single unit and that the return value is emitted as a single 
unit. Every API call is given a monotonically increasing index, which 
correlates the function with its return value.

Using the index, we can detect situations where the return value does not 
succeed the function call, in which case we print an error saying that 
concurrency is not (currently) supported. In the future we might attempt to be 
smarter and read ahead until we've found the return value matching the current 
call.


https://reviews.llvm.org/D92820

Files:
  lldb/include/lldb/Utility/ReproducerInstrumentation.h
  lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
  lldb/source/Utility/ReproducerInstrumentation.cpp
  lldb/test/API/functionalities/reproducers/concurrency/Makefile
  
lldb/test/API/functionalities/reproducers/concurrency/TestReproducerConcurrency.py
  lldb/test/API/functionalities/reproducers/concurrency/driver.cpp

Index: lldb/test/API/functionalities/reproducers/concurrency/driver.cpp
===
--- /dev/null
+++ lldb/test/API/functionalities/reproducers/concurrency/driver.cpp
@@ -0,0 +1,55 @@
+#include "lldb/API/LLDB.h"
+#include "lldb/API/SBCommandInterpreter.h"
+#include "lldb/API/SBCommandReturnObject.h"
+#include "lldb/API/SBDebugger.h"
+
+#include 
+#include 
+#include 
+
+#define THREADS 10
+
+using namespace lldb;
+
+void f(uint64_t idx) {
+  SBDebugger debugger = lldb::SBDebugger::Create(false);
+  debugger.GetNumPlatforms();
+  debugger.GetNumAvailablePlatforms();
+  SBTarget target = debugger.GetDummyTarget();
+  SBCommandInterpreter interpreter = debugger.GetCommandInterpreter();
+  SBDebugger::Destroy(debugger);
+}
+
+int main(int argc, char **argv) {
+  if (argc < 2) {
+std::cout << "missing argument: reproducer directory";
+return 1;
+  }
+
+  if (const char *error = SBReproducer::Capture(argv[1])) {
+std::cout << "reproducer capture failed: " << error << '\n';
+return 1;
+  }
+
+  SBReproducer::SetAutoGenerate(true);
+
+  SBError error = SBDebugger::InitializeWithErrorHandling();
+  if (error.Fail()) {
+std::cout << "initialization failed: " << error.GetCString() << '\n';
+return 1;
+  }
+
+#if !defined(_MSC_VER)
+  signal(SIGPIPE, SIG_IGN);
+#endif
+
+  std::vector threads;
+  for (uint64_t i = 0; i < THREADS; i++)
+threads.emplace_back(f, i);
+
+  for (auto &t : threads)
+t.join();
+
+  SBDebugger::Terminate();
+  return 0;
+}
Index: lldb/test/API/functionalities/reproducers/concurrency/TestReproducerConcurrency.py
===
--- /dev/null
+++ lldb/test/API/functionalities/reproducers/concurrency/TestReproducerConcurrency.py
@@ -0,0 +1,53 @@
+from __future__ import print_function
+
+import os
+
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+
+class TestReproducerConcurrency(TestBase):
+
+mydir = TestBase.compute_mydir(__file__)
+
+NO_DEBUG_INFO_TESTCASE = True
+
+@skipIfNoSBHeaders
+@skipIfWindows
+def test_multiple_debuggers(self):
+env = {self.dylibPath: self.getLLDBLibraryEnvVal()}
+
+driver = self.getBuildArtifact("driver")
+reproducer = self.getBuildArtifact("reproducer")
+
+if os.path.exists(reproducer):
+try:
+shutil.rmtree(reproducer)
+except OSError:
+pass
+
+self.buildDriver('driver.cpp', driver)
+self.signBinary(driver)
+
+if self.TraceOn():
+check_call([driver, reproducer], env=env)
+else:
+with open(os.devnull, 'w') as fnull:
+check_call([driver, reproducer],
+   env=env,
+   stdout=fnull,
+   stderr=fnull)
+
+# Check that replay fails with the expected error.
+replay = subprocess.Popen(
+[lldbtest_config.lldbExec, '-replay', reproducer],
+stdin=subprocess.PIPE,
+stdout=subprocess.PIPE,
+stderr=subprocess.PIPE)
+_, errs = replay.communicate()
+errs = errs.decode('utf-8')
+self.assertNotEqual(replay.returncode, 0)
+self.assertIn('The result does not match the preceding function.',
+  errs)
Index: lldb/test/API/functionalities/reproducers/concurrency/Makefile

[Lldb-commits] [lldb] 6face91 - [lldb][import-std-module] Add a test for typedef'd std types

2020-12-08 Thread Raphael Isemann via lldb-commits

Author: Raphael Isemann
Date: 2020-12-08T13:36:13+01:00
New Revision: 6face9119c811e06cfb284755953ba6cdbdaa22b

URL: 
https://github.com/llvm/llvm-project/commit/6face9119c811e06cfb284755953ba6cdbdaa22b
DIFF: 
https://github.com/llvm/llvm-project/commit/6face9119c811e06cfb284755953ba6cdbdaa22b.diff

LOG: [lldb][import-std-module] Add a test for typedef'd std types

Added: 


Modified: 

lldb/test/API/commands/expression/import-std-module/vector/TestVectorFromStdModule.py
lldb/test/API/commands/expression/import-std-module/vector/main.cpp

Removed: 




diff  --git 
a/lldb/test/API/commands/expression/import-std-module/vector/TestVectorFromStdModule.py
 
b/lldb/test/API/commands/expression/import-std-module/vector/TestVectorFromStdModule.py
index 9a186e7a2243..a03c347a728f 100644
--- 
a/lldb/test/API/commands/expression/import-std-module/vector/TestVectorFromStdModule.py
+++ 
b/lldb/test/API/commands/expression/import-std-module/vector/TestVectorFromStdModule.py
@@ -87,3 +87,13 @@ def test(self):
  ValueCheck(value="4"),
  ValueCheck(value="5")
  ])
+
+# Test that the typedef'd vector type can be substituted.
+self.expect("expr b.emplace_back(6)")
+self.expect_expr("b", result_type="vector_long",
+ result_children=[
+ ValueCheck(value="3"),
+ ValueCheck(value="1"),
+ ValueCheck(value="2"),
+ ValueCheck(value="6"),
+ ])

diff  --git 
a/lldb/test/API/commands/expression/import-std-module/vector/main.cpp 
b/lldb/test/API/commands/expression/import-std-module/vector/main.cpp
index edf130d47488..668b59181d42 100644
--- a/lldb/test/API/commands/expression/import-std-module/vector/main.cpp
+++ b/lldb/test/API/commands/expression/import-std-module/vector/main.cpp
@@ -1,6 +1,8 @@
 #include 
 
+typedef std::vector vector_long;
 int main(int argc, char **argv) {
   std::vector a = {3, 1, 2};
+  vector_long b = {3, 1, 2};
   return 0; // Set break point at this line.
 }



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


[Lldb-commits] [PATCH] D92643: [lldb] Lookup static const members in FindGlobalVariables

2020-12-08 Thread Andy Yankovsky via Phabricator via lldb-commits
werat added a comment.

@labath @teemperor gentle ping :) What do you think about this approach?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D92643

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


[Lldb-commits] [PATCH] D92872: [lldb] [docs] Add a manpage for lldb-server

2020-12-08 Thread Michał Górny via Phabricator via lldb-commits
mgorny created this revision.
mgorny added reviewers: labath, JDevlieghere, zturner, emaste, krytarowski.
mgorny requested review of this revision.

https://reviews.llvm.org/D92872

Files:
  lldb/docs/conf.py
  lldb/docs/man/lldb-server.rst

Index: lldb/docs/man/lldb-server.rst
===
--- /dev/null
+++ lldb/docs/man/lldb-server.rst
@@ -0,0 +1,209 @@
+:orphan:
+
+lldb-server -- Server for LLDB Debugging Sessions
+=
+
+.. program:: lldb-server
+
+SYNOPSIS
+
+
+| :program:`lldb-server` v[ersion]
+| :program:`lldb-server` g[dbserver] [*options*]
+| :program:`lldb-server` p[latform] [*options*]
+
+DESCRIPTION
+---
+
+:program:`lldb-server` provides the server counterpart of the LLVM debugger.
+The server runs and monitors the debugged program, while the user interfaces
+with it via a client, either running locally or connecting remotely.
+
+All of the code in the LLDB project is available under the Apache 2.0 License
+with LLVM exceptions.
+
+COMMANDS
+
+
+The first argument to lldb-server specifies a command to run.
+
+.. option:: v[ersion]
+
+ Prints lldb-server version and exits.
+
+.. option:: g[dbserver]
+
+ Runs the server using the gdb-remote protocol. LLDB can afterwards
+ connect to the server using *gdb-remote* command.
+
+.. option:: p[latform]
+
+ Runs the platform server. LLDB can afterwards connect to the server using
+ *platform select*, followed by *platform connect*.
+
+GDBSERVER COMMAND
+-
+
+| :program:`lldb-server` g[dbserver] [*options*] [[*host*]:*port*] [[--] *program* *args*...]
+
+CONNECTION
+~~
+
+.. option:: host:port
+
+ Specifies the hostname and TCP port to listen on. Obligatory unless another
+ listening option is used. If host is empty, *localhost* will be used.  If port
+ is zero, a random port will be selected, and written as specified by --pipe
+ or --named-pipe options.
+
+.. option:: --fd 
+
+ Communicate over the given file descriptor instead of sockets.
+
+.. option:: --named-pipe 
+
+ Write the listening port number to the specified named pipe.
+
+.. option:: --pipe 
+
+ Write the listening port number to the specified pipe (fd).
+
+.. option:: --reverse-connect
+
+ Connect to the client instead of passively waiting for a connection. In this
+ case, [host]:port denotes the remote address to connect to.
+
+GENERAL OPTIONS
+~~~
+
+.. option:: --help
+
+ Prints out the usage information and exits.
+
+.. option:: --log-channels 
+
+ Channels to log. A colon-separated list of entries. Each entry starts with
+ a channel followed by a space-separated list of categories.
+
+.. option:: --log-file 
+
+ Destination file to log to. If empty, log to stderr.
+
+.. option:: --setsid
+
+ Run lldb-server in a new session.
+
+TARGET SELECTION
+
+
+.. option:: --attach 
+
+ Attach to the process given by a (numeric) process id or a name.
+
+.. option:: -- program args
+
+ Launch a program for debugging.
+
+If neither of target options are used, :program:`lldb-server` is started
+without a specific target. It can be afterwards instructedb the client
+to launch or attach.
+
+PLATFORM COMMAND
+
+
+| :program:`lldb-server` p[latform] [*options*] --server --listen [[*host*]:*port*]
+
+CONNECTION
+~~
+
+.. option:: --server
+
+ Run in server mode, handling multiple connections. If this is not specified,
+ lldb-server will accept only one connection and exit when it is finished.
+
+.. option:: --listen :
+
+ Hostname and port to listen on. Obligatory. If *port* is zero, a random port
+ will be used.
+
+.. option:: --socket-file 
+
+ Write the listening socket port number to the specified file.
+
+GENERAL OPTIONS
+~~~
+
+.. option:: --log-channels 
+
+ Channels to log. A colon-separated list of entries. Each entry starts with
+ a channel followed by a space-separated list of categories.
+
+.. option:: --log-file 
+
+ Destination file to log to. If empty, log to stderr.
+
+GDB-SERVER CONNECTIONS
+~~
+
+.. option:: --gdbserver-port 
+
+ Define a port to be used for gdb-server connections. Can be specified multiple
+ times to allow multiple ports. Has no effect if --min-gdbserver-port
+ and --max-gdbserver-port are specified.
+
+.. option:: --min-gdbserver-port 
+.. option:: --max-gdbserver-port 
+
+ Specify the range of ports that can be used for gdb-server connections. Both
+ options need to be specified simultaneously. Overrides --gdbserver-port.
+
+.. option:: --port-offset 
+
+ Add the specified offset to port numbers returned by server. This is useful
+ if the server is running behind a firewall, and a range of ports is redirected
+ to it with an offset.
+
+EXAMPLES
+
+
+The server can be started in several modes.
+
+In order to launch a new process inside the debugger, pass the path to it
+and the arguments to the debugged executable as positional a

[Lldb-commits] [PATCH] D92872: [lldb] [docs] Add a manpage for lldb-server

2020-12-08 Thread Michał Górny via Phabricator via lldb-commits
mgorny added a comment.

This is half-guesswork since `platform` command seems to be undocumented, so 
I'd appreciate any suggestions what I got wrong.

I've omitted `--debug` and `--verbose` from platform since they don't seem to 
do anything.

I've also omitted UNIX socket support since it's not documented in `--help` and 
`gdb-remote` doesn't seem to support it.


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

https://reviews.llvm.org/D92872

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


[Lldb-commits] [PATCH] D92872: [lldb] [docs] Add a manpage for lldb-server

2020-12-08 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere added a comment.

Nice!

Currently we have the `lldb` man page listed under "Reference" on the website. 
Do you think it would be worth creating a separate section for the man pages 
with `lldb` and `lldb-server` listed there? I thinking about adding a man page 
for `debugserver` as well.


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

https://reviews.llvm.org/D92872

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


[Lldb-commits] [PATCH] D92872: [lldb] [docs] Add a manpage for lldb-server

2020-12-08 Thread Michał Górny via Phabricator via lldb-commits
mgorny added a comment.

In D92872#2440764 , @JDevlieghere 
wrote:

> Nice!
>
> Currently we have the `lldb` man page listed under "Reference" on the 
> website. Do you think it would be worth creating a separate section for the 
> man pages with `lldb` and `lldb-server` listed there? I thinking about adding 
> a man page for `debugserver` as well.

Sure, that makes sense to me.


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

https://reviews.llvm.org/D92872

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


[Lldb-commits] [PATCH] D92692: Ignore DBGArchitecture from DebugSymbols DBGShellCommands outputs

2020-12-08 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere accepted this revision.
JDevlieghere added a comment.
This revision is now accepted and ready to land.

LGTM


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D92692

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


[Lldb-commits] [PATCH] D92908: [lldb] Kill the inferior instead of detaching during test suite runs

2020-12-08 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere created this revision.
JDevlieghere added a reviewer: LLDB.
JDevlieghere requested review of this revision.

Kill (rather than detach) form the inferior if debugserver loses its connection 
to lldb to prevent zombie processes.


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D92908

Files:
  lldb/packages/Python/lldbsuite/test/lldbtest.py
  lldb/test/API/types/AbstractBase.py
  lldb/test/Shell/lit-lldb-init.in
  lldb/tools/lldb-test/lldb-test.cpp


Index: lldb/tools/lldb-test/lldb-test.cpp
===
--- lldb/tools/lldb-test/lldb-test.cpp
+++ lldb/tools/lldb-test/lldb-test.cpp
@@ -1105,6 +1105,9 @@
   Dbg->GetCommandInterpreter().HandleCommand(
   "settings set target.inherit-tcc true",
   /*add_to_history*/ eLazyBoolNo, Result);
+  Dbg->GetCommandInterpreter().HandleCommand(
+  "settings set target.detach-on-error false",
+  /*add_to_history*/ eLazyBoolNo, Result);
 
   if (!opts::Log.empty())
 Dbg->EnableLog("lldb", {"all"}, opts::Log, 0, errs());
Index: lldb/test/Shell/lit-lldb-init.in
===
--- lldb/test/Shell/lit-lldb-init.in
+++ lldb/test/Shell/lit-lldb-init.in
@@ -5,3 +5,4 @@
 settings set symbols.clang-modules-cache-path "@LLDB_TEST_MODULE_CACHE_LLDB@"
 settings set target.auto-apply-fixits false
 settings set target.inherit-tcc true
+settings set target.detach-on-error false
Index: lldb/test/API/types/AbstractBase.py
===
--- lldb/test/API/types/AbstractBase.py
+++ lldb/test/API/types/AbstractBase.py
@@ -155,6 +155,9 @@
 # Inherit TCC permissions. We can leave this set.
 self.runCmd('settings set target.inherit-tcc true')
 
+# Kill rather than detach from the inferior if something goes wrong.
+self.runCmd('settings set target.detach-on-error false')
+
 # And add hooks to restore the settings during tearDown().
 self.addTearDownHook(lambda: self.runCmd(
 "settings set target.inline-breakpoint-strategy headers"))
Index: lldb/packages/Python/lldbsuite/test/lldbtest.py
===
--- lldb/packages/Python/lldbsuite/test/lldbtest.py
+++ lldb/packages/Python/lldbsuite/test/lldbtest.py
@@ -784,6 +784,9 @@
 # Inherit the TCC permissions from the inferior's parent.
 "settings set target.inherit-tcc true",
 
+# Kill rather than detach from the inferior if something goes 
wrong.
+"settings set target.detach-on-error false",
+
 # Disable fix-its by default so that incorrect expressions in 
tests don't
 # pass just because Clang thinks it has a fix-it.
 "settings set target.auto-apply-fixits false",


Index: lldb/tools/lldb-test/lldb-test.cpp
===
--- lldb/tools/lldb-test/lldb-test.cpp
+++ lldb/tools/lldb-test/lldb-test.cpp
@@ -1105,6 +1105,9 @@
   Dbg->GetCommandInterpreter().HandleCommand(
   "settings set target.inherit-tcc true",
   /*add_to_history*/ eLazyBoolNo, Result);
+  Dbg->GetCommandInterpreter().HandleCommand(
+  "settings set target.detach-on-error false",
+  /*add_to_history*/ eLazyBoolNo, Result);
 
   if (!opts::Log.empty())
 Dbg->EnableLog("lldb", {"all"}, opts::Log, 0, errs());
Index: lldb/test/Shell/lit-lldb-init.in
===
--- lldb/test/Shell/lit-lldb-init.in
+++ lldb/test/Shell/lit-lldb-init.in
@@ -5,3 +5,4 @@
 settings set symbols.clang-modules-cache-path "@LLDB_TEST_MODULE_CACHE_LLDB@"
 settings set target.auto-apply-fixits false
 settings set target.inherit-tcc true
+settings set target.detach-on-error false
Index: lldb/test/API/types/AbstractBase.py
===
--- lldb/test/API/types/AbstractBase.py
+++ lldb/test/API/types/AbstractBase.py
@@ -155,6 +155,9 @@
 # Inherit TCC permissions. We can leave this set.
 self.runCmd('settings set target.inherit-tcc true')
 
+# Kill rather than detach from the inferior if something goes wrong.
+self.runCmd('settings set target.detach-on-error false')
+
 # And add hooks to restore the settings during tearDown().
 self.addTearDownHook(lambda: self.runCmd(
 "settings set target.inline-breakpoint-strategy headers"))
Index: lldb/packages/Python/lldbsuite/test/lldbtest.py
===
--- lldb/packages/Python/lldbsuite/test/lldbtest.py
+++ lldb/packages/Python/lldbsuite/test/lldbtest.py
@@ -784,6 +784,9 @@
 # Inherit the TCC permissions from the inferior's parent.
 "settings set target.inherit-tcc true",
 
+# Kill rather than detach from the inferior if something goes wrong.
+"settings 

[Lldb-commits] [lldb] c59ccc0 - [lldb] Fix -Wformat warning in debugserver unit test

2020-12-08 Thread Jonas Devlieghere via lldb-commits

Author: Jonas Devlieghere
Date: 2020-12-08T20:57:51-08:00
New Revision: c59ccc022265a6a3d70c86c4cf6391ebd70e6497

URL: 
https://github.com/llvm/llvm-project/commit/c59ccc022265a6a3d70c86c4cf6391ebd70e6497
DIFF: 
https://github.com/llvm/llvm-project/commit/c59ccc022265a6a3d70c86c4cf6391ebd70e6497.diff

LOG: [lldb] Fix -Wformat warning in debugserver unit test

RNBSocketTest.cpp:31:35: warning: format specifies type 'char *' but the
argument has type 'const void *' [-Wformat]

Added: 


Modified: 
lldb/unittests/debugserver/RNBSocketTest.cpp

Removed: 




diff  --git a/lldb/unittests/debugserver/RNBSocketTest.cpp 
b/lldb/unittests/debugserver/RNBSocketTest.cpp
index 7840c48f82b4..2625a6d36b5c 100644
--- a/lldb/unittests/debugserver/RNBSocketTest.cpp
+++ b/lldb/unittests/debugserver/RNBSocketTest.cpp
@@ -28,7 +28,7 @@ static void ServerCallbackv4(const void *baton, in_port_t 
port) {
   auto child_pid = fork();
   if (child_pid == 0) {
 char addr_buffer[256];
-sprintf(addr_buffer, "%s:%d", baton, port);
+sprintf(addr_buffer, "%s:%d", (const char *)baton, port);
 llvm::Expected> socket_or_err =
 Socket::TcpConnect(addr_buffer, false);
 ASSERT_THAT_EXPECTED(socket_or_err, llvm::Succeeded());



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


[Lldb-commits] Buildbot to listen main branch

2020-12-08 Thread Galina Kistanova via lldb-commits
Hello everyone,

To follow the main branch creation I'm going to update the buildbot to
listen for the changes in this branch and instruct all the workers to
checkout this branch.

No work is required on the workers.

Please check your annotated scripts to make sure it accepts the branch name
from the buildbot, or change it if that's hardcoded.

The staging has been updated today. I forced clean builds just to play it
safe. Please check your bots in the staging area, to make sure everything
is good.

If everything will go well, the production buildbot will be updated on this
Saturday, December, 12th.

Thanks

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


[Lldb-commits] [lldb] 012fd0b - [lldb] Remove unused IsFunctionType is_variadic_ptr parameter (NFC)

2020-12-08 Thread Dave Lee via lldb-commits

Author: Dave Lee
Date: 2020-12-08T23:51:07-08:00
New Revision: 012fd0b17f30278a410055ead645f7f1c3c616d3

URL: 
https://github.com/llvm/llvm-project/commit/012fd0b17f30278a410055ead645f7f1c3c616d3
DIFF: 
https://github.com/llvm/llvm-project/commit/012fd0b17f30278a410055ead645f7f1c3c616d3.diff

LOG: [lldb] Remove unused IsFunctionType is_variadic_ptr parameter (NFC)

`is_variadic_ptr` is unused.

Differential Revision: https://reviews.llvm.org/D92778

Added: 


Modified: 
lldb/include/lldb/Symbol/CompilerType.h
lldb/include/lldb/Symbol/TypeSystem.h
lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h
lldb/source/Symbol/CompilerType.cpp

Removed: 




diff  --git a/lldb/include/lldb/Symbol/CompilerType.h 
b/lldb/include/lldb/Symbol/CompilerType.h
index 614373938165..f1cde0ac3084 100644
--- a/lldb/include/lldb/Symbol/CompilerType.h
+++ b/lldb/include/lldb/Symbol/CompilerType.h
@@ -96,7 +96,7 @@ class CompilerType {
 
   bool IsFloatingPointType(uint32_t &count, bool &is_complex) const;
 
-  bool IsFunctionType(bool *is_variadic_ptr = nullptr) const;
+  bool IsFunctionType() const;
 
   uint32_t IsHomogeneousAggregate(CompilerType *base_type_ptr) const;
 

diff  --git a/lldb/include/lldb/Symbol/TypeSystem.h 
b/lldb/include/lldb/Symbol/TypeSystem.h
index b6bebedc503e..4c51d290ad2c 100644
--- a/lldb/include/lldb/Symbol/TypeSystem.h
+++ b/lldb/include/lldb/Symbol/TypeSystem.h
@@ -152,8 +152,7 @@ class TypeSystem : public PluginInterface {
   virtual bool IsFloatingPointType(lldb::opaque_compiler_type_t type,
uint32_t &count, bool &is_complex) = 0;
 
-  virtual bool IsFunctionType(lldb::opaque_compiler_type_t type,
-  bool *is_variadic_ptr) = 0;
+  virtual bool IsFunctionType(lldb::opaque_compiler_type_t type) = 0;
 
   virtual size_t
   GetNumberOfFunctionArguments(lldb::opaque_compiler_type_t type) = 0;

diff  --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp 
b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
index 726aaf708c84..463ff2fedce9 100644
--- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
+++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
@@ -2915,20 +2915,11 @@ bool 
TypeSystemClang::IsCStringType(lldb::opaque_compiler_type_t type,
   return false;
 }
 
-bool TypeSystemClang::IsFunctionType(lldb::opaque_compiler_type_t type,
- bool *is_variadic_ptr) {
+bool TypeSystemClang::IsFunctionType(lldb::opaque_compiler_type_t type) {
   if (type) {
 clang::QualType qual_type = 
RemoveWrappingTypes(GetCanonicalQualType(type));
 
 if (qual_type->isFunctionType()) {
-  if (is_variadic_ptr) {
-const clang::FunctionProtoType *function_proto_type =
-llvm::dyn_cast(qual_type.getTypePtr());
-if (function_proto_type)
-  *is_variadic_ptr = function_proto_type->isVariadic();
-else
-  *is_variadic_ptr = false;
-  }
   return true;
 }
 
@@ -2941,8 +2932,8 @@ bool 
TypeSystemClang::IsFunctionType(lldb::opaque_compiler_type_t type,
   const clang::ReferenceType *reference_type =
   llvm::cast(qual_type.getTypePtr());
   if (reference_type)
-return 
IsFunctionType(reference_type->getPointeeType().getAsOpaquePtr(),
-  nullptr);
+return IsFunctionType(
+reference_type->getPointeeType().getAsOpaquePtr());
 } break;
 }
   }

diff  --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h 
b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h
index 0bfb77af0caa..8d2c0f045c14 100644
--- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h
+++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h
@@ -578,8 +578,7 @@ class TypeSystemClang : public TypeSystem {
   bool IsFloatingPointType(lldb::opaque_compiler_type_t type, uint32_t &count,
bool &is_complex) override;
 
-  bool IsFunctionType(lldb::opaque_compiler_type_t type,
-  bool *is_variadic_ptr) override;
+  bool IsFunctionType(lldb::opaque_compiler_type_t type) override;
 
   uint32_t IsHomogeneousAggregate(lldb::opaque_compiler_type_t type,
   CompilerType *base_type_ptr) override;

diff  --git a/lldb/source/Symbol/CompilerType.cpp 
b/lldb/source/Symbol/CompilerType.cpp
index 2d2d8c3463c4..c2f68283f603 100644
--- a/lldb/source/Symbol/CompilerType.cpp
+++ b/lldb/source/Symbol/CompilerType.cpp
@@ -92,9 +92,9 @@ bool CompilerType::IsCStringType(uint32_t &length) const {
   return false;
 }
 
-bool CompilerType::IsFunctionType(bool *is_variadic_ptr) const {
+bool CompilerType::IsFunctionType() const {
   if (IsValid())
-return m_type_system->IsFunctionType(m_type, is_variadic_ptr);
+return m_type_system->IsFunctionTyp

[Lldb-commits] [PATCH] D92778: [lldb] Remove unused IsFunctionType is_variadic_ptr parameter (NFC)

2020-12-08 Thread Dave Lee 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 rG012fd0b17f30: [lldb] Remove unused IsFunctionType 
is_variadic_ptr parameter (NFC) (authored by kastiglione).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D92778

Files:
  lldb/include/lldb/Symbol/CompilerType.h
  lldb/include/lldb/Symbol/TypeSystem.h
  lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
  lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h
  lldb/source/Symbol/CompilerType.cpp


Index: lldb/source/Symbol/CompilerType.cpp
===
--- lldb/source/Symbol/CompilerType.cpp
+++ lldb/source/Symbol/CompilerType.cpp
@@ -92,9 +92,9 @@
   return false;
 }
 
-bool CompilerType::IsFunctionType(bool *is_variadic_ptr) const {
+bool CompilerType::IsFunctionType() const {
   if (IsValid())
-return m_type_system->IsFunctionType(m_type, is_variadic_ptr);
+return m_type_system->IsFunctionType(m_type);
   return false;
 }
 
Index: lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h
===
--- lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h
+++ lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h
@@ -578,8 +578,7 @@
   bool IsFloatingPointType(lldb::opaque_compiler_type_t type, uint32_t &count,
bool &is_complex) override;
 
-  bool IsFunctionType(lldb::opaque_compiler_type_t type,
-  bool *is_variadic_ptr) override;
+  bool IsFunctionType(lldb::opaque_compiler_type_t type) override;
 
   uint32_t IsHomogeneousAggregate(lldb::opaque_compiler_type_t type,
   CompilerType *base_type_ptr) override;
Index: lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
===
--- lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
+++ lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
@@ -2915,20 +2915,11 @@
   return false;
 }
 
-bool TypeSystemClang::IsFunctionType(lldb::opaque_compiler_type_t type,
- bool *is_variadic_ptr) {
+bool TypeSystemClang::IsFunctionType(lldb::opaque_compiler_type_t type) {
   if (type) {
 clang::QualType qual_type = 
RemoveWrappingTypes(GetCanonicalQualType(type));
 
 if (qual_type->isFunctionType()) {
-  if (is_variadic_ptr) {
-const clang::FunctionProtoType *function_proto_type =
-llvm::dyn_cast(qual_type.getTypePtr());
-if (function_proto_type)
-  *is_variadic_ptr = function_proto_type->isVariadic();
-else
-  *is_variadic_ptr = false;
-  }
   return true;
 }
 
@@ -2941,8 +2932,8 @@
   const clang::ReferenceType *reference_type =
   llvm::cast(qual_type.getTypePtr());
   if (reference_type)
-return 
IsFunctionType(reference_type->getPointeeType().getAsOpaquePtr(),
-  nullptr);
+return IsFunctionType(
+reference_type->getPointeeType().getAsOpaquePtr());
 } break;
 }
   }
Index: lldb/include/lldb/Symbol/TypeSystem.h
===
--- lldb/include/lldb/Symbol/TypeSystem.h
+++ lldb/include/lldb/Symbol/TypeSystem.h
@@ -152,8 +152,7 @@
   virtual bool IsFloatingPointType(lldb::opaque_compiler_type_t type,
uint32_t &count, bool &is_complex) = 0;
 
-  virtual bool IsFunctionType(lldb::opaque_compiler_type_t type,
-  bool *is_variadic_ptr) = 0;
+  virtual bool IsFunctionType(lldb::opaque_compiler_type_t type) = 0;
 
   virtual size_t
   GetNumberOfFunctionArguments(lldb::opaque_compiler_type_t type) = 0;
Index: lldb/include/lldb/Symbol/CompilerType.h
===
--- lldb/include/lldb/Symbol/CompilerType.h
+++ lldb/include/lldb/Symbol/CompilerType.h
@@ -96,7 +96,7 @@
 
   bool IsFloatingPointType(uint32_t &count, bool &is_complex) const;
 
-  bool IsFunctionType(bool *is_variadic_ptr = nullptr) const;
+  bool IsFunctionType() const;
 
   uint32_t IsHomogeneousAggregate(CompilerType *base_type_ptr) const;
 


Index: lldb/source/Symbol/CompilerType.cpp
===
--- lldb/source/Symbol/CompilerType.cpp
+++ lldb/source/Symbol/CompilerType.cpp
@@ -92,9 +92,9 @@
   return false;
 }
 
-bool CompilerType::IsFunctionType(bool *is_variadic_ptr) const {
+bool CompilerType::IsFunctionType() const {
   if (IsValid())
-return m_type_system->IsFunctionType(m_type, is_variadic_ptr);
+return m_type_system->IsFunctionType(m_type);
   return false;
 }
 
Index: lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h
=