[PATCH] D12426: Omitting debug info function entry for functions that has no code.

Amjad Aboud via llvm-commits llvm-commits at lists.llvm.org
Sun Aug 30 01:54:16 PDT 2015


aaboud added a comment.

In http://reviews.llvm.org/D12426#235241, @echristo wrote:

> Hmm? What's the motivation here?
>
> -eric


As I said, we need this for the fix in http://reviews.llvm.org/D11180.
The example we are trying to fix is:
void f1() {

  while (true) {
    struct nested {
      static void f2() {}
    };
    nested::f2();
  }

}

Once we start supporting lexical block context for local types (i.e. the structure "nested" in the example), we assume that if a local type is needed, there must be a code in the lexical block containing that type or any of its nested blocks.
LexicalScopes component will handle any lexical block that contains code (directly or indirectly), but will skip those that does not have code.

In the above example (when compiled with "-inline") the lexical block "while" will contain no code, and thus will not be handled or emitted.
However, at endModule, we still try to emit an entry for the "nested::f2" function, even though there is no code associated to this function.
Doing that lead us trying to emit an entry for the structure "nested" because "f2" is a method in that structure, and there is where we will fail, because the lexical block "while" was not handled or created.

I discussed this with David, and suggested that we stop emitting such functions that has no association for source line, user will not be able to break in them anyway...

So, this is the reason for this patch.
Now the question would be: "is there any reason why we should not omit debug info for these functions?"


Repository:
  rL LLVM

http://reviews.llvm.org/D12426





More information about the llvm-commits mailing list