CodegenNameGeneratorImpl is the most complete implementation of name mangling but it is in clang::Index. This makes it very difficult to use it elsewhere in clang. This is just a NFC refactoring of CodegenNameGeneratorImpl into a class called ASTNameGenerator. Other than the name and placement change there is no functional change.
Details
- Reviewers
compnerd ahatanak akyrtzi aaron.ballman - Commits
- rG3ff8c3b73f6d: [clang][AST] ASTNameGenerator: A refactoring of CodegenNameGeneratorImpl (NFC).
rC363878: [clang][AST] ASTNameGenerator: A refactoring of CodegenNameGeneratorImpl (NFC).
rL363878: [clang][AST] ASTNameGenerator: A refactoring of CodegenNameGeneratorImpl (NFC).
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
clang/include/clang/AST/Mangle.h | ||
---|---|---|
19 | Move these into the implementation, forward declarations should be sufficient. | |
21 | This isn't used, it belongs in the implementation. | |
25 | Is Mangler used in the header? I think this can be in the implementation. | |
253 | I think I prefer ASTNameGenerator or even ASTNameMangler (though I am partial to Microsoft's term: "decoration"). |
clang/include/clang/AST/Mangle.h | ||
---|---|---|
249–250 | Do these still need to be public members? Back when this class was an implementation detail, that didn't matter as much, but I'd prefer a cleaner public interface before we expose this to other consumers. |
clang/include/clang/AST/Mangle.h | ||
---|---|---|
248 | Please make this a class and hide the members, exposing just the constructor and the 3 methods as @aaron.ballman pointed out that this is a struct not a class! I missed that. |
clang/include/clang/AST/Mangle.h | ||
---|---|---|
249–250 | Good catch! This was a struct when it was CodegenNameGeneratorImpl but these were hidden by the mere fact that they were inside the .cpp file and not in a header. Thanks! |
Update to address @aaron.ballman's catch that ASTNameGenerator was not private enough.
LGTM with a few nits.
clang/include/clang/AST/Mangle.h | ||
---|---|---|
253 | Slight preference to make this constructor explicit since it only accepts a single argument and I can't imagine wanting a converting constructor there. | |
clang/lib/AST/Mangle.cpp | ||
25 | Do we have to link in any new libraries in CMake for this new dependency? |
clang/lib/AST/Mangle.cpp | ||
---|---|---|
25 | I don't believe so. It builds and make check-clangs. I will try a shared lib build too. It looks like AST things are already included, and LLVM things are already included so I doubt any new library dep change is needed at all. |
Move these into the implementation, forward declarations should be sufficient.