@@ -2184,22 +2184,29 @@ std::string Converter::ConvertDeclRefExpr(clang::DeclRefExpr *expr) {
21842184
21852185 auto *decl = expr->getDecl ();
21862186 if (ShouldReplaceWithMappedBody (expr)) {
2187- return GetMappedAsString (expr);
2188- } else if (auto *function = decl->getAsFunction ()) {
2187+ if (auto str = GetMappedAsString (expr); !str.empty ()) {
2188+ return str;
2189+ }
2190+ }
2191+
2192+ if (auto *function = decl->getAsFunction ()) {
21892193 if (auto method = clang::dyn_cast<clang::CXXMethodDecl>(function)) {
21902194 if (method->isStatic ()) {
21912195 return std::format (" {}::{}" , GetRecordName (method->getParent ()),
21922196 GetNamedDeclAsString (method));
21932197 }
21942198 }
21952199 return GetNamedDeclAsString (function->getCanonicalDecl ());
2196- } else if (auto enum_constant =
2197- clang::dyn_cast<clang::EnumConstantDecl>(decl)) {
2200+ }
2201+
2202+ if (auto enum_constant = clang::dyn_cast<clang::EnumConstantDecl>(decl)) {
21982203 return std::format (" {}::{}" ,
21992204 GetRecordName (clang::dyn_cast<clang::EnumDecl>(
22002205 enum_constant->getDeclContext ())),
22012206 std::string_view (enum_constant->getName ()));
2202- } else if (IsGlobalVar (expr)) {
2207+ }
2208+
2209+ if (IsGlobalVar (expr)) {
22032210 return ReplaceAll (Mapper::ToString (expr->getDecl ()), " ::" , " _" );
22042211 }
22052212
@@ -3657,7 +3664,7 @@ bool Converter::ShouldReplaceWithMappedBody(clang::DeclRefExpr *expr) const {
36573664 if (clang::isa<clang::FunctionDecl>(expr->getDecl ()) && isAddrOf ()) {
36583665 return false ;
36593666 }
3660- return Mapper::Contains (expr) ;
3667+ return true ;
36613668}
36623669
36633670void Converter::SetFresh () {
0 commit comments