Page MenuHomePhabricator

[clang] Traverse enum integer-base specifiers in RAV

Authored by kadircet on Oct 6 2021, 5:58 AM.



Visit enum integer-base specifiers explicitly written in the code.

This is achieved by:

  • traversing the typeloc for integer-base on enum decls when they are spelled in the code (similar to base-specifiers for CXXRecordDecls).
  • Visiting the typesourceinfo for integer-base in libindex, similar to base-specifiers.

Diff Detail

Unit TestsFailed

1,000 msx64 debian > Clangd Unit Tests._/ClangdTests::LocateSymbol.All
Script: -- /var/lib/buildkite-agent/builds/llvm-project/build/tools/clang/tools/extra/clangd/unittests/./ClangdTests --gtest_filter=LocateSymbol.All

Event Timeline

kadircet created this revision.Oct 6 2021, 5:58 AM
kadircet requested review of this revision.Oct 6 2021, 5:58 AM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptOct 6 2021, 5:58 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
kadircet updated this revision to Diff 377527.Oct 6 2021, 6:48 AM
  • Fix tests
hokein added a comment.Oct 6 2021, 7:03 AM

the RAV change looks good.

I think it might be worth to split this patch (one for RAV, one for libindex).


we have unittests for RAV, they are in clang/unittests/Tooling/RecursiveASTVisitorTests/, but unfortunately, we don't have one for enum decl, we can create one.


this seem to work if the D is a definition, I think it won't report the reference if the enum decl is a declaration.

typedef int MyTypedef;
enum Foo : MyTypedef;

This seems to be a copy-paste error.

kadircet updated this revision to Diff 377652.Oct 6 2021, 1:04 PM
kadircet marked 3 inline comments as done.
  • split changes in libindex
  • fix the issue with non-traversal of forward-decls
  • add unittests into RAV
sammccall accepted this revision.Oct 6 2021, 1:52 PM
sammccall added inline comments.
130 ↗(On Diff #377652)

Update/remove comment?

This revision is now accepted and ready to land.Oct 6 2021, 1:52 PM