[PATCH] D12913: Fixed debug info emitting for imported entity defined directly in a function scope.

Amjad Aboud via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 24 08:40:19 PDT 2015


aaboud added a comment.

Thanks for your comments.
Answered below.


================
Comment at: lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp:336
@@ -335,3 +335,3 @@
 
-    unsigned ChildScopeCount;
+    bool HasNoneScopeChild;
 
----------------
aprantl wrote:
> HasNoneScopeChild is uninitialized here.
I guess it won't hurt to initialize it to "false", though the "createScopeChildrenDIE" will always initialize it.

================
Comment at: lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp:538
@@ -545,3 +537,3 @@
                                               SmallVectorImpl<DIE *> &Children,
-                                              unsigned *ChildScopeCount) {
+                                              bool *HasNoneScopeChild) {
   DIE *ObjectPointer = nullptr;
----------------
aprantl wrote:
> This should probably be a reference like Children.
It is a pointer and not a reference because not all callers need this information, so they can simply not send a place holder for this return info.

Notice that I followed the previous implementation, just changed the counter with an indicator, as the counter meant to be used as indication for if the lexical scope has some children that are not other lexical scopes.

================
Comment at: lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp:552
@@ +551,3 @@
+
+  if (HasNoneScopeChild)
+    *HasNoneScopeChild = Children.size() != 0;
----------------
aprantl wrote:
> This looks like a use of an undef variable?
Not exactly.
This checks that the pointer is not "nullptr".
HasNoneScopeChild is a pointer with a nullptr default value.
As not all callers interested in this information.


Repository:
  rL LLVM

http://reviews.llvm.org/D12913





More information about the llvm-commits mailing list