Its job is covered by -ast-dump. The option is rarely used and lacks many AST nodes which will lead to llvm_unreachable() crash.
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
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. |
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. |