aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Sema/SemaCodeComplete.cpp
diff options
context:
space:
mode:
authorNathan Ridge <zeratul976@hotmail.com>2024-03-25 23:54:40 -0400
committerGitHub <noreply@github.com>2024-03-25 23:54:40 -0400
commitbc31be7949a3d5382be0e15e3957fa957da9de45 (patch)
tree388d99ee114d11c9ec08c8b3b4f560fbbcb1f91f /clang/lib/Sema/SemaCodeComplete.cpp
parenta6b870db091830844431f77eb47aa30fc1d70bed (diff)
downloadllvm-bc31be7949a3d5382be0e15e3957fa957da9de45.zip
llvm-bc31be7949a3d5382be0e15e3957fa957da9de45.tar.gz
llvm-bc31be7949a3d5382be0e15e3957fa957da9de45.tar.bz2
[clang][CodeComplete] Handle deref operator in getApproximateType (#86466)
This allows completing after `(*this).` in a dependent context. Fixes https://github.com/clangd/clangd/issues/1952
Diffstat (limited to 'clang/lib/Sema/SemaCodeComplete.cpp')
-rw-r--r--clang/lib/Sema/SemaCodeComplete.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaCodeComplete.cpp b/clang/lib/Sema/SemaCodeComplete.cpp
index 73e6baa..83ebcaf 100644
--- a/clang/lib/Sema/SemaCodeComplete.cpp
+++ b/clang/lib/Sema/SemaCodeComplete.cpp
@@ -20,6 +20,7 @@
#include "clang/AST/ExprConcepts.h"
#include "clang/AST/ExprObjC.h"
#include "clang/AST/NestedNameSpecifier.h"
+#include "clang/AST/OperationKinds.h"
#include "clang/AST/QualTypeNames.h"
#include "clang/AST/RecursiveASTVisitor.h"
#include "clang/AST/Type.h"
@@ -5678,6 +5679,10 @@ QualType getApproximateType(const Expr *E) {
return getApproximateType(VD->getInit());
}
}
+ if (const auto *UO = llvm::dyn_cast<UnaryOperator>(E)) {
+ if (UO->getOpcode() == UnaryOperatorKind::UO_Deref)
+ return UO->getSubExpr()->getType()->getPointeeType();
+ }
return Unresolved;
}