[all-commits] [llvm/llvm-project] d4af86: [clangd] Fix type printing in the presence of qual...
Adam Czachorowski via All-commits
all-commits at lists.llvm.org
Fri Jan 8 08:11:09 PST 2021
Branch: refs/heads/master
Home: https://github.com/llvm/llvm-project
Commit: d4af86581e80ef0f7a6f4a4fff1c97260a726e71
https://github.com/llvm/llvm-project/commit/d4af86581e80ef0f7a6f4a4fff1c97260a726e71
Author: Adam Czachorowski <adamcz at google.com>
Date: 2021-01-08 (Fri, 08 Jan 2021)
Changed paths:
M clang-tools-extra/clangd/AST.cpp
M clang-tools-extra/clangd/unittests/tweaks/ExpandAutoTypeTests.cpp
M clang-tools-extra/clangd/unittests/tweaks/ExtractFunctionTests.cpp
M clang/include/clang/AST/PrettyPrinter.h
M clang/lib/AST/TypePrinter.cpp
Log Message:
-----------
[clangd] Fix type printing in the presence of qualifiers
When printing QualType with qualifiers like "const", or pointing to an
elaborated type, we would print garbage like:
std::const std::vector<int>&
with the initial std:: being calculated correctly, but inserted in the
wrong place and the second std:: not removed (due to elaborated type).
This affected, among others, ExtractFunction and ExpandAuto tweaks.
This change introduces a new callback to PrintingPolicy, which allows us
to influence the printing of namespace qualifiers. In the future, the
same callback can be used to improve handling of "using namespace"
directives as well.
Fixes:
https://github.com/clangd/clangd/issues/640 (ExtractFunction)
https://github.com/clangd/clangd/issues/264 (ExpandAuto)
First point of https://github.com/clangd/clangd/issues/524
Differential Revision: https://reviews.llvm.org/D94259
More information about the All-commits
mailing list