@@ -167,6 +167,7 @@ class Preprocessor;
167
167
class PseudoDestructorTypeStorage;
168
168
class PseudoObjectExpr;
169
169
class QualType;
170
+ class SemaCodeCompletion;
170
171
class SemaCUDA;
171
172
class SemaHLSL;
172
173
class SemaObjC;
@@ -481,9 +482,8 @@ class Sema final : public SemaBase {
481
482
// 29. C++ Variadic Templates (SemaTemplateVariadic.cpp)
482
483
// 30. Constraints and Concepts (SemaConcept.cpp)
483
484
// 31. Types (SemaType.cpp)
484
- // 32. Code Completion (SemaCodeComplete.cpp)
485
- // 33. FixIt Helpers (SemaFixItUtils.cpp)
486
- // 34. Name Lookup for RISC-V Vector Intrinsic (SemaRISCVVectorLookup.cpp)
485
+ // 32. FixIt Helpers (SemaFixItUtils.cpp)
486
+ // 33. Name Lookup for RISC-V Vector Intrinsic (SemaRISCVVectorLookup.cpp)
487
487
488
488
/// \name Semantic Analysis
489
489
/// Implementations are in Sema.cpp
@@ -984,6 +984,11 @@ class Sema final : public SemaBase {
984
984
/// CurContext - This is the current declaration context of parsing.
985
985
DeclContext *CurContext;
986
986
987
+ SemaCodeCompletion &CodeCompletion() {
988
+ assert(CodeCompletionPtr);
989
+ return *CodeCompletionPtr;
990
+ }
991
+
987
992
SemaCUDA &CUDA() {
988
993
assert(CUDAPtr);
989
994
return *CUDAPtr;
@@ -1044,6 +1049,7 @@ class Sema final : public SemaBase {
1044
1049
1045
1050
mutable IdentifierInfo *Ident_super;
1046
1051
1052
+ std::unique_ptr<SemaCodeCompletion> CodeCompletionPtr;
1047
1053
std::unique_ptr<SemaCUDA> CUDAPtr;
1048
1054
std::unique_ptr<SemaHLSL> HLSLPtr;
1049
1055
std::unique_ptr<SemaObjC> ObjCPtr;
@@ -4801,6 +4807,11 @@ class Sema final : public SemaBase {
4801
4807
DelayedDiagnostics.popUndelayed(state);
4802
4808
}
4803
4809
4810
+ ValueDecl *tryLookupCtorInitMemberDecl(CXXRecordDecl *ClassDecl,
4811
+ CXXScopeSpec &SS,
4812
+ ParsedType TemplateTypeTy,
4813
+ IdentifierInfo *MemberOrBase);
4814
+
4804
4815
private:
4805
4816
void setupImplicitSpecialMemberType(CXXMethodDecl *SpecialMem,
4806
4817
QualType ResultTy,
@@ -4811,11 +4822,6 @@ class Sema final : public SemaBase {
4811
4822
// of a ComparisonCategoryType enumerator.
4812
4823
llvm::SmallBitVector FullyCheckedComparisonCategories;
4813
4824
4814
- ValueDecl *tryLookupCtorInitMemberDecl(CXXRecordDecl *ClassDecl,
4815
- CXXScopeSpec &SS,
4816
- ParsedType TemplateTypeTy,
4817
- IdentifierInfo *MemberOrBase);
4818
-
4819
4825
/// Check if there is a field shadowing.
4820
4826
void CheckShadowInheritedFields(const SourceLocation &Loc,
4821
4827
DeclarationName FieldName,
@@ -11664,209 +11670,6 @@ class Sema final : public SemaBase {
11664
11670
//
11665
11671
//
11666
11672
11667
- /// \name Code Completion
11668
- /// Implementations are in SemaCodeComplete.cpp
11669
- ///@{
11670
-
11671
- public:
11672
- /// Code-completion consumer.
11673
- CodeCompleteConsumer *CodeCompleter;
11674
-
11675
- /// Describes the context in which code completion occurs.
11676
- enum ParserCompletionContext {
11677
- /// Code completion occurs at top-level or namespace context.
11678
- PCC_Namespace,
11679
- /// Code completion occurs within a class, struct, or union.
11680
- PCC_Class,
11681
- /// Code completion occurs within an Objective-C interface, protocol,
11682
- /// or category.
11683
- PCC_ObjCInterface,
11684
- /// Code completion occurs within an Objective-C implementation or
11685
- /// category implementation
11686
- PCC_ObjCImplementation,
11687
- /// Code completion occurs within the list of instance variables
11688
- /// in an Objective-C interface, protocol, category, or implementation.
11689
- PCC_ObjCInstanceVariableList,
11690
- /// Code completion occurs following one or more template
11691
- /// headers.
11692
- PCC_Template,
11693
- /// Code completion occurs following one or more template
11694
- /// headers within a class.
11695
- PCC_MemberTemplate,
11696
- /// Code completion occurs within an expression.
11697
- PCC_Expression,
11698
- /// Code completion occurs within a statement, which may
11699
- /// also be an expression or a declaration.
11700
- PCC_Statement,
11701
- /// Code completion occurs at the beginning of the
11702
- /// initialization statement (or expression) in a for loop.
11703
- PCC_ForInit,
11704
- /// Code completion occurs within the condition of an if,
11705
- /// while, switch, or for statement.
11706
- PCC_Condition,
11707
- /// Code completion occurs within the body of a function on a
11708
- /// recovery path, where we do not have a specific handle on our position
11709
- /// in the grammar.
11710
- PCC_RecoveryInFunction,
11711
- /// Code completion occurs where only a type is permitted.
11712
- PCC_Type,
11713
- /// Code completion occurs in a parenthesized expression, which
11714
- /// might also be a type cast.
11715
- PCC_ParenthesizedExpression,
11716
- /// Code completion occurs within a sequence of declaration
11717
- /// specifiers within a function, method, or block.
11718
- PCC_LocalDeclarationSpecifiers,
11719
- /// Code completion occurs at top-level in a REPL session
11720
- PCC_TopLevelOrExpression,
11721
- };
11722
-
11723
- void CodeCompleteModuleImport(SourceLocation ImportLoc, ModuleIdPath Path);
11724
- void CodeCompleteOrdinaryName(Scope *S,
11725
- ParserCompletionContext CompletionContext);
11726
- void CodeCompleteDeclSpec(Scope *S, DeclSpec &DS, bool AllowNonIdentifiers,
11727
- bool AllowNestedNameSpecifiers);
11728
-
11729
- struct CodeCompleteExpressionData;
11730
- void CodeCompleteExpression(Scope *S, const CodeCompleteExpressionData &Data);
11731
- void CodeCompleteExpression(Scope *S, QualType PreferredType,
11732
- bool IsParenthesized = false);
11733
- void CodeCompleteMemberReferenceExpr(Scope *S, Expr *Base, Expr *OtherOpBase,
11734
- SourceLocation OpLoc, bool IsArrow,
11735
- bool IsBaseExprStatement,
11736
- QualType PreferredType);
11737
- void CodeCompletePostfixExpression(Scope *S, ExprResult LHS,
11738
- QualType PreferredType);
11739
- void CodeCompleteTag(Scope *S, unsigned TagSpec);
11740
- void CodeCompleteTypeQualifiers(DeclSpec &DS);
11741
- void CodeCompleteFunctionQualifiers(DeclSpec &DS, Declarator &D,
11742
- const VirtSpecifiers *VS = nullptr);
11743
- void CodeCompleteBracketDeclarator(Scope *S);
11744
- void CodeCompleteCase(Scope *S);
11745
- enum class AttributeCompletion {
11746
- Attribute,
11747
- Scope,
11748
- None,
11749
- };
11750
- void CodeCompleteAttribute(
11751
- AttributeCommonInfo::Syntax Syntax,
11752
- AttributeCompletion Completion = AttributeCompletion::Attribute,
11753
- const IdentifierInfo *Scope = nullptr);
11754
- /// Determines the preferred type of the current function argument, by
11755
- /// examining the signatures of all possible overloads.
11756
- /// Returns null if unknown or ambiguous, or if code completion is off.
11757
- ///
11758
- /// If the code completion point has been reached, also reports the function
11759
- /// signatures that were considered.
11760
- ///
11761
- /// FIXME: rename to GuessCallArgumentType to reduce confusion.
11762
- QualType ProduceCallSignatureHelp(Expr *Fn, ArrayRef<Expr *> Args,
11763
- SourceLocation OpenParLoc);
11764
- QualType ProduceConstructorSignatureHelp(QualType Type, SourceLocation Loc,
11765
- ArrayRef<Expr *> Args,
11766
- SourceLocation OpenParLoc,
11767
- bool Braced);
11768
- QualType ProduceCtorInitMemberSignatureHelp(
11769
- Decl *ConstructorDecl, CXXScopeSpec SS, ParsedType TemplateTypeTy,
11770
- ArrayRef<Expr *> ArgExprs, IdentifierInfo *II, SourceLocation OpenParLoc,
11771
- bool Braced);
11772
- QualType ProduceTemplateArgumentSignatureHelp(
11773
- TemplateTy, ArrayRef<ParsedTemplateArgument>, SourceLocation LAngleLoc);
11774
- void CodeCompleteInitializer(Scope *S, Decl *D);
11775
- /// Trigger code completion for a record of \p BaseType. \p InitExprs are
11776
- /// expressions in the initializer list seen so far and \p D is the current
11777
- /// Designation being parsed.
11778
- void CodeCompleteDesignator(const QualType BaseType,
11779
- llvm::ArrayRef<Expr *> InitExprs,
11780
- const Designation &D);
11781
- void CodeCompleteAfterIf(Scope *S, bool IsBracedThen);
11782
-
11783
- void CodeCompleteQualifiedId(Scope *S, CXXScopeSpec &SS, bool EnteringContext,
11784
- bool IsUsingDeclaration, QualType BaseType,
11785
- QualType PreferredType);
11786
- void CodeCompleteUsing(Scope *S);
11787
- void CodeCompleteUsingDirective(Scope *S);
11788
- void CodeCompleteNamespaceDecl(Scope *S);
11789
- void CodeCompleteNamespaceAliasDecl(Scope *S);
11790
- void CodeCompleteOperatorName(Scope *S);
11791
- void CodeCompleteConstructorInitializer(
11792
- Decl *Constructor, ArrayRef<CXXCtorInitializer *> Initializers);
11793
-
11794
- void CodeCompleteLambdaIntroducer(Scope *S, LambdaIntroducer &Intro,
11795
- bool AfterAmpersand);
11796
- void CodeCompleteAfterFunctionEquals(Declarator &D);
11797
-
11798
- void CodeCompleteObjCAtDirective(Scope *S);
11799
- void CodeCompleteObjCAtVisibility(Scope *S);
11800
- void CodeCompleteObjCAtStatement(Scope *S);
11801
- void CodeCompleteObjCAtExpression(Scope *S);
11802
- void CodeCompleteObjCPropertyFlags(Scope *S, ObjCDeclSpec &ODS);
11803
- void CodeCompleteObjCPropertyGetter(Scope *S);
11804
- void CodeCompleteObjCPropertySetter(Scope *S);
11805
- void CodeCompleteObjCPassingType(Scope *S, ObjCDeclSpec &DS,
11806
- bool IsParameter);
11807
- void CodeCompleteObjCMessageReceiver(Scope *S);
11808
- void CodeCompleteObjCSuperMessage(Scope *S, SourceLocation SuperLoc,
11809
- ArrayRef<const IdentifierInfo *> SelIdents,
11810
- bool AtArgumentExpression);
11811
- void CodeCompleteObjCClassMessage(Scope *S, ParsedType Receiver,
11812
- ArrayRef<const IdentifierInfo *> SelIdents,
11813
- bool AtArgumentExpression,
11814
- bool IsSuper = false);
11815
- void CodeCompleteObjCInstanceMessage(
11816
- Scope *S, Expr *Receiver, ArrayRef<const IdentifierInfo *> SelIdents,
11817
- bool AtArgumentExpression, ObjCInterfaceDecl *Super = nullptr);
11818
- void CodeCompleteObjCForCollection(Scope *S, DeclGroupPtrTy IterationVar);
11819
- void CodeCompleteObjCSelector(Scope *S,
11820
- ArrayRef<const IdentifierInfo *> SelIdents);
11821
- void
11822
- CodeCompleteObjCProtocolReferences(ArrayRef<IdentifierLocPair> Protocols);
11823
- void CodeCompleteObjCProtocolDecl(Scope *S);
11824
- void CodeCompleteObjCInterfaceDecl(Scope *S);
11825
- void CodeCompleteObjCClassForwardDecl(Scope *S);
11826
- void CodeCompleteObjCSuperclass(Scope *S, IdentifierInfo *ClassName,
11827
- SourceLocation ClassNameLoc);
11828
- void CodeCompleteObjCImplementationDecl(Scope *S);
11829
- void CodeCompleteObjCInterfaceCategory(Scope *S, IdentifierInfo *ClassName,
11830
- SourceLocation ClassNameLoc);
11831
- void CodeCompleteObjCImplementationCategory(Scope *S,
11832
- IdentifierInfo *ClassName,
11833
- SourceLocation ClassNameLoc);
11834
- void CodeCompleteObjCPropertyDefinition(Scope *S);
11835
- void CodeCompleteObjCPropertySynthesizeIvar(Scope *S,
11836
- IdentifierInfo *PropertyName);
11837
- void CodeCompleteObjCMethodDecl(Scope *S,
11838
- std::optional<bool> IsInstanceMethod,
11839
- ParsedType ReturnType);
11840
- void CodeCompleteObjCMethodDeclSelector(
11841
- Scope *S, bool IsInstanceMethod, bool AtParameterName,
11842
- ParsedType ReturnType, ArrayRef<const IdentifierInfo *> SelIdents);
11843
- void CodeCompleteObjCClassPropertyRefExpr(Scope *S,
11844
- const IdentifierInfo &ClassName,
11845
- SourceLocation ClassNameLoc,
11846
- bool IsBaseExprStatement);
11847
- void CodeCompletePreprocessorDirective(bool InConditional);
11848
- void CodeCompleteInPreprocessorConditionalExclusion(Scope *S);
11849
- void CodeCompletePreprocessorMacroName(bool IsDefinition);
11850
- void CodeCompletePreprocessorExpression();
11851
- void CodeCompletePreprocessorMacroArgument(Scope *S, IdentifierInfo *Macro,
11852
- MacroInfo *MacroInfo,
11853
- unsigned Argument);
11854
- void CodeCompleteIncludedFile(llvm::StringRef Dir, bool IsAngled);
11855
- void CodeCompleteNaturalLanguage();
11856
- void CodeCompleteAvailabilityPlatformName();
11857
- void
11858
- GatherGlobalCodeCompletions(CodeCompletionAllocator &Allocator,
11859
- CodeCompletionTUInfo &CCTUInfo,
11860
- SmallVectorImpl<CodeCompletionResult> &Results);
11861
-
11862
- ///@}
11863
-
11864
- //
11865
- //
11866
- // -------------------------------------------------------------------------
11867
- //
11868
- //
11869
-
11870
11673
/// \name FixIt Helpers
11871
11674
/// Implementations are in SemaFixItUtils.cpp
11872
11675
///@{
0 commit comments