This is an archive of the discontinued LLVM Phabricator instance.

[Frontend] Delete -print-decl-contexts
ClosedPublic

Authored by MaskRay on Sep 26 2018, 12:12 AM.

Details

Summary

Its job is covered by -ast-dump. The option is rarely used and lacks many AST nodes which will lead to llvm_unreachable() crash.

Diff Detail

Repository
rL LLVM

Event Timeline

MaskRay created this revision.Sep 26 2018, 12:12 AM
MaskRay edited the summary of this revision. (Show Details)Sep 26 2018, 12:13 AM
MaskRay added a reviewer: Restricted Project.

A gentle ping :)

rsmith added a comment.Oct 1 2018, 2:32 PM

Do we need -print-decl-contexts at all? It's not exposed by the driver, not tested, not documented, has a very strange output format (the bracketing character supplies some information about the kind of declaration, but it's not clear *what* information), and it doesn't really seem to provide any value given that we also have the maintained, tested, and actively-used -ast-dump flag, as well as programmatic interfaces to this information via libclang.

The only reason I can see to keep it would be if there's some external tool that's parsing its output, which this patch would break.

lib/Frontend/ASTConsumers.cpp
423 ↗(On Diff #167054)

Was the change from +2 to +1 here intentional?

427–431 ↗(On Diff #167054)

You don't need a switch for this either. if (auto *ND = dyn_cast<NamedDecl>(I)) and ND->getDeclKindName() should work fine.

498–499 ↗(On Diff #167054)

You've lost this special case.

MaskRay updated this revision to Diff 167836.Oct 1 2018, 2:53 PM

Delete -print-decl-contexts

MaskRay updated this revision to Diff 167837.Oct 1 2018, 2:54 PM
MaskRay retitled this revision from [Frontend] Simplify -print-decl-contexts with DeclNodes.inc to [Frontend] Delete -print-decl-contexts.
MaskRay edited the summary of this revision. (Show Details)
MaskRay removed a reviewer: Restricted Project.

.

rsmith accepted this revision.Oct 1 2018, 3:18 PM

Looks good to me. Please first mail cfe-dev announcing this change and wait a day or so for anyone using this feature to speak up before committing.

test/Coverage/ast-printing.c
7 ↗(On Diff #167837)

Please reinstate this file and only remove the one RUN: line that tests -print-decl-contexts.

test/Coverage/ast-printing.cpp
7 ↗(On Diff #167837)

Likewise here.

This revision is now accepted and ready to land.Oct 1 2018, 3:18 PM
MaskRay updated this revision to Diff 167842.Oct 1 2018, 3:27 PM

Coverage/ast-printing.{c,cpp} contain other dumping tests. Don't delete them

MaskRay marked 3 inline comments as done.Oct 1 2018, 3:56 PM

Looks good to me. Please first mail cfe-dev announcing this change and wait a day or so for anyone using this feature to speak up before committing.

Thanks! Sent out http://lists.llvm.org/pipermail/cfe-dev/2018-October/059571.html

This revision was automatically updated to reflect the committed changes.