[Lldb-commits] [lldb] r368920 - Revert "[lldb] Reinstate original guard variable check"

Raphael Isemann via lldb-commits lldb-commits at lists.llvm.org
Wed Aug 14 14:21:14 PDT 2019


Author: teemperor
Date: Wed Aug 14 14:21:14 2019
New Revision: 368920

URL: http://llvm.org/viewvc/llvm-project?rev=368920&view=rev
Log:
Revert "[lldb] Reinstate original guard variable check"

It seems this breaks the following tests:
    lldb-Suite :: expression_command/call-function/TestCallUserDefinedFunction.py
    lldb-Suite :: expression_command/rdar42038760/TestScalarURem.py

Let's revert this patch and wait until we find an actual issue that could be
fixed by also doing the guard variable check on Windows.

Modified:
    lldb/trunk/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp

Modified: lldb/trunk/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp?rev=368920&r1=368919&r2=368920&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp (original)
+++ lldb/trunk/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp Wed Aug 14 14:21:14 2019
@@ -156,9 +156,12 @@ clang::NamedDecl *IRForTarget::DeclForGl
 }
 
 /// Returns true iff the mangled symbol is for a static guard variable.
-static bool isGuardVariableSymbol(llvm::StringRef mangled_symbol) {
-  return mangled_symbol.startswith("_ZGV") || // Itanium ABI
-         mangled_symbol.endswith("@4IA");     // Microsoft ABI
+static bool isGuardVariableSymbol(llvm::StringRef mangled_symbol,
+                                  bool check_ms_abi = true) {
+  bool result = mangled_symbol.startswith("_ZGV"); // Itanium ABI guard variable
+  if (check_ms_abi)
+    result |= mangled_symbol.endswith("@4IA"); // Microsoft ABI
+  return result;
 }
 
 bool IRForTarget::CreateResultVariable(llvm::Function &llvm_function) {
@@ -178,8 +181,9 @@ bool IRForTarget::CreateResultVariable(l
   for (StringMapEntry<llvm::Value *> &value_symbol : value_symbol_table) {
     result_name = value_symbol.first();
 
-    // Check if this is a guard variable.
-    const bool is_guard_var = isGuardVariableSymbol(result_name);
+    // Check if this is a guard variable. It seems this causes some hiccups
+    // on Windows, so let's only check for Itanium guard variables.
+    bool is_guard_var = isGuardVariableSymbol(result_name, /*MS ABI*/ false);
 
     if (result_name.contains("$__lldb_expr_result_ptr") && !is_guard_var) {
       found_result = true;




More information about the lldb-commits mailing list