Skip to content

Commit 4f0e828

Browse files
[clang][Sema] Upstream HeuristicResolver from clangd
Fixes #121310
1 parent a6aa936 commit 4f0e828

File tree

14 files changed

+15
-19
lines changed

14 files changed

+15
-19
lines changed

clang-tools-extra/clangd/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,6 @@ add_clang_library(clangDaemon STATIC
9191
GlobalCompilationDatabase.cpp
9292
Headers.cpp
9393
HeaderSourceSwitch.cpp
94-
HeuristicResolver.cpp
9594
Hover.cpp
9695
IncludeCleaner.cpp
9796
IncludeFixer.cpp

clang-tools-extra/clangd/FindTarget.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88

99
#include "FindTarget.h"
1010
#include "AST.h"
11-
#include "HeuristicResolver.h"
1211
#include "support/Logger.h"
1312
#include "clang/AST/ASTConcept.h"
1413
#include "clang/AST/ASTTypeTraits.h"
@@ -35,6 +34,7 @@
3534
#include "clang/Basic/SourceLocation.h"
3635
#include "clang/Basic/SourceManager.h"
3736
#include "clang/Basic/Specifiers.h"
37+
#include "clang/Sema/HeuristicResolver.h"
3838
#include "llvm/ADT/STLExtras.h"
3939
#include "llvm/ADT/SmallVector.h"
4040
#include "llvm/ADT/StringExtras.h"

clang-tools-extra/clangd/FindTarget.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,11 @@
3333
#include <bitset>
3434

3535
namespace clang {
36-
namespace clangd {
36+
3737
class HeuristicResolver;
3838

39+
namespace clangd {
40+
3941
/// Describes the link between an AST node and a Decl it refers to.
4042
enum class DeclRelation : unsigned;
4143
/// A bitfield of DeclRelations.

clang-tools-extra/clangd/InlayHints.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
#include "../clang-tidy/utils/DesignatedInitializers.h"
1010
#include "AST.h"
1111
#include "Config.h"
12-
#include "HeuristicResolver.h"
1312
#include "ParsedAST.h"
1413
#include "Protocol.h"
1514
#include "SourceCode.h"
@@ -27,6 +26,7 @@
2726
#include "clang/Basic/OperatorKinds.h"
2827
#include "clang/Basic/SourceLocation.h"
2928
#include "clang/Basic/SourceManager.h"
29+
#include "clang/Sema/HeuristicResolver.h"
3030
#include "llvm/ADT/DenseSet.h"
3131
#include "llvm/ADT/STLExtras.h"
3232
#include "llvm/ADT/SmallVector.h"

clang-tools-extra/clangd/ParsedAST.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
#include "Feature.h"
2121
#include "FeatureModule.h"
2222
#include "Headers.h"
23-
#include "HeuristicResolver.h"
2423
#include "IncludeCleaner.h"
2524
#include "IncludeFixer.h"
2625
#include "Preamble.h"
@@ -53,6 +52,7 @@
5352
#include "clang/Lex/Lexer.h"
5453
#include "clang/Lex/PPCallbacks.h"
5554
#include "clang/Lex/Preprocessor.h"
55+
#include "clang/Sema/HeuristicResolver.h"
5656
#include "clang/Serialization/ASTWriter.h"
5757
#include "clang/Tooling/CompilationDatabase.h"
5858
#include "clang/Tooling/Core/Diagnostic.h"

clang-tools-extra/clangd/ParsedAST.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@
3838
#include <vector>
3939

4040
namespace clang {
41+
class HeuristicResolver;
4142
class Sema;
4243
namespace clangd {
43-
class HeuristicResolver;
4444

4545
/// Stores and provides access to parsed AST.
4646
class ParsedAST {

clang-tools-extra/clangd/SemanticHighlighting.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
#include "SemanticHighlighting.h"
1010
#include "Config.h"
1111
#include "FindTarget.h"
12-
#include "HeuristicResolver.h"
1312
#include "ParsedAST.h"
1413
#include "Protocol.h"
1514
#include "SourceCode.h"
@@ -27,6 +26,7 @@
2726
#include "clang/Basic/LangOptions.h"
2827
#include "clang/Basic/SourceLocation.h"
2928
#include "clang/Basic/SourceManager.h"
29+
#include "clang/Sema/HeuristicResolver.h"
3030
#include "clang/Tooling/Syntax/Tokens.h"
3131
#include "llvm/ADT/STLExtras.h"
3232
#include "llvm/ADT/StringRef.h"

clang-tools-extra/clangd/XRefs.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
#include "FindSymbols.h"
1111
#include "FindTarget.h"
1212
#include "Headers.h"
13-
#include "HeuristicResolver.h"
1413
#include "IncludeCleaner.h"
1514
#include "ParsedAST.h"
1615
#include "Protocol.h"
@@ -53,6 +52,7 @@
5352
#include "clang/Index/IndexingOptions.h"
5453
#include "clang/Index/USRGeneration.h"
5554
#include "clang/Lex/Lexer.h"
55+
#include "clang/Sema/HeuristicResolver.h"
5656
#include "clang/Tooling/Syntax/Tokens.h"
5757
#include "llvm/ADT/ArrayRef.h"
5858
#include "llvm/ADT/DenseMap.h"

clang-tools-extra/clangd/unittests/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ add_unittest(ClangdUnitTests ClangdTests
6464
GlobalCompilationDatabaseTests.cpp
6565
HeadersTests.cpp
6666
HeaderSourceSwitchTests.cpp
67-
HeuristicResolverTests.cpp
6867
HoverTests.cpp
6968
IncludeCleanerTests.cpp
7069
IndexActionTests.cpp

clang-tools-extra/clangd/HeuristicResolver.h renamed to clang/include/clang/Sema/HeuristicResolver.h

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9-
#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANGD_HEURISTICRESOLVER_H
10-
#define LLVM_CLANG_TOOLS_EXTRA_CLANGD_HEURISTICRESOLVER_H
9+
#ifndef LLVM_CLANG_SEMA_HEURISTICRESOLVER_H
10+
#define LLVM_CLANG_SEMA_HEURISTICRESOLVER_H
1111

1212
#include "clang/AST/Decl.h"
1313
#include <vector>
@@ -24,8 +24,6 @@ class NamedDecl;
2424
class Type;
2525
class UnresolvedUsingValueDecl;
2626

27-
namespace clangd {
28-
2927
// This class handles heuristic resolution of declarations and types in template
3028
// code.
3129
//
@@ -80,7 +78,6 @@ class HeuristicResolver {
8078
ASTContext &Ctx;
8179
};
8280

83-
} // namespace clangd
8481
} // namespace clang
8582

8683
#endif

clang/lib/Sema/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ add_clang_library(clangSema
1919
CodeCompleteConsumer.cpp
2020
DeclSpec.cpp
2121
DelayedDiagnostic.cpp
22+
HeuristicResolver.cpp
2223
HLSLExternalSemaSource.cpp
2324
IdentifierResolver.cpp
2425
JumpDiagnostics.cpp

clang-tools-extra/clangd/HeuristicResolver.cpp renamed to clang/lib/Sema/HeuristicResolver.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,14 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9-
#include "HeuristicResolver.h"
9+
#include "clang/Sema/HeuristicResolver.h"
1010
#include "clang/AST/ASTContext.h"
1111
#include "clang/AST/CXXInheritance.h"
1212
#include "clang/AST/DeclTemplate.h"
1313
#include "clang/AST/ExprCXX.h"
1414
#include "clang/AST/Type.h"
1515

1616
namespace clang {
17-
namespace clangd {
1817

1918
namespace {
2019

@@ -466,5 +465,4 @@ const Type *HeuristicResolver::getPointeeType(const Type *T) const {
466465
return HeuristicResolverImpl(Ctx).getPointeeType(T);
467466
}
468467

469-
} // namespace clangd
470468
} // namespace clang

clang/unittests/Sema/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ set(LLVM_LINK_COMPONENTS
66
add_clang_unittest(SemaTests
77
ExternalSemaSourceTest.cpp
88
CodeCompleteTest.cpp
9+
HeuristicResolverTest.cpp
910
GslOwnerPointerInference.cpp
1011
SemaLookupTest.cpp
1112
SemaNoloadLookupTest.cpp

clang-tools-extra/clangd/unittests/HeuristicResolverTests.cpp renamed to clang/unittests/Sema/HeuristicResolverTest.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,14 @@
55
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
66
//
77
//===----------------------------------------------------------------------===//
8-
#include "HeuristicResolver.h"
8+
#include "clang/Sema/HeuristicResolver.h"
99
#include "clang/ASTMatchers/ASTMatchFinder.h"
1010
#include "clang/ASTMatchers/ASTMatchers.h"
1111
#include "clang/Tooling/Tooling.h"
1212
#include "gmock/gmock-matchers.h"
1313
#include "gtest/gtest.h"
1414

1515
using namespace clang::ast_matchers;
16-
using clang::clangd::HeuristicResolver;
1716
using testing::ElementsAre;
1817

1918
namespace clang {

0 commit comments

Comments
 (0)