[PATCH] Mangling of local names: anonymous unions, names in dead code

Reid Kleckner rnk at google.com
Wed Nov 19 09:52:16 PST 2014


I don't think we should change our behavior w.r.t. static locals of non-inline functions. This behavior should stay the same:
  void f() {
    if (0) {
      static int a = 0;
    }
    static int a = 0; // _ZZ1fvE1a
  }

  inline void f() {
    if (0) {
      static int a = 0;
    }
    static int a = 0; // _ZZ1fvE1a_0
  }

The reason is that in the non-inline case, we don't want to waste time during Sema building up tables on the ASTContext. The name is not ABI relevant, and either name is as good as the next.

I agree with your assessment of the static local union case, though. It's not clear to me how your fix works, but maybe -ast-dump isn't complete enough for me to see the IndirectFieldDecl that you're finding.

http://reviews.llvm.org/D6295






More information about the cfe-commits mailing list