This provides better support for TypeLocs to allow TypeLoc-related
matchers to feature stricter typing and to avoid relying on the dynamic
casting of TypeLocs in matchers.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
- Build Status
Buildable 126613 Build 183956: arc lint + arc unit
Event Timeline
Looks good! Please add a test to be sure it compiles/works correctly. Thanks!
clang/include/clang/AST/ASTTypeTraits.h | ||
---|---|---|
57 | Here and below -- looks like clang format did this? I'd recommend you revert this line and others like it -- only change formatting on lines you've otherwise edited. |
clang/include/clang/AST/ASTTypeTraits.h | ||
---|---|---|
476 | The create/get don't seem to match. If we instead construct a T in create(), we should be able to read it as a BaseT* (assuming is_pointer_interconvertible_base_of<BaseT, T> is true) |
clang/include/clang/AST/ASTTypeTraits.h | ||
---|---|---|
476 | Done, constructing a T instead of a BaseT seems to work! |
clang/unittests/AST/ASTTypeTraitsTest.cpp | ||
---|---|---|
207 ↗ | (On Diff #376573) | let's assert that matches.size() == 1 and then just use nodes[0]. |
clang/unittests/AST/ASTTypeTraitsTest.cpp | ||
---|---|---|
212 ↗ | (On Diff #376610) | I don't know what we are trying to check with this self equivalence. |
225 ↗ | (On Diff #376610) | We should check that we can do getNodeAs<PointerTypeLoc> and getNodeAs<TypeLoc>. |
clang/unittests/AST/ASTTypeTraitsTest.cpp | ||
---|---|---|
212 ↗ | (On Diff #376610) | These two EXPECTs are meant to ensure that the overloaded equality and less-than operators do function correctly when handling nodes of the TypeLoc family. In both cases, there is behavior specifically for these nodes, and I've made minor updates to both (changing isSame to isBaseOf). Additionally, this may give a little more confidence that template specialization functioned correctly. I will note that the QualType test performs a similar set of checks, presumably for similar reasoning. |
clang/unittests/AST/ASTTypeTraitsTest.cpp | ||
---|---|---|
234 ↗ | (On Diff #376901) | Maybe also check EXPECT_EQ(&tl, &ptl); ? |
Here and below -- looks like clang format did this? I'd recommend you revert this line and others like it -- only change formatting on lines you've otherwise edited.