Skip to content

Commit 1f6a96e

Browse files
committed
hide field access methods
Signed-off-by: Jade Abraham <[email protected]>
1 parent fbd4270 commit 1f6a96e

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

compiler/codegen/cg-stmt.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,10 @@ void codegenStmt(Expr* stmt) {
5858
info->cStatements.push_back(idCommentTemp(stmt));
5959
} else {
6060
#ifdef HAVE_LLVM
61-
if (debugInfo && stmt->linenum() > 0) {
61+
if (debugInfo &&
62+
stmt->linenum() > 0 &&
63+
(!stmt->parentSymbol ||
64+
debugInfo->shouldAddDebugInfoFor(stmt->parentSymbol))) {
6265
// Adjust the current line number, but leave the scope alone.
6366
llvm::MDNode* scope;
6467

compiler/codegen/cg-symbol.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2905,7 +2905,7 @@ void FnSymbol::codegenDef() {
29052905

29062906
info->lvt->addLayer();
29072907

2908-
if(debugInfo) {
2908+
if (debugInfo && debugInfo->shouldAddDebugInfoFor(this)) {
29092909
llvm::DISubprogram* dbgScope = debugInfo->getFunction(this);
29102910
info->irBuilder->SetCurrentDebugLocation(
29112911
llvm::DILocation::get(dbgScope->getContext(), linenum(), 0,

compiler/llvm/llvmDebug.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,14 @@ bool DebugData::shouldAddDebugInfoFor(Symbol* sym) {
322322
// skip non-user variables
323323
if (sym->hasFlag(FLAG_NO_USER_DEBUG_INFO)) return false;
324324

325+
326+
// skip functions that are field accessors or anything inside of them
327+
if (auto fn = sym->getFunction()) {
328+
if (fn->hasFlag(FLAG_FIELD_ACCESSOR)) {
329+
return false;
330+
}
331+
}
332+
325333
// default to adding debug info
326334
return true;
327335
}

0 commit comments

Comments
 (0)