@@ -155,12 +155,6 @@ clang::NamedDecl *IRForTarget::DeclForGlobal(GlobalValue *global_val) {
155
155
return DeclForGlobal (global_val, m_module);
156
156
}
157
157
158
- // / Returns true iff the mangled symbol is for a static guard variable.
159
- static bool isGuardVariableSymbol (llvm::StringRef mangled_symbol) {
160
- return mangled_symbol.startswith (" _ZGV" ) || // Itanium ABI guard variable
161
- mangled_symbol.startswith (" @4IA" ); // Microsoft ABI guard variable
162
- }
163
-
164
158
bool IRForTarget::CreateResultVariable (llvm::Function &llvm_function) {
165
159
lldb_private::Log *log (
166
160
lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
@@ -179,14 +173,14 @@ bool IRForTarget::CreateResultVariable(llvm::Function &llvm_function) {
179
173
result_name = value_symbol.first ();
180
174
181
175
if (result_name.contains (" $__lldb_expr_result_ptr" ) &&
182
- !isGuardVariableSymbol ( result_name)) {
176
+ !result_name. startswith ( " _ZGV " )) {
183
177
found_result = true ;
184
178
m_result_is_pointer = true ;
185
179
break ;
186
180
}
187
181
188
182
if (result_name.contains (" $__lldb_expr_result" ) &&
189
- !isGuardVariableSymbol ( result_name)) {
183
+ !result_name. startswith ( " _ZGV " )) {
190
184
found_result = true ;
191
185
m_result_is_pointer = false ;
192
186
break ;
@@ -1534,12 +1528,14 @@ bool IRForTarget::ResolveExternals(Function &llvm_function) {
1534
1528
}
1535
1529
1536
1530
static bool isGuardVariableRef (Value *V) {
1537
- Constant *Old = dyn_cast<Constant>(V) ;
1531
+ Constant *Old = nullptr ;
1538
1532
1539
- if (!Old)
1533
+ if (!( Old = dyn_cast<Constant>(V)) )
1540
1534
return false ;
1541
1535
1542
- if (auto CE = dyn_cast<ConstantExpr>(V)) {
1536
+ ConstantExpr *CE = nullptr ;
1537
+
1538
+ if ((CE = dyn_cast<ConstantExpr>(V))) {
1543
1539
if (CE->getOpcode () != Instruction::BitCast)
1544
1540
return false ;
1545
1541
@@ -1548,8 +1544,12 @@ static bool isGuardVariableRef(Value *V) {
1548
1544
1549
1545
GlobalVariable *GV = dyn_cast<GlobalVariable>(Old);
1550
1546
1551
- if (!GV || !GV->hasName () || !isGuardVariableSymbol (GV->getName ()))
1547
+ if (!GV || !GV->hasName () ||
1548
+ (!GV->getName ().startswith (" _ZGV" ) && // Itanium ABI guard variable
1549
+ !GV->getName ().endswith (" @4IA" ))) // Microsoft ABI guard variable
1550
+ {
1552
1551
return false ;
1552
+ }
1553
1553
1554
1554
return true ;
1555
1555
}
0 commit comments