[PATCH] D75193: [clangd] Get rid of lexer usage in AST.cpp
Kadir Cetinkaya via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Feb 27 09:46:36 PST 2020
This revision was automatically updated to reflect the committed changes.
Closed by commit rGf31fc1043d38: [clangd] Get rid of lexer usage in AST.cpp (authored by kadircet).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D75193/new/
https://reviews.llvm.org/D75193
Files:
clang-tools-extra/clangd/AST.cpp
clang-tools-extra/clangd/AST.h
Index: clang-tools-extra/clangd/AST.h
===================================================================
--- clang-tools-extra/clangd/AST.h
+++ clang-tools-extra/clangd/AST.h
@@ -109,7 +109,6 @@
QualType declaredType(const TypeDecl *D);
/// Retrieves the deduced type at a given location (auto, decltype).
-/// Retuns None unless Loc starts an auto/decltype token.
/// It will return the underlying type.
llvm::Optional<QualType> getDeducedType(ASTContext &, SourceLocation Loc);
Index: clang-tools-extra/clangd/AST.cpp
===================================================================
--- clang-tools-extra/clangd/AST.cpp
+++ clang-tools-extra/clangd/AST.cpp
@@ -25,7 +25,6 @@
#include "clang/Basic/SourceManager.h"
#include "clang/Basic/Specifiers.h"
#include "clang/Index/USRGeneration.h"
-#include "clang/Lex/Lexer.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/Optional.h"
#include "llvm/ADT/STLExtras.h"
@@ -417,16 +416,8 @@
llvm::Optional<QualType> getDeducedType(ASTContext &ASTCtx,
SourceLocation Loc) {
- Token Tok;
- // Only try to find a deduced type if the token is auto or decltype.
- if (!Loc.isValid() ||
- Lexer::getRawToken(Loc, Tok, ASTCtx.getSourceManager(),
- ASTCtx.getLangOpts(), false) ||
- !Tok.is(tok::raw_identifier) ||
- !(Tok.getRawIdentifier() == "auto" ||
- Tok.getRawIdentifier() == "decltype")) {
+ if (!Loc.isValid())
return {};
- }
DeducedTypeVisitor V(Loc);
V.TraverseAST(ASTCtx);
if (V.DeducedType.isNull())
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D75193.246996.patch
Type: text/x-patch
Size: 1577 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200227/61dfd322/attachment.bin>
More information about the cfe-commits
mailing list