Skip to content

Commit a2fdb16

Browse files
committed
Fix a regression in debug metadata
Fix an issue which blocked the local binding that connects the !DILocalVariable to @llvm.dbg.declare. It was introduced in 7da0254 which intended to eliminate spurious local variables in the DWARF. This fix keeps the compiler created variable's name unexposed to the DWARF and restores the local binding as well.
1 parent fe9691b commit a2fdb16

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

tools/flang2/flang2exe/cgmain.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10334,7 +10334,7 @@ needDebugInfoFilt(SPTR sptr)
1033410334
return true;
1033510335
/* Fortran case needs to be revisited when we start to support debug, for now
1033610336
* just the obvious case */
10337-
return (!CCSYMG(sptr) || (DCLDG(sptr) && (STYPEG(sptr) == ST_ARRAY)));
10337+
return (!CCSYMG(sptr) || DCLDG(sptr));
1033810338
}
1033910339
#ifdef OMP_OFFLOAD_LLVM
1034010340
INLINE static bool

tools/flang2/flang2exe/lldebug.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1113,7 +1113,10 @@ lldbg_create_local_variable_mdnode(LL_DebugInfo *db, int dw_tag,
11131113
if (!ll_feature_debug_info_ver38(&db->module->ir))
11141114
llmd_add_i32(mdb, make_dwtag(db, dw_tag));
11151115
llmd_add_md(mdb, context);
1116-
llmd_add_string(mdb, name);
1116+
if (flags & DIFLAG_ARTIFICIAL)
1117+
llmd_add_string(mdb, ""); // Do not expose the name of compiler created variable.
1118+
else
1119+
llmd_add_string(mdb, name);
11171120
if (!ll_feature_dbg_local_variable_embeds_argnum(&db->module->ir))
11181121
llmd_add_i32(mdb, argnum);
11191122
llmd_add_md(mdb, fileref);

0 commit comments

Comments
 (0)