This is an archive of the discontinued LLVM Phabricator instance.

[AST] Add introspection support for more base nodes
ClosedPublic

Authored by steveire on Mar 23 2021, 5:26 PM.

Details

Summary

Replace an assert for a CXXCtorInitializer SourceLocation with a
condition, as was done for other locations in commit 54272e5b (NFC:
Replace asserts with if() in SourceLocation accessors, 2019-01-07).

Fix the logic of detecting pseudo-virtual getBeginLoc etc on Stmt and
Decl subclasses.

Adjust the test infrastructure to filter out invalid source locations.
This makes the tests more clear about which nodes have which locations.

Diff Detail

Event Timeline

steveire created this revision.Mar 23 2021, 5:26 PM
steveire requested review of this revision.Mar 23 2021, 5:26 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 23 2021, 5:26 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript
steveire updated this revision to Diff 336651.Apr 11 2021, 3:45 AM

Add locations for CXXBaseSpecifier

njames93 added inline comments.Apr 11 2021, 4:05 AM
clang/include/clang/AST/DeclCXX.h
2270 ↗(On Diff #336651)

I'm not sure about this change, but I'm guessing there's not a nice way to predicate these kinds of things

steveire updated this revision to Diff 336804.Apr 12 2021, 4:33 AM

Update

clang/include/clang/AST/DeclCXX.h
2270 ↗(On Diff #336651)

Yep.

njames93 added inline comments.
clang/include/clang/AST/DeclCXX.h
2270 ↗(On Diff #336651)

@rsmith @aaron.ballman Any issues with changing the contract of these functions to not assert for the purpose of this feature?

steveire added inline comments.Apr 13 2021, 3:37 PM
clang/include/clang/AST/DeclCXX.h
2270 ↗(On Diff #336651)

This was really just missing from https://github.com/llvm/llvm-project/commit/54272e5b , as in the commit message.

aaron.ballman added inline comments.Apr 14 2021, 5:43 AM
clang/include/clang/AST/DeclCXX.h
2270 ↗(On Diff #336651)

I'm fine with such a change, thanks!

njames93 accepted this revision.Apr 14 2021, 6:15 AM
This revision is now accepted and ready to land.Apr 14 2021, 6:15 AM