From a622484fa64e03a45832a95cda1ba61d512244a0 Mon Sep 17 00:00:00 2001 From: Ilya Biryukov Date: Mon, 26 Nov 2018 15:24:48 +0000 Subject: [Index] Expose USR generation for types Summary: Used in clangd. Reviewers: sammccall, ioeric Reviewed By: sammccall Subscribers: kadircet, cfe-commits Differential Revision: https://reviews.llvm.org/D52275 llvm-svn: 347558 --- clang/lib/Index/USRGeneration.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'clang/lib/Index') diff --git a/clang/lib/Index/USRGeneration.cpp b/clang/lib/Index/USRGeneration.cpp index b75aa252175..2c3c1867028 100644 --- a/clang/lib/Index/USRGeneration.cpp +++ b/clang/lib/Index/USRGeneration.cpp @@ -1105,6 +1105,17 @@ bool clang::index::generateUSRForMacro(StringRef MacroName, SourceLocation Loc, return false; } +bool clang::index::generateUSRForType(QualType T, ASTContext &Ctx, + SmallVectorImpl &Buf) { + if (T.isNull()) + return true; + T = T.getCanonicalType(); + + USRGenerator UG(&Ctx, Buf); + UG.VisitType(T); + return UG.ignoreResults(); +} + bool clang::index::generateFullUSRForModule(const Module *Mod, raw_ostream &OS) { if (!Mod->Parent) -- cgit v1.2.3