r189600 - Debug Info: generate a unique identifier for C++ struct, class, union, and enum.

Arthur O'Dwyer arthur.j.odwyer at gmail.com
Fri Aug 30 11:14:10 PDT 2013


On Thu, Aug 29, 2013 at 11:51 AM, Manman Ren <manman.ren at gmail.com> wrote:
> URL: http://llvm.org/viewvc/llvm-project?rev=189600&view=rev
> "Debug Info: generate a unique identifier for C++ struct, class, union, and enum."
>
> We use CXX mangler to generate unique identifier for external C++ struct,
> union, class and enum.

I may be misunderstanding the intent of this patch, but please make
sure it doesn't cause bad debugger behavior on common code such as

    ==file1.cc==
    extern class AllPublic;
    ...

    ==file2.cc==
    struct AllPublic {   // had been "class ... public:" until we
realized "struct" was shorter
        ...
    };

At least in C++11 (dcl.type.elab#3) the class-keys "class" and
"struct" may be used interchangeably, so the above code is legal
C++11, and you should make sure that the debug-info symbols for
AllPublic in file2.cc match up with the same symbols for AllPublic in
file1.cc.

(Old versions of Clang had QOI issues with
    class AllPublic; struct AllPublic { };
giving false-positive warnings. I don't know for sure that this has been fixed.)

-Arthur



More information about the cfe-commits mailing list