[clang][Sema] Upstream HeuristicResolver from clangd (#121314)
Fixes https://github.com/llvm/llvm-project/issues/121310
This commit is contained in:
parent
d6315afff0
commit
ae932becb2
@ -91,7 +91,6 @@ add_clang_library(clangDaemon STATIC
|
||||
GlobalCompilationDatabase.cpp
|
||||
Headers.cpp
|
||||
HeaderSourceSwitch.cpp
|
||||
HeuristicResolver.cpp
|
||||
Hover.cpp
|
||||
IncludeCleaner.cpp
|
||||
IncludeFixer.cpp
|
||||
|
||||
@ -8,7 +8,6 @@
|
||||
|
||||
#include "FindTarget.h"
|
||||
#include "AST.h"
|
||||
#include "HeuristicResolver.h"
|
||||
#include "support/Logger.h"
|
||||
#include "clang/AST/ASTConcept.h"
|
||||
#include "clang/AST/ASTTypeTraits.h"
|
||||
@ -35,6 +34,7 @@
|
||||
#include "clang/Basic/SourceLocation.h"
|
||||
#include "clang/Basic/SourceManager.h"
|
||||
#include "clang/Basic/Specifiers.h"
|
||||
#include "clang/Sema/HeuristicResolver.h"
|
||||
#include "llvm/ADT/STLExtras.h"
|
||||
#include "llvm/ADT/SmallVector.h"
|
||||
#include "llvm/ADT/StringExtras.h"
|
||||
|
||||
@ -33,9 +33,11 @@
|
||||
#include <bitset>
|
||||
|
||||
namespace clang {
|
||||
namespace clangd {
|
||||
|
||||
class HeuristicResolver;
|
||||
|
||||
namespace clangd {
|
||||
|
||||
/// Describes the link between an AST node and a Decl it refers to.
|
||||
enum class DeclRelation : unsigned;
|
||||
/// A bitfield of DeclRelations.
|
||||
|
||||
@ -9,7 +9,6 @@
|
||||
#include "../clang-tidy/utils/DesignatedInitializers.h"
|
||||
#include "AST.h"
|
||||
#include "Config.h"
|
||||
#include "HeuristicResolver.h"
|
||||
#include "ParsedAST.h"
|
||||
#include "Protocol.h"
|
||||
#include "SourceCode.h"
|
||||
@ -27,6 +26,7 @@
|
||||
#include "clang/Basic/OperatorKinds.h"
|
||||
#include "clang/Basic/SourceLocation.h"
|
||||
#include "clang/Basic/SourceManager.h"
|
||||
#include "clang/Sema/HeuristicResolver.h"
|
||||
#include "llvm/ADT/DenseSet.h"
|
||||
#include "llvm/ADT/STLExtras.h"
|
||||
#include "llvm/ADT/SmallVector.h"
|
||||
|
||||
@ -20,7 +20,6 @@
|
||||
#include "Feature.h"
|
||||
#include "FeatureModule.h"
|
||||
#include "Headers.h"
|
||||
#include "HeuristicResolver.h"
|
||||
#include "IncludeCleaner.h"
|
||||
#include "IncludeFixer.h"
|
||||
#include "Preamble.h"
|
||||
@ -53,6 +52,7 @@
|
||||
#include "clang/Lex/Lexer.h"
|
||||
#include "clang/Lex/PPCallbacks.h"
|
||||
#include "clang/Lex/Preprocessor.h"
|
||||
#include "clang/Sema/HeuristicResolver.h"
|
||||
#include "clang/Serialization/ASTWriter.h"
|
||||
#include "clang/Tooling/CompilationDatabase.h"
|
||||
#include "clang/Tooling/Core/Diagnostic.h"
|
||||
|
||||
@ -38,9 +38,9 @@
|
||||
#include <vector>
|
||||
|
||||
namespace clang {
|
||||
class HeuristicResolver;
|
||||
class Sema;
|
||||
namespace clangd {
|
||||
class HeuristicResolver;
|
||||
|
||||
/// Stores and provides access to parsed AST.
|
||||
class ParsedAST {
|
||||
|
||||
@ -9,7 +9,6 @@
|
||||
#include "SemanticHighlighting.h"
|
||||
#include "Config.h"
|
||||
#include "FindTarget.h"
|
||||
#include "HeuristicResolver.h"
|
||||
#include "ParsedAST.h"
|
||||
#include "Protocol.h"
|
||||
#include "SourceCode.h"
|
||||
@ -27,6 +26,7 @@
|
||||
#include "clang/Basic/LangOptions.h"
|
||||
#include "clang/Basic/SourceLocation.h"
|
||||
#include "clang/Basic/SourceManager.h"
|
||||
#include "clang/Sema/HeuristicResolver.h"
|
||||
#include "clang/Tooling/Syntax/Tokens.h"
|
||||
#include "llvm/ADT/STLExtras.h"
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
|
||||
@ -10,7 +10,6 @@
|
||||
#include "FindSymbols.h"
|
||||
#include "FindTarget.h"
|
||||
#include "Headers.h"
|
||||
#include "HeuristicResolver.h"
|
||||
#include "IncludeCleaner.h"
|
||||
#include "ParsedAST.h"
|
||||
#include "Protocol.h"
|
||||
@ -53,6 +52,7 @@
|
||||
#include "clang/Index/IndexingOptions.h"
|
||||
#include "clang/Index/USRGeneration.h"
|
||||
#include "clang/Lex/Lexer.h"
|
||||
#include "clang/Sema/HeuristicResolver.h"
|
||||
#include "clang/Tooling/Syntax/Tokens.h"
|
||||
#include "llvm/ADT/ArrayRef.h"
|
||||
#include "llvm/ADT/DenseMap.h"
|
||||
|
||||
@ -64,7 +64,6 @@ add_unittest(ClangdUnitTests ClangdTests
|
||||
GlobalCompilationDatabaseTests.cpp
|
||||
HeadersTests.cpp
|
||||
HeaderSourceSwitchTests.cpp
|
||||
HeuristicResolverTests.cpp
|
||||
HoverTests.cpp
|
||||
IncludeCleanerTests.cpp
|
||||
IndexActionTests.cpp
|
||||
|
||||
@ -6,8 +6,8 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANGD_HEURISTICRESOLVER_H
|
||||
#define LLVM_CLANG_TOOLS_EXTRA_CLANGD_HEURISTICRESOLVER_H
|
||||
#ifndef LLVM_CLANG_SEMA_HEURISTICRESOLVER_H
|
||||
#define LLVM_CLANG_SEMA_HEURISTICRESOLVER_H
|
||||
|
||||
#include "clang/AST/Decl.h"
|
||||
#include <vector>
|
||||
@ -24,8 +24,6 @@ class NamedDecl;
|
||||
class Type;
|
||||
class UnresolvedUsingValueDecl;
|
||||
|
||||
namespace clangd {
|
||||
|
||||
// This class handles heuristic resolution of declarations and types in template
|
||||
// code.
|
||||
//
|
||||
@ -80,7 +78,6 @@ private:
|
||||
ASTContext &Ctx;
|
||||
};
|
||||
|
||||
} // namespace clangd
|
||||
} // namespace clang
|
||||
|
||||
#endif
|
||||
@ -19,6 +19,7 @@ add_clang_library(clangSema
|
||||
CodeCompleteConsumer.cpp
|
||||
DeclSpec.cpp
|
||||
DelayedDiagnostic.cpp
|
||||
HeuristicResolver.cpp
|
||||
HLSLExternalSemaSource.cpp
|
||||
IdentifierResolver.cpp
|
||||
JumpDiagnostics.cpp
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "HeuristicResolver.h"
|
||||
#include "clang/Sema/HeuristicResolver.h"
|
||||
#include "clang/AST/ASTContext.h"
|
||||
#include "clang/AST/CXXInheritance.h"
|
||||
#include "clang/AST/DeclTemplate.h"
|
||||
@ -14,7 +14,6 @@
|
||||
#include "clang/AST/Type.h"
|
||||
|
||||
namespace clang {
|
||||
namespace clangd {
|
||||
|
||||
namespace {
|
||||
|
||||
@ -466,5 +465,4 @@ const Type *HeuristicResolver::getPointeeType(const Type *T) const {
|
||||
return HeuristicResolverImpl(Ctx).getPointeeType(T);
|
||||
}
|
||||
|
||||
} // namespace clangd
|
||||
} // namespace clang
|
||||
@ -6,6 +6,7 @@ set(LLVM_LINK_COMPONENTS
|
||||
add_clang_unittest(SemaTests
|
||||
ExternalSemaSourceTest.cpp
|
||||
CodeCompleteTest.cpp
|
||||
HeuristicResolverTest.cpp
|
||||
GslOwnerPointerInference.cpp
|
||||
SemaLookupTest.cpp
|
||||
SemaNoloadLookupTest.cpp
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
#include "HeuristicResolver.h"
|
||||
#include "clang/Sema/HeuristicResolver.h"
|
||||
#include "clang/ASTMatchers/ASTMatchFinder.h"
|
||||
#include "clang/ASTMatchers/ASTMatchers.h"
|
||||
#include "clang/Tooling/Tooling.h"
|
||||
@ -13,7 +13,6 @@
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
using namespace clang::ast_matchers;
|
||||
using clang::clangd::HeuristicResolver;
|
||||
using testing::ElementsAre;
|
||||
|
||||
namespace clang {
|
||||
Loading…
x
Reference in New Issue
Block a user