[libclang] Only mark CXCursors for explicit attributes with a type
authorErik Verbruggen <erikjv@me.com>
Tue, 24 Apr 2018 08:39:46 +0000 (08:39 +0000)
committerErik Verbruggen <erikjv@me.com>
Tue, 24 Apr 2018 08:39:46 +0000 (08:39 +0000)
commitc068e9094a31e2372a0dcac7f570a545a6f78634
tree576fa5227230273cd8cf21e40c31af2d9f4b5afd
parent60b7132a7c41b3112c5afb01139564a4f6184002
[libclang] Only mark CXCursors for explicit attributes with a type

All attributes have a source range associated with it. However, implicit
attributes are added by the compiler, and not added because the user
wrote something in the input. So no token type should be set to
CXCursor_*Attr.

The problem was visible when a class gets marked by e.g.
MSInheritanceAttr, which has the full CXXRecordDecl's range as its
own range. The effect of marking that range as CXCursor_UnexposedAttr
was that all cursors for the record decl, including all child decls,
would become CXCursor_UnexposedAttr.

llvm-svn: 330692
clang/test/Index/annotate-tokens-unexposed.cpp [new file with mode: 0644]
clang/tools/libclang/CIndex.cpp