Page MenuHomePhabricator

[clang-diff] Use the relative name for NamedDecls
ClosedPublic

Authored by johannes on Aug 1 2017, 1:57 PM.

Details

Reviewers
arphaman
bkramer
Summary

If the node is within a class or namespace, do not use its full
qualified name, but strip the namespace prefix.

Event Timeline

johannes created this revision.Aug 1 2017, 1:57 PM
johannes updated this revision to Diff 109310.Aug 2 2017, 2:59 AM

parent changed

+Ben who I believe had written a similar function once.

lib/Tooling/ASTDiff/ASTDiff.cpp
370–371

"If the is ..." doesn't parse.

bkramer edited edge metadata.Aug 7 2017, 6:47 AM

There's some similar code in tools/clang/lib/Tooling/Core/Lookup.cpp, it might make sense to share it. Otherwise this looks good.

lib/Tooling/ASTDiff/ASTDiff.cpp
384

Val.startswith(ContextPrefix)

arphaman edited edge metadata.Aug 14 2017, 7:44 AM

Please rebase, it doesn't apply cleanly anymore.

arphaman added inline comments.Aug 18 2017, 8:26 AM
lib/Tooling/ASTDiff/ASTDiff.cpp
375

You don't need to check both NamespaceDecl and TagDecl, since you can just do one if with a NamedDecl.

johannes updated this revision to Diff 111695.Aug 18 2017, 10:03 AM

only use Enums as namespace prefix in C++11

johannes added inline comments.Aug 18 2017, 10:04 AM
lib/Tooling/ASTDiff/ASTDiff.cpp
375

FunctionDecl should not be used for example

arphaman accepted this revision.Aug 21 2017, 9:00 AM

LG

lib/Tooling/ASTDiff/ASTDiff.cpp
375

Oh yeah, makes sense.

This revision is now accepted and ready to land.Aug 21 2017, 9:00 AM
johannes closed this revision.Aug 27 2017, 3:53 PM