[clang] Add option to generate additional debug info for expression dereferencing pointer to pointers. (PR #81545)

2024-03-06 Thread Namhyung Kim via cfe-commits


@@ -5636,6 +5636,31 @@ void 
CGDebugInfo::EmitExternalVariable(llvm::GlobalVariable *Var,
   Var->addDebugInfo(GVE);
 }
 
+void CGDebugInfo::EmitPseudoVariable(llvm::AllocaInst *Alloca, QualType Ty,
+ SourceLocation Loc) {
+  llvm::DIFile *Unit = getOrCreateFile(Loc);
+  unsigned Line = getLineNumber(Loc);
+  unsigned Column = getColumnNumber(Loc);
+  llvm::DILocalVariable *D = DBuilder.createAutoVariable(
+  LexicalBlockStack.back(), Alloca->getName(), getOrCreateFile(Loc), Line,

namhyung wrote:

Can it generate a variable without name?  I think name is useless here and just 
bloats the binary size.

https://github.com/llvm/llvm-project/pull/81545
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] Add option to generate additional debug info for expression dereferencing pointer to pointers. (PR #81545)

2024-03-06 Thread Namhyung Kim via cfe-commits

namhyung wrote:

Also I think it generates variables for destination of pointers, not the 
source.  For example, if we have `a->b->c`, what we need is variables for `a` 
and `b`.  Usually it would already have one for `a`, so it can skip generating 
it (unless there's a difference like due to type cases), and it'd be enough to 
just generate one for `b`.

https://github.com/llvm/llvm-project/pull/81545
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits