diff options
author | Ilya Biryukov <ibiryukov@google.com> | 2018-11-26 15:24:48 +0000 |
---|---|---|
committer | Ilya Biryukov <ibiryukov@google.com> | 2018-11-26 15:24:48 +0000 |
commit | a622484fa64e03a45832a95cda1ba61d512244a0 (patch) | |
tree | 24ed89528c481045ba34c8496d0b0dd8a1330d82 /clang/lib/Index | |
parent | d31220e0de0d8924e7c1f54d08d4515cfabb1aeb (diff) | |
download | bcm5719-llvm-a622484fa64e03a45832a95cda1ba61d512244a0.tar.gz bcm5719-llvm-a622484fa64e03a45832a95cda1ba61d512244a0.zip |
[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
Diffstat (limited to 'clang/lib/Index')
-rw-r--r-- | clang/lib/Index/USRGeneration.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
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<char> &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) |