Skip to content

Commit

Permalink
[lldb] Reinstate original guard variable check
Browse files Browse the repository at this point in the history
The isGuardVariableSymbol option for ignoring Microsoft's ABI
was originally added to get the bots green, but now that we found
the actual issue (that we checked for prefix instead of suffix
in the MS ABI check), we should be able to properly implement
the guard variable check without any strange Microsoft exceptions.

llvm-svn: 368802
  • Loading branch information
Teemperor committed Aug 14, 2019
1 parent 491ca24 commit afd493e
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp
Expand Up @@ -156,12 +156,9 @@ clang::NamedDecl *IRForTarget::DeclForGlobal(GlobalValue *global_val) {
}

/// Returns true iff the mangled symbol is for a static guard variable.
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;
static bool isGuardVariableSymbol(llvm::StringRef mangled_symbol) {
return mangled_symbol.startswith("_ZGV") || // Itanium ABI
mangled_symbol.endswith("@4IA"); // Microsoft ABI
}

bool IRForTarget::CreateResultVariable(llvm::Function &llvm_function) {
Expand All @@ -181,9 +178,8 @@ bool IRForTarget::CreateResultVariable(llvm::Function &llvm_function) {
for (StringMapEntry<llvm::Value *> &value_symbol : value_symbol_table) {
result_name = value_symbol.first();

// 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);
// Check if this is a guard variable.
const bool is_guard_var = isGuardVariableSymbol(result_name);

if (result_name.contains("$__lldb_expr_result_ptr") && !is_guard_var) {
found_result = true;
Expand Down

0 comments on commit afd493e

Please sign in to comment.