Author: Alex Langford
Date: 2023-04-10T13:59:44-07:00
New Revision: 469bdbd62ce2d1dcaef15a8209130547eb614ca6

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

LOG: [lldb][NFC] Update syntax description for language cplusplus demangle

Also added some tests because this is completely untested.

rdar://107780577

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

Added: 
    lldb/test/Shell/Commands/command-language-cplusplus-demangle.test

Modified: 
    
lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp

Removed: 
    


################################################################################
diff  --git 
a/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp
 
b/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp
index 2879aa64fd7c3..711a696ff9b4d 100644
--- 
a/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp
+++ 
b/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp
@@ -318,9 +318,9 @@ ItaniumABILanguageRuntime::CreateInstance(Process *process,
 class CommandObjectMultiwordItaniumABI_Demangle : public CommandObjectParsed {
 public:
   CommandObjectMultiwordItaniumABI_Demangle(CommandInterpreter &interpreter)
-      : CommandObjectParsed(interpreter, "demangle",
-                            "Demangle a C++ mangled name.",
-                            "language cplusplus demangle") {
+      : CommandObjectParsed(
+            interpreter, "demangle", "Demangle a C++ mangled name.",
+            "language cplusplus demangle [<mangled-name> ...]") {
     CommandArgumentEntry arg;
     CommandArgumentData index_arg;
 

diff  --git a/lldb/test/Shell/Commands/command-language-cplusplus-demangle.test 
b/lldb/test/Shell/Commands/command-language-cplusplus-demangle.test
new file mode 100644
index 0000000000000..105531023814d
--- /dev/null
+++ b/lldb/test/Shell/Commands/command-language-cplusplus-demangle.test
@@ -0,0 +1,22 @@
+# RUN: %lldb -b -o "language cplusplus demangle __ZN3Foo7DoThingEv" \
+# RUN:   | FileCheck --check-prefix=DOUBLE-UNDERSCORE %s
+# RUN: %lldb -b -o "language cplusplus demangle _ZN3Foo7DoThingEv" \
+# RUN:   | FileCheck --check-prefix=SINGLE-UNDERSCORE %s
+# RUN: not %lldb -b -o "language cplusplus demangle foo" 2>&1 \
+# RUN:   | FileCheck --check-prefix=NOT-MANGLED %s
+# RUN: not %lldb -b -o "language cplusplus demangle _ZN3Foo7DoThingEv foo" 
2>&1 \
+# RUN:   | FileCheck --check-prefix=MULTI-ARG %s
+# RUN: %lldb -b -o "help language cplusplus demangle" \
+# RUN:   | FileCheck --check-prefix=HELP-MESSAGE %s
+
+# DOUBLE-UNDERSCORE: __ZN3Foo7DoThingEv ---> Foo::DoThing()
+
+# SINGLE-UNDERSCORE: _ZN3Foo7DoThingEv ---> Foo::DoThing()
+
+# NOT-MANGLED: error: foo is not a valid C++ mangled name
+
+# MULTI-ARG: _ZN3Foo7DoThingEv ---> Foo::DoThing()
+# MULTI-ARG: error: foo is not a valid C++ mangled name
+
+# HELP-MESSAGE: Demangle a C++ mangled name.
+# HELP-MESSAGE: Syntax: language cplusplus demangle [<mangled-name> ...] 


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

Reply via email to