This is an archive of the discontinued LLVM Phabricator instance.

add clang_Type_getFullyQualifiedName
AcceptedPublic

Authored by anderslanglands on Nov 19 2022, 10:33 PM.

Details

Reviewers
aaron.ballman
Summary

Not sure how to test this - adding it to c-index-test's PrintType will change *everything*, which doesn't seem like a great idea.

Diff Detail

Event Timeline

Herald added a project: Restricted Project. · View Herald TranscriptNov 19 2022, 10:33 PM
Herald added a subscriber: arphaman. · View Herald Transcript
anderslanglands requested review of this revision.Nov 19 2022, 10:33 PM
Herald added a project: Restricted Project. · View Herald TranscriptNov 19 2022, 10:33 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript

In terms of testing, I'd recommend adding -test-print-qualified-type and see if you can thread a qualified vs unqualified parameter through PrintType() and friends to try to share as much code as possible. You'll probably need new wrapper functions that calls PrintType with the correct argument value depending on which test is being run. WDYT?

clang/tools/libclang/CXType.cpp
318–325

Simplifying a bit and fixing up a naming convention nit.

Now tested by adding a -print-qualified-type-names flag to c-index-test and creating a (small) dedicated test in print-qualified-type.cpp

This looks like the right direction to me, but there's quite a few whitespace and formatting NFC changes in the patch. If you don't mind splitting those changes out into their own commit, that would be appreciated (feel free to land those changes without review given that they're only changing whitespace and other formatting).

clang/tools/c-index-test/c-index-test.c
378 ↗(On Diff #477085)
1787 ↗(On Diff #477085)

I'm not super familiar with c-index-test -- how certain are you that the client data will 1) be non-null, and 2) actually be a VisitorData pointer?

Re the whitespace - yeah that's me running clang-format on the whole function rather than just the lines I changed. I'll see if I can split those out.

clang/tools/c-index-test/c-index-test.c
1787 ↗(On Diff #477085)

This was just copy-pasted from another function. I'm as certain as I can be given that all the tests pass :\

clang/tools/c-index-test/c-index-test.c
1787 ↗(On Diff #477085)

From a quick scan, VisitorData is the only CXClientData struct used in the visitor callbacks, so I think we're safe.

Remove whitespace changes on unaffected lines

couple of little spaces I missed...

aaron.ballman accepted this revision.Nov 28 2022, 2:14 PM

LGTM!

clang/tools/c-index-test/c-index-test.c
1787 ↗(On Diff #477085)

Thanks! That matches what I was seeing as well, great.

This revision is now accepted and ready to land.Nov 28 2022, 2:14 PM