To be used in clangd, e.g. in D66647.
Currently the alternative to this function is doing string manipulation on results of printQualifiedName, which is
hard-to-impossible to get right in presence of template arguments.
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
clang/include/clang/AST/Decl.h | ||
---|---|---|
313 ↗ | (On Diff #220998) | This doesn't return anything, so I think a better way to phrase the comment is "Prints only the nested name specifier, including a trailing :: at the end. e.g., if printQualifiedName(D) prints "A::B::i", this function prints "A::B::".` |
317–318 ↗ | (On Diff #220998) | I'm not keen on "qualifier" here because types have qualifiers. How about printNestedNameSpecifier()? |
- Update comments
- Rename new function to printNestedNameSpecifier
clang/include/clang/AST/Decl.h | ||
---|---|---|
313 ↗ | (On Diff #220998) | Good point, thanks! |
317–318 ↗ | (On Diff #220998) | Now I understand why we clang uses 'nested name specifier' everywhere! |
LGTM, I know it is trivial, but some more unittests wouldn't hurt anyone :D
Also could you update the summary to mention "doing string manipulations in the presence of template arguments is hard?"
Yeah, good point, I'll add a few besides tests for printQualifiedName.
Also could you update the summary to mention "doing string manipulations in the presence of template arguments is hard?"
Done.
LGTM!
clang/include/clang/AST/Decl.h | ||
---|---|---|
317–318 ↗ | (On Diff #220998) | I think it'd be a pretty large undertaking to hit all of the places where we talk about qualifiers to get to the point where that distinction makes sense. I think we should just stick with nested name specifier, as that's a term of art from the standard for this concept. |
clang/include/clang/AST/Decl.h | ||
---|---|---|
317–318 ↗ | (On Diff #220998) | Fully agree, it's too late to change it at this point. |