Page MenuHomePhabricator

[clang] Add [is|set]Nested methods to NamespaceDecl
Needs ReviewPublic

Authored by njames93 on Nov 1 2020, 11:07 AM.

Details

Reviewers
rsmith
shafik
Summary

Adds support for NamespaceDecl to inform if its part of a nested namespace.
This flag only corresponds to the outer namespaces in a nested namespace declaration.
In this example:
namespace <X>::<Y>::<Z> {}
Only <X> and <Y> will be classified as nested.

This flag isn't meant for assisting in building the AST, more for static analysis and refactorings.

Diff Detail

Unit TestsFailed

TimeTest
370 mslinux > HWAddressSanitizer-x86_64.TestCases::sizes.cpp
Script: -- : 'RUN: at line 3'; /mnt/disks/ssd0/agent/llvm-project/build/./bin/clang --driver-mode=g++ -m64 -gline-tables-only -fsanitize=hwaddress -fuse-ld=lld -mcmodel=large -mllvm -hwasan-globals -mllvm -hwasan-use-short-granules -mllvm -hwasan-instrument-landing-pads=0 -mllvm -hwasan-instrument-personality-functions /mnt/disks/ssd0/agent/llvm-project/compiler-rt/test/hwasan/TestCases/sizes.cpp -nostdlib++ -lstdc++ -o /mnt/disks/ssd0/agent/llvm-project/build/projects/compiler-rt/test/hwasan/X86_64/TestCases/Output/sizes.cpp.tmp

Event Timeline

njames93 created this revision.Nov 1 2020, 11:07 AM
Herald added a project: Restricted Project. · View Herald Transcript
njames93 requested review of this revision.Nov 1 2020, 11:07 AM

Just a few minor nits. I'll leave the approving to the other reviewers.

clang/lib/AST/TextNodeDumper.cpp
1828

Can you also modify JSONNodeDumper::VisitNamespaceDecl ?

clang/lib/Sema/SemaDeclCXX.cpp
11169

Please change false to /*Nested=*/false.

shafik added inline comments.Nov 2 2020, 4:13 PM
clang/lib/AST/ASTContext.cpp
7866

As noted elsewhere instead of just false please use /*Nested*/ false

Also a little below.

njames93 updated this revision to Diff 302437.Nov 2 2020, 5:09 PM

Added JsonNodeDumper and argument comments.

Added JsonNodeDumper and argument comments.

Thanks, I've no further comments.

njames93 marked 3 inline comments as done.Nov 25 2020, 10:39 AM