[Lldb-commits] [PATCH] D74957: [lldb] Disable auto fix-its when evaluating expressions in the test suite

Raphael Isemann via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Fri Feb 21 07:09:55 PST 2020


teemperor updated this revision to Diff 245846.
teemperor added a comment.

- Revert dummy change that set auto-apply fixits to true (thanks Shafik!)


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

https://reviews.llvm.org/D74957

Files:
  lldb/packages/Python/lldbsuite/test/lldbtest.py
  lldb/test/API/lang/cpp/operators/main.cpp
  lldb/test/Shell/lit-lldb-init.in


Index: lldb/test/Shell/lit-lldb-init.in
===================================================================
--- lldb/test/Shell/lit-lldb-init.in
+++ lldb/test/Shell/lit-lldb-init.in
@@ -3,3 +3,4 @@
 settings set plugin.process.gdb-remote.packet-timeout 60
 settings set interpreter.echo-comment-commands false
 settings set symbols.clang-modules-cache-path "@LLDB_TEST_MODULE_CACHE_LLDB@"
+settings set target.auto-apply-fixits false
Index: lldb/test/API/lang/cpp/operators/main.cpp
===================================================================
--- lldb/test/API/lang/cpp/operators/main.cpp
+++ lldb/test/API/lang/cpp/operators/main.cpp
@@ -171,7 +171,7 @@
   //% self.expect("expr static_cast<long>(c)", endstr=" 12\n")
   //% self.expect("expr c.operatorint()", endstr=" 13\n")
   //% self.expect("expr c.operatornew()", endstr=" 14\n")
-  //% self.expect("expr (new C)->custom_new", endstr=" true\n")
+  //% self.expect("expr (new struct C)->custom_new", endstr=" true\n")
   //% self.expect("expr (new struct C[1])->custom_new", endstr=" true\n")
   //% self.expect("expr delete c2; side_effect", endstr=" = 1\n")
   //% self.expect("expr delete[] c3; side_effect", endstr=" = 2\n")
Index: lldb/packages/Python/lldbsuite/test/lldbtest.py
===================================================================
--- lldb/packages/Python/lldbsuite/test/lldbtest.py
+++ lldb/packages/Python/lldbsuite/test/lldbtest.py
@@ -692,6 +692,10 @@
             # differ in the debug info, which is not being hashed.
             "settings set symbols.enable-external-lookup 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",
+
             # Testsuite runs in parallel and the host can have also other load.
             "settings set plugin.process.gdb-remote.packet-timeout 60",
 
@@ -2394,7 +2398,16 @@
         self.assertTrue(expr.strip() == expr, "Expression contains trailing/leading whitespace: '" + expr + "'")
 
         frame = self.frame()
-        eval_result = frame.EvaluateExpression(expr)
+        options = lldb.SBExpressionOptions()
+
+        # Disable fix-its that tests don't pass by accident.
+        options.SetAutoApplyFixIts(False)
+
+        # Set the usual default options for normal expressions.
+        options.SetIgnoreBreakpoints(True)
+        options.SetLanguage(frame.GuessLanguage())
+
+        eval_result = frame.EvaluateExpression(expr, options)
 
         if error_msg:
             self.assertFalse(eval_result.IsValid(), "Unexpected success with result: '" + str(eval_result) + "'")


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D74957.245846.patch
Type: text/x-patch
Size: 2689 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20200221/d75e34d4/attachment.bin>


More information about the lldb-commits mailing list