[PATCH] D30946: [ScopePrinting] Added support to print full scopes of types and declarations.
Simon Schröder via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Mar 14 09:40:23 PDT 2017
schroedersi created this revision.
Herald added subscribers: mgorny, klimek.
PrintingPolicy::SuppressScope was replaced by PrintingPolicy::Scope. Possible
values for PrintingPolicy::Scope are:
- FullScope: Print all nested name specifiers (including the global scope specifier). This is necessary if a printed non-absolute scope would not select the desired scope. Example: Consider the following code:
namespace Z { namespace Z { namespace Y { class X { }; // (1) } } namespace Y { class X { }; // (2) } // (3) }
Printing type ::Z::Y::X (marked with (2)) without FullScope results in "Z::Y::X". If this is used at the position marked with (3), it will select the wrong type ::Z::Z::Y::X (marked with (1)). With FullScope the result is "::Z::Y::X" and the correct type is selected. Please note that in some cases it is not possible to print the full scope. For example in case of a local class or a dependent name.
- DefaultScope: This corresponds to the previous behavior with SuppressScope==false: In case of an elaborated type, print the outer scope as written in the source. (If there is a tag keyword and no scope in the source then no scope is printed.) Otherwise print the full scope but without the global scope specifier. This distinction is made for inner scopes recursively.
- SuppressScope: Do not print any scope.
https://reviews.llvm.org/D30946
Files:
include/clang/AST/PrettyPrinter.h
include/clang/AST/TemplateName.h
lib/AST/Decl.cpp
lib/AST/NestedNameSpecifier.cpp
lib/AST/TemplateName.cpp
lib/AST/TypePrinter.cpp
lib/CodeGen/CGDebugInfo.cpp
lib/Tooling/Core/QualTypeNames.cpp
test/CXX/class.access/p6.cpp
unittests/AST/AbsoluteScopeTest.cpp
unittests/AST/CMakeLists.txt
unittests/AST/NamedDeclPrinterTest.cpp
unittests/AST/TypePrinterTest.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D30946.91739.patch
Type: text/x-patch
Size: 49505 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170314/62e534d6/attachment-0001.bin>
More information about the cfe-commits
mailing list