r356541 - [clangd] Print arguments in template specializations
Kadir Cetinkaya via cfe-commits
cfe-commits at lists.llvm.org
Wed Mar 20 02:43:38 PDT 2019
Author: kadircet
Date: Wed Mar 20 02:43:38 2019
New Revision: 356541
URL: http://llvm.org/viewvc/llvm-project?rev=356541&view=rev
Log:
[clangd] Print arguments in template specializations
Reviewers: ilya-biryukov
Subscribers: ioeric, MaskRay, jkorous, arphaman, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D59354
Modified:
cfe/trunk/lib/AST/TypePrinter.cpp
Modified: cfe/trunk/lib/AST/TypePrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/TypePrinter.cpp?rev=356541&r1=356540&r2=356541&view=diff
==============================================================================
--- cfe/trunk/lib/AST/TypePrinter.cpp (original)
+++ cfe/trunk/lib/AST/TypePrinter.cpp Wed Mar 20 02:43:38 2019
@@ -1632,6 +1632,21 @@ static const TemplateArgument &getArgume
return A.getArgument();
}
+static void printArgument(const TemplateArgument &A, const PrintingPolicy &PP,
+ llvm::raw_ostream &OS) {
+ A.print(PP, OS);
+}
+
+static void printArgument(const TemplateArgumentLoc &A,
+ const PrintingPolicy &PP, llvm::raw_ostream &OS) {
+ const auto &Kind = A.getArgument().getKind();
+ assert(Kind != TemplateArgument::Null &&
+ "TemplateArgumentKind can not be null!");
+ if (Kind == TemplateArgument::ArgKind::Type)
+ return A.getTypeSourceInfo()->getType().print(OS, PP);
+ return A.getArgument().print(PP, OS);
+}
+
template<typename TA>
static void printTo(raw_ostream &OS, ArrayRef<TA> Args,
const PrintingPolicy &Policy, bool SkipBrackets) {
@@ -1653,7 +1668,7 @@ static void printTo(raw_ostream &OS, Arr
} else {
if (!FirstArg)
OS << Comma;
- Argument.print(Policy, ArgOS);
+ printArgument(Arg, Policy, ArgOS);
}
StringRef ArgString = ArgOS.str();
More information about the cfe-commits
mailing list