;
76 typedef bool(ResultBuilder::*LookupFilter)(
const NamedDecl*)
const;
82std::vector<Result> Results;
89 typedefstd::pair<const NamedDecl *, unsigned> DeclIndexPair;
94 classShadowMapEntry {
99llvm::PointerUnion<const NamedDecl *, DeclIndexPairVector *> DeclOrVector;
103 unsignedSingleDeclIndex = 0;
106ShadowMapEntry() =
default;
107ShadowMapEntry(
constShadowMapEntry &) =
delete;
108ShadowMapEntry(ShadowMapEntry &&Move) { *
this= std::move(Move); }
109ShadowMapEntry &operator=(
constShadowMapEntry &) =
delete;
110ShadowMapEntry &operator=(ShadowMapEntry &&Move) {
111SingleDeclIndex =
Move.SingleDeclIndex;
112DeclOrVector =
Move.DeclOrVector;
113 Move.DeclOrVector =
nullptr;
118 if(DeclOrVector.isNull()) {
121SingleDeclIndex = Index;
125 if(
const NamedDecl*PrevND = dyn_cast<const NamedDecl *>(DeclOrVector)) {
128DeclIndexPairVector *Vec =
newDeclIndexPairVector;
129Vec->push_back(DeclIndexPair(PrevND, SingleDeclIndex));
134cast<DeclIndexPairVector *>(DeclOrVector)
135->push_back(DeclIndexPair(ND, Index));
139 if(DeclIndexPairVector *Vec =
140dyn_cast_if_present<DeclIndexPairVector *>(DeclOrVector)) {
142DeclOrVector = ((
NamedDecl*)
nullptr);
148iterator begin()
const;
149iterator end()
const;
155 typedefllvm::DenseMap<DeclarationName, ShadowMapEntry> ShadowMap;
172 boolAllowNestedNameSpecifiers;
183std::list<ShadowMap> ShadowMaps;
197 boolHasObjectTypeQualifiers;
209 voidAdjustResultPriorityForDecl(Result &R);
211 voidMaybeAddConstructorResults(Result R);
217LookupFilter Filter =
nullptr)
218: SemaRef(SemaRef), Allocator(Allocator), CCTUInfo(CCTUInfo),
220HasObjectTypeQualifiers(
false), CompletionContext(CompletionContext),
221ObjCImplementation(nullptr) {
224 switch(CompletionContext.
getKind()) {
232 if(Method->isInstanceMethod())
234ObjCImplementation =
Interface->getImplementation();
243 unsignedgetBasePriority(
const NamedDecl*
D);
247 boolincludeCodePatterns()
const{
253 voidsetFilter(LookupFilter Filter) { this->Filter =
Filter; }
255Result *data() {
returnResults.empty() ? nullptr : &Results.front(); }
256 unsignedsize()
const{
returnResults.size(); }
257 boolempty()
const{
returnResults.empty(); }
272ObjectTypeQualifiers = Quals;
274HasObjectTypeQualifiers =
true;
282 voidsetPreferredSelector(
SelectorSel) { PreferredSelector = Sel; }
287 returnCompletionContext;
291 voidallowNestedNameSpecifiers(
boolAllow =
true) {
292AllowNestedNameSpecifiers = Allow;
297 Sema&getSema()
const{
returnSemaRef; }
311 boolisInterestingDecl(
const NamedDecl*ND,
312 bool&AsNestedNameSpecifier)
const;
337 boolCheckHiddenResult(Result &R,
DeclContext*CurContext,
347 voidMaybeAddResult(Result R,
DeclContext*CurContext =
nullptr);
364 boolInBaseClass,
QualTypeBaseExprType);
367 voidAddResult(Result R);
370 voidEnterNewScope();
389 boolIsOrdinaryName(
const NamedDecl*ND)
const;
390 boolIsOrdinaryNonTypeName(
const NamedDecl*ND)
const;
391 boolIsIntegralConstantValue(
const NamedDecl*ND)
const;
392 boolIsOrdinaryNonValueName(
const NamedDecl*ND)
const;
393 boolIsNestedNameSpecifier(
const NamedDecl*ND)
const;
394 boolIsEnum(
const NamedDecl*ND)
const;
395 boolIsClassOrStruct(
const NamedDecl*ND)
const;
396 boolIsUnion(
const NamedDecl*ND)
const;
397 boolIsNamespace(
const NamedDecl*ND)
const;
398 boolIsNamespaceOrAlias(
const NamedDecl*ND)
const;
399 boolIsType(
const NamedDecl*ND)
const;
400 boolIsMember(
const NamedDecl*ND)
const;
401 boolIsObjCIvar(
const NamedDecl*ND)
const;
402 boolIsObjCMessageReceiver(
const NamedDecl*ND)
const;
403 boolIsObjCMessageReceiverOrLambdaCapture(
const NamedDecl*ND)
const;
404 boolIsObjCCollection(
const NamedDecl*ND)
const;
405 boolIsImpossibleToSatisfy(
const NamedDecl*ND)
const;
415ComputeType =
nullptr;
416 Type= BSI->ReturnType;
420ComputeType =
nullptr;
423}
else if(
const auto*Method = dyn_cast<ObjCMethodDecl>(S.
CurContext)) {
424ComputeType =
nullptr;
425 Type= Method->getReturnType();
433 auto*VD = llvm::dyn_cast_or_null<ValueDecl>(
D);
434ComputeType =
nullptr;
446ComputeType =
nullptr;
455this->ComputeType = ComputeType;
465 if(ExpectedLoc == LParLoc)
476 if(Op == tok::plus || Op == tok::plusequal || Op == tok::minusequal)
479 if(Op == tok::minus)
492 casetok::minusequal:
494 casetok::percentequal:
496 casetok::slashequal:
502 casetok::equalequal:
503 casetok::exclaimequal:
507 casetok::greaterequal:
511 casetok::greatergreater:
512 casetok::greatergreaterequal:
514 casetok::lesslessequal:
527 casetok::caretequal:
535 casetok::periodstar:
563 casetok::minusminus:
573assert(
false&&
"unhandled unary op");
582ComputeType =
nullptr;
589 if(!Enabled || !
Base)
592 if(ExpectedLoc !=
Base->getBeginLoc())
603ComputeType =
nullptr;
612ComputeType =
nullptr;
621ComputeType =
nullptr;
629ComputeType =
nullptr;
635llvm::PointerUnion<const NamedDecl *, const DeclIndexPair *> DeclOrIterator;
636 unsignedSingleDeclIndex;
645DeclIndexPair
Value;
656: DeclOrIterator(SingleDecl), SingleDeclIndex(Index) {}
659: DeclOrIterator(Iterator), SingleDeclIndex(0) {}
662 if(isa<const NamedDecl *>(DeclOrIterator)) {
663DeclOrIterator = (
NamedDecl*)
nullptr;
668 constDeclIndexPair *I = cast<const DeclIndexPair *>(DeclOrIterator);
681 if(
const NamedDecl*ND = dyn_cast<const NamedDecl *>(DeclOrIterator))
684 return*cast<const DeclIndexPair *>(DeclOrIterator);
690 return X.DeclOrIterator.getOpaqueValue() ==
691Y.DeclOrIterator.getOpaqueValue() &&
692 X.SingleDeclIndex == Y.SingleDeclIndex;
701ResultBuilder::ShadowMapEntry::begin()
const{
702 if(DeclOrVector.isNull())
705 if(
const NamedDecl*ND = dyn_cast<const NamedDecl *>(DeclOrVector))
706 returniterator(ND, SingleDeclIndex);
708 returniterator(cast<DeclIndexPairVector *>(DeclOrVector)->begin());
712ResultBuilder::ShadowMapEntry::end()
const{
713 if(isa<const NamedDecl *>(DeclOrVector) || DeclOrVector.isNull())
716 returniterator(cast<DeclIndexPairVector *>(DeclOrVector)->end());
737 for(
const DeclContext*CommonAncestor = TargetContext;
738CommonAncestor && !CommonAncestor->
Encloses(CurContext);
739CommonAncestor = CommonAncestor->getLookupParent()) {
740 if(CommonAncestor->isTransparentContext() ||
741CommonAncestor->isFunctionOrMethod())
744TargetParents.push_back(CommonAncestor);
748 while(!TargetParents.empty()) {
751 if(
const auto*Namespace = dyn_cast<NamespaceDecl>(
Parent)) {
752 if(!Namespace->getIdentifier())
756}
else if(
const auto*TD = dyn_cast<TagDecl>(
Parent))
787boolResultBuilder::isInterestingDecl(
const NamedDecl*ND,
788 bool&AsNestedNameSpecifier)
const{
789AsNestedNameSpecifier =
false;
804 if(isa<ClassTemplateSpecializationDecl>(ND) ||
805isa<ClassTemplatePartialSpecializationDecl>(ND))
809 if(isa<UsingDecl>(ND))
815 if(Filter == &ResultBuilder::IsNestedNameSpecifier ||
816(isa<NamespaceDecl>(ND) && Filter != &ResultBuilder::IsNamespace &&
817Filter != &ResultBuilder::IsNamespaceOrAlias && Filter !=
nullptr))
818AsNestedNameSpecifier =
true;
821 if(Filter && !(this->*Filter)(Named)) {
823 if(AllowNestedNameSpecifiers && SemaRef.
getLangOpts().CPlusPlus &&
824IsNestedNameSpecifier(ND) &&
825(Filter != &ResultBuilder::IsMember ||
826(isa<CXXRecordDecl>(ND) &&
827cast<CXXRecordDecl>(ND)->isInjectedClassName()))) {
828AsNestedNameSpecifier =
true;
858R.QualifierIsInformative =
false;
862R.Declaration->getDeclContext());
871 switch(cast<BuiltinType>(
T)->
getKind()) {
872 caseBuiltinType::Void:
875 caseBuiltinType::NullPtr:
878 caseBuiltinType::Overload:
879 caseBuiltinType::Dependent:
882 caseBuiltinType::ObjCId:
883 caseBuiltinType::ObjCClass:
884 caseBuiltinType::ObjCSel:
897 caseType::BlockPointer:
900 caseType::LValueReference:
901 caseType::RValueReference:
904 caseType::ConstantArray:
905 caseType::IncompleteArray:
906 caseType::VariableArray:
907 caseType::DependentSizedArray:
910 caseType::DependentSizedExtVector:
912 caseType::ExtVector:
915 caseType::FunctionProto:
916 caseType::FunctionNoProto:
925 caseType::ObjCObject:
926 caseType::ObjCInterface:
927 caseType::ObjCObjectPointer:
940 if(
const auto*
Type= dyn_cast<TypeDecl>(ND))
941 return C.getTypeDeclType(
Type);
942 if(
const auto*Iface = dyn_cast<ObjCInterfaceDecl>(ND))
943 return C.getObjCInterfaceType(Iface);
948 else if(
const auto*Method = dyn_cast<ObjCMethodDecl>(ND))
949 T= Method->getSendResultType();
950 else if(
const auto*Enumerator = dyn_cast<EnumConstantDecl>(ND))
951 T=
C.getTypeDeclType(cast<EnumDecl>(Enumerator->getDeclContext()));
952 else if(
const auto*
Property= dyn_cast<ObjCPropertyDecl>(ND))
954 else if(
const auto*
Value= dyn_cast<ValueDecl>(ND))
970 if(
Pointer->getPointeeType()->isFunctionType()) {
979 T=
Block->getPointeeType();
994unsignedResultBuilder::getBasePriority(
const NamedDecl*ND) {
1002 if(
const auto*ImplicitParam = dyn_cast<ImplicitParamDecl>(ND))
1003 if(ImplicitParam->getIdentifier() &&
1004ImplicitParam->getIdentifier()->isStr(
"_cmd"))
1011 if(DC->
isRecord() || isa<ObjCContainerDecl>(DC)) {
1013 if(isa<CXXDestructorDecl>(ND))
1025 if(isa<EnumConstantDecl>(ND))
1031 if((isa<TypeDecl>(ND) || isa<ObjCInterfaceDecl>(ND)) &&
1033CompletionContext.
getKind() ==
1035CompletionContext.
getKind() ==
1042voidResultBuilder::AdjustResultPriorityForDecl(
Result&R) {
1045 if(!PreferredSelector.
isNull())
1046 if(
const auto*Method = dyn_cast<ObjCMethodDecl>(R.Declaration))
1047 if(PreferredSelector == Method->getSelector())
1052 if(!PreferredType.
isNull()) {
1054 if(!
T.isNull()) {
1062!(PreferredType->isEnumeralType() && TC->isEnumeralType()))
1074 return Record->lookup(ConstructorName);
1077voidResultBuilder::MaybeAddConstructorResults(
ResultR) {
1078 if(!SemaRef.
getLangOpts().CPlusPlus || !R.Declaration ||
1085 Record= ClassTemplate->getTemplatedDecl();
1086 else if((
Record= dyn_cast<CXXRecordDecl>(
D))) {
1088 if(isa<ClassTemplateSpecializationDecl>(
Record))
1100R.Declaration = Ctor;
1102Results.push_back(R);
1107 if(
const auto*Tmpl = dyn_cast<FunctionTemplateDecl>(ND))
1108ND = Tmpl->getTemplatedDecl();
1109 returnisa<CXXConstructorDecl>(ND);
1113assert(!ShadowMaps.empty() &&
"Must enter into a results scope");
1115 if(R.Kind != Result::RK_Declaration) {
1117Results.push_back(R);
1122 if(
const UsingShadowDecl*Using = dyn_cast<UsingShadowDecl>(R.Declaration)) {
1124getBasePriority(
Using->getTargetDecl()),
1125R.Qualifier,
false,
1128std::move(R.FixIts));
1130MaybeAddResult(
Result, CurContext);
1137 boolAsNestedNameSpecifier =
false;
1138 if(!isInterestingDecl(R.Declaration, AsNestedNameSpecifier))
1145ShadowMap &
SMap= ShadowMaps.back();
1146ShadowMapEntry::iterator I, IEnd;
1147ShadowMap::iterator NamePos =
SMap.find(R.Declaration->getDeclName());
1148 if(NamePos !=
SMap.end()) {
1149I = NamePos->second.begin();
1150IEnd = NamePos->second.end();
1153 for(; I != IEnd; ++I) {
1155 unsignedIndex = I->second;
1158Results[Index].Declaration = R.Declaration;
1168std::list<ShadowMap>::iterator
SM, SMEnd = ShadowMaps.end();
1170 for(
SM= ShadowMaps.begin();
SM!= SMEnd; ++
SM) {
1171ShadowMapEntry::iterator I, IEnd;
1172ShadowMap::iterator NamePos =
SM->find(R.Declaration->getDeclName());
1173 if(NamePos !=
SM->end()) {
1174I = NamePos->second.begin();
1175IEnd = NamePos->second.end();
1177 for(; I != IEnd; ++I) {
1179 if(I->first->hasTagIdentifierNamespace() &&
1187I->first->getIdentifierNamespace() != IDNS)
1191 if(CheckHiddenResult(R, CurContext, I->first))
1199 if(!AllDeclsFound.insert(CanonDecl).second)
1204 if(AsNestedNameSpecifier) {
1205R.StartsNestedNameSpecifier =
true;
1208AdjustResultPriorityForDecl(R);
1211 if(R.QualifierIsInformative && !R.Qualifier &&
1212!R.StartsNestedNameSpecifier) {
1213 const DeclContext*Ctx = R.Declaration->getDeclContext();
1214 if(
const NamespaceDecl*Namespace = dyn_cast<NamespaceDecl>(Ctx))
1217 else if(
const TagDecl*Tag = dyn_cast<TagDecl>(Ctx))
1219SemaRef.
Context,
nullptr,
false,
1222R.QualifierIsInformative =
false;
1227 SMap[R.Declaration->getDeclName()].Add(R.Declaration, Results.size());
1228Results.push_back(R);
1230 if(!AsNestedNameSpecifier)
1231MaybeAddConstructorResults(R);
1251 returnOverloadCompare::BothViable;
1256 returnOverloadCompare::BothViable;
1257 for(
unsignedI = 0,
E= Candidate.
getNumParams(); I !=
E; ++I)
1258 if(Candidate.
parameters()[I]->getType().getCanonicalType() !=
1259Incumbent.
parameters()[I]->getType().getCanonicalType())
1260 returnOverloadCompare::BothViable;
1263 returnOverloadCompare::BothViable;
1268 if(CandidateRef != IncumbentRef) {
1275 returnCandidateRef ==
RQ_RValue? OverloadCompare::Dominates
1276: OverloadCompare::Dominated;
1284 if(CandidateSuperset == IncumbentSuperset)
1285 returnOverloadCompare::BothViable;
1286 returnIncumbentSuperset ? OverloadCompare::Dominates
1287: OverloadCompare::Dominated;
1290boolResultBuilder::canCxxMethodBeCalled(
const CXXMethodDecl*Method,
1296 const auto*CurrentClassScope = [&]() ->
const CXXRecordDecl* {
1297 for(
DeclContext*Ctx = CurContext; Ctx; Ctx = Ctx->getParent()) {
1298 const auto*CtxMethod = llvm::dyn_cast<CXXMethodDecl>(Ctx);
1299 if(CtxMethod && !CtxMethod->getParent()->isLambda()) {
1300 returnCtxMethod->getParent();
1307 boolFunctionCanBeCall =
1308CurrentClassScope &&
1309(CurrentClassScope == Method->
getParent() ||
1313 if(FunctionCanBeCall)
1318BaseExprType.
isNull() ?
nullptr 1320 auto*MaybeBase = Method->
getParent();
1322MaybeDerived == MaybeBase || MaybeDerived->
isDerivedFrom(MaybeBase);
1325 returnFunctionCanBeCall;
1328boolResultBuilder::canFunctionBeCalled(
const NamedDecl*ND,
1339 if(
const auto*FuncTmpl = dyn_cast<FunctionTemplateDecl>(ND)) {
1340ND = FuncTmpl->getTemplatedDecl();
1342 const auto*Method = dyn_cast<CXXMethodDecl>(ND);
1343 if(Method && !Method->
isStatic()) {
1344 returncanCxxMethodBeCalled(Method, BaseExprType);
1351 NamedDecl*Hiding,
boolInBaseClass =
false,
1353 if(R.Kind != Result::RK_Declaration) {
1355Results.push_back(R);
1360 if(
const auto*Using = dyn_cast<UsingShadowDecl>(R.Declaration)) {
1362getBasePriority(
Using->getTargetDecl()),
1363R.Qualifier,
false,
1366std::move(R.FixIts));
1368AddResult(
Result, CurContext, Hiding,
false,
1373 boolAsNestedNameSpecifier =
false;
1374 if(!isInterestingDecl(R.Declaration, AsNestedNameSpecifier))
1381 if(Hiding && CheckHiddenResult(R, CurContext, Hiding))
1385 if(!AllDeclsFound.insert(R.Declaration->getCanonicalDecl()).second)
1390 if(AsNestedNameSpecifier) {
1391R.StartsNestedNameSpecifier =
true;
1393}
else if(Filter == &ResultBuilder::IsMember && !R.Qualifier &&
1396R.Declaration->getDeclContext()->getRedeclContext()))
1397R.QualifierIsInformative =
true;
1400 if(R.QualifierIsInformative && !R.Qualifier &&
1401!R.StartsNestedNameSpecifier) {
1402 const DeclContext*Ctx = R.Declaration->getDeclContext();
1403 if(
const auto*Namespace = dyn_cast<NamespaceDecl>(Ctx))
1406 else if(
const auto*Tag = dyn_cast<TagDecl>(Ctx))
1408SemaRef.
Context,
nullptr,
false,
1411R.QualifierIsInformative =
false;
1418AdjustResultPriorityForDecl(R);
1420 if(HasObjectTypeQualifiers)
1421 if(
const auto*Method = dyn_cast<CXXMethodDecl>(R.Declaration))
1424 if(ObjectTypeQualifiers == MethodQuals)
1426 else if(ObjectTypeQualifiers - MethodQuals) {
1448 auto&OverloadSet = OverloadMap[std::make_pair(
1450 for(
constDeclIndexPair Entry : OverloadSet) {
1451 Result&Incumbent = Results[Entry.second];
1453*cast<CXXMethodDecl>(Incumbent.Declaration),
1454ObjectTypeQualifiers, ObjectKind,
1456 caseOverloadCompare::Dominates:
1460Incumbent = std::move(R);
1462 caseOverloadCompare::Dominated:
1465 caseOverloadCompare::BothViable:
1469OverloadSet.Add(Method, Results.size());
1472R.FunctionCanBeCall = canFunctionBeCalled(R.getDeclaration(), BaseExprType);
1475Results.push_back(R);
1477 if(!AsNestedNameSpecifier)
1478MaybeAddConstructorResults(R);
1481voidResultBuilder::AddResult(
ResultR) {
1482assert(R.Kind != Result::RK_Declaration &&
1483 "Declaration results need more context");
1484Results.push_back(R);
1488voidResultBuilder::EnterNewScope() { ShadowMaps.emplace_back(); }
1491voidResultBuilder::ExitScope() {
1492ShadowMaps.pop_back();
1497boolResultBuilder::IsOrdinaryName(
const NamedDecl*ND)
const{
1506 if(isa<ObjCIvarDecl>(ND))
1515boolResultBuilder::IsOrdinaryNonTypeName(
const NamedDecl*ND)
const{
1517 if(isa<TypeDecl>(ND))
1522 if(
const auto*ID = dyn_cast<ObjCInterfaceDecl>(ND)) {
1523 if(!
ID->getDefinition())
1531 if(isa<ObjCIvarDecl>(ND))
1538boolResultBuilder::IsIntegralConstantValue(
const NamedDecl*ND)
const{
1539 if(!IsOrdinaryNonTypeName(ND))
1543 if(VD->getType()->isIntegralOrEnumerationType())
1551boolResultBuilder::IsOrdinaryNonValueName(
const NamedDecl*ND)
const{
1559!isa<FunctionTemplateDecl>(ND) && !isa<ObjCPropertyDecl>(ND);
1564boolResultBuilder::IsNestedNameSpecifier(
const NamedDecl*ND)
const{
1566 if(
const auto*ClassTemplate = dyn_cast<ClassTemplateDecl>(ND))
1567ND = ClassTemplate->getTemplatedDecl();
1573boolResultBuilder::IsEnum(
const NamedDecl*ND)
const{
1574 returnisa<EnumDecl>(ND);
1578boolResultBuilder::IsClassOrStruct(
const NamedDecl*ND)
const{
1580 if(
const auto*ClassTemplate = dyn_cast<ClassTemplateDecl>(ND))
1581ND = ClassTemplate->getTemplatedDecl();
1584 if(
const auto*RD = dyn_cast<RecordDecl>(ND))
1593boolResultBuilder::IsUnion(
const NamedDecl*ND)
const{
1595 if(
const auto*ClassTemplate = dyn_cast<ClassTemplateDecl>(ND))
1596ND = ClassTemplate->getTemplatedDecl();
1598 if(
const auto*RD = dyn_cast<RecordDecl>(ND))
1605boolResultBuilder::IsNamespace(
const NamedDecl*ND)
const{
1606 returnisa<NamespaceDecl>(ND);
1611boolResultBuilder::IsNamespaceOrAlias(
const NamedDecl*ND)
const{
1616boolResultBuilder::IsType(
const NamedDecl*ND)
const{
1618 returnisa<TypeDecl>(ND) || isa<ObjCInterfaceDecl>(ND);
1624boolResultBuilder::IsMember(
const NamedDecl*ND)
const{
1626 returnisa<ValueDecl>(ND) || isa<FunctionTemplateDecl>(ND) ||
1627isa<ObjCPropertyDecl>(ND);
1631 T=
C.getCanonicalType(
T);
1633 caseType::ObjCObject:
1634 caseType::ObjCInterface:
1635 caseType::ObjCObjectPointer:
1639 switch(cast<BuiltinType>(
T)->
getKind()) {
1640 caseBuiltinType::ObjCId:
1641 caseBuiltinType::ObjCClass:
1642 caseBuiltinType::ObjCSel:
1654 if(!
C.getLangOpts().CPlusPlus)
1663boolResultBuilder::IsObjCMessageReceiver(
const NamedDecl*ND)
const{
1672boolResultBuilder::IsObjCMessageReceiverOrLambdaCapture(
1674 if(IsObjCMessageReceiver(ND))
1677 const auto*Var = dyn_cast<VarDecl>(ND);
1681 returnVar->hasLocalStorage() && !Var->hasAttr<BlocksAttr>();
1684boolResultBuilder::IsObjCCollection(
const NamedDecl*ND)
const{
1685 if((SemaRef.
getLangOpts().CPlusPlus && !IsOrdinaryName(ND)) ||
1686(!SemaRef.
getLangOpts().CPlusPlus && !IsOrdinaryNonTypeName(ND)))
1699boolResultBuilder::IsImpossibleToSatisfy(
const NamedDecl*ND)
const{
1705boolResultBuilder::IsObjCIvar(
const NamedDecl*ND)
const{
1706 returnisa<ObjCIvarDecl>(ND);
1714ResultBuilder &Results;
1720std::vector<FixItHint> FixIts;
1723CodeCompletionDeclConsumer(
1724ResultBuilder &Results,
DeclContext*InitialLookupCtx,
1726std::vector<FixItHint> FixIts = std::vector<FixItHint>())
1727: Results(Results), InitialLookupCtx(InitialLookupCtx),
1728FixIts(
std::move(FixIts)) {
1729NamingClass = llvm::dyn_cast<CXXRecordDecl>(InitialLookupCtx);
1731 if(BaseType.
isNull()) {
1732 autoThisType = Results.getSema().getCurrentThisType();
1733 if(!ThisType.isNull()) {
1734assert(ThisType->isPointerType());
1740this->BaseType = BaseType;
1744 boolInBaseClass)
override{
1747Results.AddResult(Result, InitialLookupCtx, Hiding, InBaseClass, BaseType);
1751Results.addVisitedContext(Ctx);
1760 auto*NamingClass = this->NamingClass;
1761 QualTypeBaseType = this->BaseType;
1762 if(
auto*Cls = llvm::dyn_cast_or_null<CXXRecordDecl>(Ctx)) {
1777NamingClass =
nullptr;
1780 returnResults.getSema().IsSimplyAccessible(ND, NamingClass, BaseType);
1787ResultBuilder &Results) {
1814Results.getCodeCompletionTUInfo());
1815 if(LangOpts.CPlusPlus) {
1823Builder.AddTypedTextChunk(
"typename");
1825Builder.AddPlaceholderChunk(
"name");
1826Results.AddResult(
Result(Builder.TakeString()));
1828 if(LangOpts.CPlusPlus11) {
1833Builder.AddTypedTextChunk(
"decltype");
1835Builder.AddPlaceholderChunk(
"expression");
1837Results.AddResult(
Result(Builder.TakeString()));
1840 if(LangOpts.Char8 || LangOpts.CPlusPlus20)
1846 if(LangOpts.GNUKeywords) {
1852Builder.AddTypedTextChunk(
"typeof");
1854Builder.AddPlaceholderChunk(
"expression");
1855Results.AddResult(
Result(Builder.TakeString()));
1857Builder.AddTypedTextChunk(
"typeof");
1859Builder.AddPlaceholderChunk(
"type");
1861Results.AddResult(
Result(Builder.TakeString()));
1872 const LangOptions&LangOpts, ResultBuilder &Results) {
1877Results.AddResult(
Result(
"extern"));
1878Results.AddResult(
Result(
"static"));
1880 if(LangOpts.CPlusPlus11) {
1885Builder.AddTypedTextChunk(
"alignas");
1887Builder.AddPlaceholderChunk(
"expression");
1889Results.AddResult(
Result(Builder.TakeString()));
1891Results.AddResult(
Result(
"constexpr"));
1892Results.AddResult(
Result(
"thread_local"));
1895 if(LangOpts.CPlusPlus20)
1896Results.AddResult(
Result(
"constinit"));
1901 const LangOptions&LangOpts, ResultBuilder &Results) {
1906 if(LangOpts.CPlusPlus) {
1907Results.AddResult(
Result(
"explicit"));
1908Results.AddResult(
Result(
"friend"));
1909Results.AddResult(
Result(
"mutable"));
1910Results.AddResult(
Result(
"virtual"));
1918 if(LangOpts.CPlusPlus || LangOpts.C99)
1919Results.AddResult(
Result(
"inline"));
1921 if(LangOpts.CPlusPlus20)
1922Results.AddResult(
Result(
"consteval"));
1942ResultBuilder &Results,
boolNeedAt);
1944ResultBuilder &Results,
boolNeedAt);
1946ResultBuilder &Results,
boolNeedAt);
1951Results.getCodeCompletionTUInfo());
1952Builder.AddTypedTextChunk(
"typedef");
1954Builder.AddPlaceholderChunk(
"type");
1956Builder.AddPlaceholderChunk(
"name");
1963ResultBuilder &Results) {
1964Builder.AddTypedTextChunk(
"using");
1966Builder.AddPlaceholderChunk(
"name");
1968Builder.AddPlaceholderChunk(
"type");
1991 returnLangOpts.CPlusPlus;
1998 returnLangOpts.CPlusPlus || LangOpts.ObjC || LangOpts.C99;
2001llvm_unreachable(
"Invalid ParserCompletionContext!");
2028 if(!
T.getLocalQualifiers()) {
2030 if(
const BuiltinType*BT = dyn_cast<BuiltinType>(
T))
2031 returnBT->getNameAsCString(Policy);
2034 if(
const TagType*TagT = dyn_cast<TagType>(
T))
2035 if(
TagDecl*Tag = TagT->getDecl())
2036 if(!Tag->hasNameForLinkage()) {
2037 switch(Tag->getTagKind()) {
2039 return "struct <anonymous>";
2041 return "__interface <anonymous>";
2043 return "class <anonymous>";
2045 return "union <anonymous>";
2047 return "enum <anonymous>";
2054 T.getAsStringInternal(
Result, Policy);
2055 returnAllocator.CopyString(
Result);
2067Builder.AddResultTypeChunk(
2069Builder.AddTypedTextChunk(
"this");
2074ResultBuilder &Results,
2076 if(!LangOpts.CPlusPlus11)
2079Builder.AddTypedTextChunk(
"static_assert");
2081Builder.AddPlaceholderChunk(
"expression");
2083Builder.AddPlaceholderChunk(
"message");
2092 Sema&S = Results.getSema();
2093 const auto*CR = llvm::dyn_cast<CXXRecordDecl>(S.
CurContext);
2099llvm::StringMap<std::vector<FunctionDecl *>> Overrides;
2100 for(
auto*Method : CR->methods()) {
2103Overrides[Method->
getName()].push_back(Method);
2106 for(
const auto&
Base: CR->bases()) {
2107 const auto*BR =
Base.getType().getTypePtr()->getAsCXXRecordDecl();
2110 for(
auto*Method : BR->methods()) {
2113 const autoit = Overrides.find(Method->
getName());
2114 boolIsOverriden =
false;
2115 if(it != Overrides.end()) {
2116 for(
auto*MD : it->second) {
2120IsOverriden =
true;
2134 false, CCContext, Policy);
2144 Scope*S,
Sema&SemaRef, ResultBuilder &Results) {
2152 if(Results.includeCodePatterns()) {
2154Builder.AddTypedTextChunk(
"namespace");
2156Builder.AddPlaceholderChunk(
"identifier");
2160Builder.AddPlaceholderChunk(
"declarations");
2163Results.AddResult(
Result(Builder.TakeString()));
2167Builder.AddTypedTextChunk(
"namespace");
2169Builder.AddPlaceholderChunk(
"name");
2171Builder.AddPlaceholderChunk(
"namespace");
2173Results.AddResult(
Result(Builder.TakeString()));
2176Builder.AddTypedTextChunk(
"using namespace");
2178Builder.AddPlaceholderChunk(
"identifier");
2180Results.AddResult(
Result(Builder.TakeString()));
2183Builder.AddTypedTextChunk(
"asm");
2185Builder.AddPlaceholderChunk(
"string-literal");
2187Results.AddResult(
Result(Builder.TakeString()));
2189 if(Results.includeCodePatterns()) {
2191Builder.AddTypedTextChunk(
"template");
2193Builder.AddPlaceholderChunk(
"declaration");
2194Results.AddResult(
Result(Builder.TakeString()));
2205 if(!CurrentModule) {
2207Builder.AddTypedTextChunk(
"module");
2210Results.AddResult(
Result(Builder.TakeString()));
2215 if(!CurrentModule ||
2220Builder.AddTypedTextChunk(
"module");
2222Builder.AddPlaceholderChunk(
"name");
2225Results.AddResult(
Result(Builder.TakeString()));
2230 if(!CurrentModule ||
2234Builder.AddTypedTextChunk(
"import");
2236Builder.AddPlaceholderChunk(
"name");
2239Results.AddResult(
Result(Builder.TakeString()));
2242 if(CurrentModule &&
2246Builder.AddTypedTextChunk(
"module");
2249Builder.AddTypedTextChunk(
"private");
2252Results.AddResult(
Result(Builder.TakeString()));
2257 if(!CurrentModule ||
2272Builder.AddTypedTextChunk(
"using");
2274Builder.AddPlaceholderChunk(
"qualifier");
2275Builder.AddTextChunk(
"::");
2276Builder.AddPlaceholderChunk(
"name");
2278Results.AddResult(
Result(Builder.TakeString()));
2285Builder.AddTypedTextChunk(
"using typename");
2287Builder.AddPlaceholderChunk(
"qualifier");
2288Builder.AddTextChunk(
"::");
2289Builder.AddPlaceholderChunk(
"name");
2291Results.AddResult(
Result(Builder.TakeString()));
2299 boolIsNotInheritanceScope = !S->isClassInheritanceScope();
2301Builder.AddTypedTextChunk(
"public");
2302 if(IsNotInheritanceScope && Results.includeCodePatterns())
2304Results.AddResult(
Result(Builder.TakeString()));
2307Builder.AddTypedTextChunk(
"protected");
2308 if(IsNotInheritanceScope && Results.includeCodePatterns())
2310Results.AddResult(
Result(Builder.TakeString()));
2313Builder.AddTypedTextChunk(
"private");
2314 if(IsNotInheritanceScope && Results.includeCodePatterns())
2316Results.AddResult(
Result(Builder.TakeString()));
2334 if(SemaRef.
getLangOpts().CPlusPlus && Results.includeCodePatterns()) {
2336Builder.AddTypedTextChunk(
"template");
2338Builder.AddPlaceholderChunk(
"parameters");
2340Results.AddResult(
Result(Builder.TakeString()));
2378 if(SemaRef.
getLangOpts().CPlusPlus && Results.includeCodePatterns() &&
2380Builder.AddTypedTextChunk(
"try");
2384Builder.AddPlaceholderChunk(
"statements");
2388Builder.AddTextChunk(
"catch");
2391Builder.AddPlaceholderChunk(
"declaration");
2396Builder.AddPlaceholderChunk(
"statements");
2399Results.AddResult(
Result(Builder.TakeString()));
2404 if(Results.includeCodePatterns()) {
2406Builder.AddTypedTextChunk(
"if");
2410Builder.AddPlaceholderChunk(
"condition");
2412Builder.AddPlaceholderChunk(
"expression");
2417Builder.AddPlaceholderChunk(
"statements");
2420Results.AddResult(
Result(Builder.TakeString()));
2423Builder.AddTypedTextChunk(
"switch");
2427Builder.AddPlaceholderChunk(
"condition");
2429Builder.AddPlaceholderChunk(
"expression");
2434Builder.AddPlaceholderChunk(
"cases");
2437Results.AddResult(
Result(Builder.TakeString()));
2444Builder.AddTypedTextChunk(
"case");
2446Builder.AddPlaceholderChunk(
"expression");
2448Results.AddResult(
Result(Builder.TakeString()));
2451Builder.AddTypedTextChunk(
"default");
2453Results.AddResult(
Result(Builder.TakeString()));
2456 if(Results.includeCodePatterns()) {
2458Builder.AddTypedTextChunk(
"while");
2462Builder.AddPlaceholderChunk(
"condition");
2464Builder.AddPlaceholderChunk(
"expression");
2469Builder.AddPlaceholderChunk(
"statements");
2472Results.AddResult(
Result(Builder.TakeString()));
2475Builder.AddTypedTextChunk(
"do");
2479Builder.AddPlaceholderChunk(
"statements");
2482Builder.AddTextChunk(
"while");
2485Builder.AddPlaceholderChunk(
"expression");
2487Results.AddResult(
Result(Builder.TakeString()));
2490Builder.AddTypedTextChunk(
"for");
2494Builder.AddPlaceholderChunk(
"init-statement");
2496Builder.AddPlaceholderChunk(
"init-expression");
2499Builder.AddPlaceholderChunk(
"condition");
2502Builder.AddPlaceholderChunk(
"inc-expression");
2507Builder.AddPlaceholderChunk(
"statements");
2510Results.AddResult(
Result(Builder.TakeString()));
2514Builder.AddTypedTextChunk(
"for");
2517Builder.AddPlaceholderChunk(
"range-declaration");
2520Builder.AddTextChunk(
"in");
2524Builder.AddPlaceholderChunk(
"range-expression");
2529Builder.AddPlaceholderChunk(
"statements");
2532Results.AddResult(
Result(Builder.TakeString()));
2536 if(S->getContinueParent()) {
2538Builder.AddTypedTextChunk(
"continue");
2540Results.AddResult(
Result(Builder.TakeString()));
2543 if(S->getBreakParent()) {
2545Builder.AddTypedTextChunk(
"break");
2547Results.AddResult(
Result(Builder.TakeString()));
2553ReturnType =
Function->getReturnType();
2554 else if(
const auto*Method = dyn_cast<ObjCMethodDecl>(SemaRef.
CurContext))
2560Builder.AddTypedTextChunk(
"return");
2562Results.AddResult(
Result(Builder.TakeString()));
2564assert(!ReturnType.
isNull());
2566Builder.AddTypedTextChunk(
"return");
2568Builder.AddPlaceholderChunk(
"expression");
2570Results.AddResult(
Result(Builder.TakeString()));
2573Builder.AddTypedTextChunk(
"co_return");
2575Builder.AddPlaceholderChunk(
"expression");
2577Results.AddResult(
Result(Builder.TakeString()));
2581Builder.AddTypedTextChunk(
"return true");
2583Results.AddResult(
Result(Builder.TakeString()));
2585Builder.AddTypedTextChunk(
"return false");
2587Results.AddResult(
Result(Builder.TakeString()));
2592Builder.AddTypedTextChunk(
"return nullptr");
2594Results.AddResult(
Result(Builder.TakeString()));
2599Builder.AddTypedTextChunk(
"goto");
2601Builder.AddPlaceholderChunk(
"label");
2603Results.AddResult(
Result(Builder.TakeString()));
2606Builder.AddTypedTextChunk(
"using namespace");
2608Builder.AddPlaceholderChunk(
"identifier");
2610Results.AddResult(
Result(Builder.TakeString()));
2627Builder.AddTypedTextChunk(
"__bridge");
2629Builder.AddPlaceholderChunk(
"type");
2631Builder.AddPlaceholderChunk(
"expression");
2632Results.AddResult(
Result(Builder.TakeString()));
2635Builder.AddTypedTextChunk(
"__bridge_transfer");
2637Builder.AddPlaceholderChunk(
"Objective-C type");
2639Builder.AddPlaceholderChunk(
"expression");
2640Results.AddResult(
Result(Builder.TakeString()));
2643Builder.AddTypedTextChunk(
"__bridge_retained");
2645Builder.AddPlaceholderChunk(
"CF type");
2647Builder.AddPlaceholderChunk(
"expression");
2648Results.AddResult(
Result(Builder.TakeString()));
2659Builder.AddResultTypeChunk(
"bool");
2660Builder.AddTypedTextChunk(
"true");
2661Results.AddResult(
Result(Builder.TakeString()));
2664Builder.AddResultTypeChunk(
"bool");
2665Builder.AddTypedTextChunk(
"false");
2666Results.AddResult(
Result(Builder.TakeString()));
2670Builder.AddTypedTextChunk(
"dynamic_cast");
2672Builder.AddPlaceholderChunk(
"type");
2675Builder.AddPlaceholderChunk(
"expression");
2677Results.AddResult(
Result(Builder.TakeString()));
2681Builder.AddTypedTextChunk(
"static_cast");
2683Builder.AddPlaceholderChunk(
"type");
2686Builder.AddPlaceholderChunk(
"expression");
2688Results.AddResult(
Result(Builder.TakeString()));
2691Builder.AddTypedTextChunk(
"reinterpret_cast");
2693Builder.AddPlaceholderChunk(
"type");
2696Builder.AddPlaceholderChunk(
"expression");
2698Results.AddResult(
Result(Builder.TakeString()));
2701Builder.AddTypedTextChunk(
"const_cast");
2703Builder.AddPlaceholderChunk(
"type");
2706Builder.AddPlaceholderChunk(
"expression");
2708Results.AddResult(
Result(Builder.TakeString()));
2712Builder.AddResultTypeChunk(
"std::type_info");
2713Builder.AddTypedTextChunk(
"typeid");
2715Builder.AddPlaceholderChunk(
"expression-or-type");
2717Results.AddResult(
Result(Builder.TakeString()));
2721Builder.AddTypedTextChunk(
"new");
2723Builder.AddPlaceholderChunk(
"type");
2725Builder.AddPlaceholderChunk(
"expressions");
2727Results.AddResult(
Result(Builder.TakeString()));
2730Builder.AddTypedTextChunk(
"new");
2732Builder.AddPlaceholderChunk(
"type");
2734Builder.AddPlaceholderChunk(
"size");
2737Builder.AddPlaceholderChunk(
"expressions");
2739Results.AddResult(
Result(Builder.TakeString()));
2742Builder.AddResultTypeChunk(
"void");
2743Builder.AddTypedTextChunk(
"delete");
2745Builder.AddPlaceholderChunk(
"expression");
2746Results.AddResult(
Result(Builder.TakeString()));
2749Builder.AddResultTypeChunk(
"void");
2750Builder.AddTypedTextChunk(
"delete");
2755Builder.AddPlaceholderChunk(
"expression");
2756Results.AddResult(
Result(Builder.TakeString()));
2760Builder.AddResultTypeChunk(
"void");
2761Builder.AddTypedTextChunk(
"throw");
2763Builder.AddPlaceholderChunk(
"expression");
2764Results.AddResult(
Result(Builder.TakeString()));
2771Builder.AddResultTypeChunk(
"std::nullptr_t");
2772Builder.AddTypedTextChunk(
"nullptr");
2773Results.AddResult(
Result(Builder.TakeString()));
2776Builder.AddResultTypeChunk(
"size_t");
2777Builder.AddTypedTextChunk(
"alignof");
2779Builder.AddPlaceholderChunk(
"type");
2781Results.AddResult(
Result(Builder.TakeString()));
2784Builder.AddResultTypeChunk(
"bool");
2785Builder.AddTypedTextChunk(
"noexcept");
2787Builder.AddPlaceholderChunk(
"expression");
2789Results.AddResult(
Result(Builder.TakeString()));
2792Builder.AddResultTypeChunk(
"size_t");
2793Builder.AddTypedTextChunk(
"sizeof...");
2795Builder.AddPlaceholderChunk(
"parameter-pack");
2797Results.AddResult(
Result(Builder.TakeString()));
2802Builder.AddTypedTextChunk(
"co_await");
2804Builder.AddPlaceholderChunk(
"expression");
2805Results.AddResult(
Result(Builder.TakeString()));
2808Builder.AddTypedTextChunk(
"co_yield");
2810Builder.AddPlaceholderChunk(
"expression");
2811Results.AddResult(
Result(Builder.TakeString()));
2814Builder.AddResultTypeChunk(
"bool");
2815Builder.AddTypedTextChunk(
"requires");
2818Builder.AddPlaceholderChunk(
"parameters");
2823Builder.AddPlaceholderChunk(
"requirements");
2826Results.AddResult(
Result(Builder.TakeString()));
2830Builder.AddTypedTextChunk(
"requires");
2832Builder.AddPlaceholderChunk(
"expression");
2834Results.AddResult(
Result(Builder.TakeString()));
2844 if(ID->getSuperClass()) {
2845std::string SuperType;
2846SuperType = ID->getSuperClass()->getNameAsString();
2847 if(Method->isInstanceMethod())
2850Builder.AddResultTypeChunk(Allocator.CopyString(SuperType));
2851Builder.AddTypedTextChunk(
"super");
2852Results.AddResult(
Result(Builder.TakeString()));
2861Builder.AddResultTypeChunk(
"size_t");
2863Builder.AddTypedTextChunk(
"alignof");
2865Builder.AddTypedTextChunk(
"_Alignof");
2867Builder.AddPlaceholderChunk(
"type");
2869Results.AddResult(
Result(Builder.TakeString()));
2874Builder.AddResultTypeChunk(
"nullptr_t");
2875Builder.AddTypedTextChunk(
"nullptr");
2876Results.AddResult(
Result(Builder.TakeString()));
2880Builder.AddResultTypeChunk(
"size_t");
2881Builder.AddTypedTextChunk(
"sizeof");
2883Builder.AddPlaceholderChunk(
"expression-or-type");
2885Results.AddResult(
Result(Builder.TakeString()));
2898Results.AddResult(
Result(
"operator"));
2919 else if(
const auto*Method = dyn_cast<ObjCMethodDecl>(ND)) {
2920 if(!BaseType.
isNull())
2921 T= Method->getSendResultType(BaseType);
2924}
else if(
const auto*Enumerator = dyn_cast<EnumConstantDecl>(ND)) {
2925 T= Context.
getTypeDeclType(cast<TypeDecl>(Enumerator->getDeclContext()));
2927}
else if(isa<UnresolvedUsingValueDecl>(ND)) {
2929}
else if(
const auto*Ivar = dyn_cast<ObjCIvarDecl>(ND)) {
2930 if(!BaseType.
isNull())
2931 T= Ivar->getUsageType(BaseType);
2933 T= Ivar->getType();
2934}
else if(
const auto*
Value= dyn_cast<ValueDecl>(ND)) {
2936}
else if(
const auto*
Property= dyn_cast<ObjCPropertyDecl>(ND)) {
2937 if(!BaseType.
isNull())
2946 Result.AddResultTypeChunk(
2953 if(SentinelAttr *Sentinel = FunctionOrMethod->
getAttr<SentinelAttr>())
2954 if(Sentinel->getSentinel() == 0) {
2956 Result.AddTextChunk(
", nil");
2958 Result.AddTextChunk(
", NULL");
2960 Result.AddTextChunk(
", (void*)0");
2981 switch(*nullability) {
2991 Result+=
"null_unspecified ";
2995llvm_unreachable(
"Not supported as a context-sensitive keyword!");
3012 boolSuppressBlock =
false) {
3018 if(!SuppressBlock) {
3021TypedefTL.getTypedefNameDecl()->getTypeSourceInfo()) {
3034TL = AttrTL.getModifiedLoc();
3053 boolSuppressBlockName =
false,
boolSuppressBlock =
false,
3058 boolSuppressName =
false,
boolSuppressBlock =
false,
3066 if(
const auto*PVD = dyn_cast<ParmVarDecl>(Param))
3067ObjCQual = PVD->getObjCDeclQualifier();
3068 boolObjCMethodParam = isa<ObjCMethodDecl>(Param->
getDeclContext());
3075 if(Param->
getIdentifier() && !ObjCMethodParam && !SuppressName)
3082 if(ObjCMethodParam) {
3101 if(!
Block&& ObjCMethodParam &&
3102cast<ObjCMethodDecl>(Param->
getDeclContext())->isPropertyAccessor()) {
3103 if(
const auto*PD = cast<ObjCMethodDecl>(Param->
getDeclContext())
3104->findPropertyDecl(
false))
3118 if(ObjCMethodParam) {
3123 if(
Result.back() !=
')')
3137 false, SuppressBlock,
3153 boolSuppressBlockName,
boolSuppressBlock,
3161 if(!ResultType->
isVoidType() || SuppressBlock)
3166 if(!BlockProto ||
Block.getNumParams() == 0) {
3173 for(
unsignedI = 0, N =
Block.getNumParams(); I != N; ++I) {
3186 if(SuppressBlock) {
3189 if(!SuppressBlockName &&
BlockDecl->getIdentifier())
3198 if(!SuppressBlockName &&
BlockDecl->getIdentifier())
3218 if(srcText.empty() || srcText ==
"=") {
3224std::string DefValue(srcText.str());
3227 if(DefValue.at(0) !=
'=') {
3231 return " = "+ DefValue;
3233 return " "+ DefValue;
3242 boolInOptional =
false) {
3243 boolFirstParameter =
true;
3245 for(
unsigned P= Start, N =
Function->getNumParams();
P!= N; ++
P) {
3252 Result.getCodeCompletionTUInfo());
3253 if(!FirstParameter)
3261FirstParameter =
false;
3265InOptional =
false;
3273 if(
Function->isVariadic() &&
P== N - 1)
3274PlaceholderStr +=
", ...";
3277 Result.AddPlaceholderChunk(
3278 Result.getAllocator().CopyString(PlaceholderStr));
3282 if(Proto->isVariadic()) {
3283 if(Proto->getNumParams() == 0)
3284 Result.AddPlaceholderChunk(
"...");
3294 unsignedMaxParameters = 0,
unsignedStart = 0,
boolInDefaultArg =
false) {
3295 boolFirstParameter =
true;
3304PEnd = Params->
begin() + MaxParameters;
3307 boolHasDefaultArg =
false;
3308std::string PlaceholderStr;
3310 if(TTP->wasDeclaredWithTypename())
3311PlaceholderStr =
"typename";
3312 else if(
const auto*TC = TTP->getTypeConstraint()) {
3313llvm::raw_string_ostream OS(PlaceholderStr);
3314TC->print(OS, Policy);
3316PlaceholderStr =
"class";
3318 if(TTP->getIdentifier()) {
3319PlaceholderStr +=
' ';
3320PlaceholderStr += TTP->getIdentifier()->deuglifiedName();
3323HasDefaultArg = TTP->hasDefaultArgument();
3325dyn_cast<NonTypeTemplateParmDecl>(*
P)) {
3326 if(NTTP->getIdentifier())
3327PlaceholderStr = std::string(NTTP->getIdentifier()->deuglifiedName());
3328NTTP->getType().getAsStringInternal(PlaceholderStr, Policy);
3329HasDefaultArg = NTTP->hasDefaultArgument();
3331assert(isa<TemplateTemplateParmDecl>(*
P));
3336PlaceholderStr =
"template<...> class";
3338PlaceholderStr +=
' ';
3345 if(HasDefaultArg && !InDefaultArg) {
3349 Result.getCodeCompletionTUInfo());
3350 if(!FirstParameter)
3353 P- Params->
begin(),
true);
3358InDefaultArg =
false;
3361FirstParameter =
false;
3366 Result.AddPlaceholderChunk(
3367 Result.getAllocator().CopyString(PlaceholderStr));
3375 boolQualifierIsInformative,
3381std::string PrintedNNS;
3383llvm::raw_string_ostream OS(PrintedNNS);
3384Qualifier->print(OS, Policy);
3386 if(QualifierIsInformative)
3387 Result.AddInformativeChunk(
Result.getAllocator().CopyString(PrintedNNS));
3389 Result.AddTextChunk(
Result.getAllocator().CopyString(PrintedNNS));
3396 if(!Proto || !Proto->getMethodQuals())
3402 if(Proto->getMethodQuals().hasOnlyConst()) {
3403 Result.AddInformativeChunk(
" const");
3407 if(Proto->getMethodQuals().hasOnlyVolatile()) {
3408 Result.AddInformativeChunk(
" volatile");
3412 if(Proto->getMethodQuals().hasOnlyRestrict()) {
3413 Result.AddInformativeChunk(
" restrict");
3418std::string QualsStr;
3419 if(Proto->isConst())
3420QualsStr +=
" const";
3421 if(Proto->isVolatile())
3422QualsStr +=
" volatile";
3423 if(Proto->isRestrict())
3424QualsStr +=
" restrict";
3425 Result.AddInformativeChunk(
Result.getAllocator().CopyString(QualsStr));
3436 switch(Name.getNameKind()) {
3438 const char*OperatorName =
nullptr;
3439 switch(Name.getCXXOverloadedOperator()) {
3441 caseOO_Conditional:
3443OperatorName =
"operator";
3446#define OVERLOADED_OPERATOR(Name, Spelling, Token, Unary, Binary, MemberOnly) \ 3448 OperatorName = "operator"Spelling; \
3450#define OVERLOADED_OPERATOR_MULTI(Name, Spelling, Unary, Binary, MemberOnly) 3451#include "clang/Basic/OperatorKinds.def" 3454OperatorName =
"operator new";
3457OperatorName =
"operator delete";
3460OperatorName =
"operator new[]";
3462 caseOO_Array_Delete:
3463OperatorName =
"operator delete[]";
3466OperatorName =
"operator()";
3469OperatorName =
"operator[]";
3472 Result.AddTypedTextChunk(OperatorName);
3480 Result.AddTypedTextChunk(
3493 QualTypeTy = Name.getCXXNameType();
3495 Record= cast<CXXRecordDecl>(RecordTy->getDecl());
3497 Record= InjectedTy->getDecl();
3499 Result.AddTypedTextChunk(
3504 Result.AddTypedTextChunk(
3505 Result.getAllocator().CopyString(
Record->getNameAsString()));
3519 boolIncludeBriefComments) {
3521CCTUInfo, IncludeBriefComments);
3533 return Result.TakeString();
3544 Result.AddPlaceholderChunk(
"...");
3558 Result.AddPlaceholderChunk(
Result.getAllocator().CopyString(Arg));
3563 Result.AddPlaceholderChunk(
3564 Result.getAllocator().CopyString((*A)->getName()));
3567 return Result.TakeString();
3579 boolIncludeBriefComments) {
3595 Result.addBriefComment(RC->getBriefText(Ctx));
3605 return Result.TakeString();
3609PP, Ctx,
Result, IncludeBriefComments, CCContext, Policy);
3613std::string &BeforeName,
3614std::string &NameAndSignature) {
3615 boolSeenTypedChunk =
false;
3616 for(
auto&Chunk : CCS) {
3618assert(SeenTypedChunk &&
"optional parameter before name");
3625NameAndSignature += Chunk.Text;
3627BeforeName += Chunk.Text;
3639std::string BeforeName;
3640std::string NameAndSignature;
3643NameAndSignature +=
" override";
3645 Result.AddTextChunk(
Result.getAllocator().CopyString(BeforeName));
3647 Result.AddTypedTextChunk(
Result.getAllocator().CopyString(NameAndSignature));
3648 return Result.TakeString();
3654 const auto*VD = dyn_cast<VarDecl>(ND);
3657 const auto*
RecordDecl= VD->getType()->getAsCXXRecordDecl();
3670 if(IncludeBriefComments) {
3673 Result.addBriefComment(RC->getBriefText(Ctx));
3678 Result.AddTypedTextChunk(
3680 Result.AddTextChunk(
"::");
3681 return Result.TakeString();
3685 Result.AddAnnotation(
Result.getAllocator().CopyString(I->getAnnotation()));
3698 if(
const auto*
Function= dyn_cast<FunctionDecl>(ND)) {
3699AddFunctionTypeAndResult(
Function);
3700 return Result.TakeString();
3703 if(
const auto*CallOperator =
3705AddFunctionTypeAndResult(CallOperator);
3706 return Result.TakeString();
3712dyn_cast<FunctionTemplateDecl>(ND)) {
3723llvm::SmallBitVector Deduced(FunTmpl->getTemplateParameters()->size());
3728 unsignedLastDeducibleArgument;
3729 for(LastDeducibleArgument = Deduced.size(); LastDeducibleArgument > 0;
3730--LastDeducibleArgument) {
3731 if(!Deduced[LastDeducibleArgument - 1]) {
3735 boolHasDefaultArg =
false;
3736 NamedDecl*Param = FunTmpl->getTemplateParameters()->getParam(
3737LastDeducibleArgument - 1);
3739HasDefaultArg = TTP->hasDefaultArgument();
3741dyn_cast<NonTypeTemplateParmDecl>(Param))
3742HasDefaultArg = NTTP->hasDefaultArgument();
3744assert(isa<TemplateTemplateParmDecl>(Param));
3746cast<TemplateTemplateParmDecl>(Param)->hasDefaultArgument();
3769LastDeducibleArgument);
3778 return Result.TakeString();
3781 if(
const auto*Template = dyn_cast<TemplateDecl>(ND)) {
3784 Result.AddTypedTextChunk(
3785 Result.getAllocator().CopyString(Template->getNameAsString()));
3789 return Result.TakeString();
3792 if(
const auto*Method = dyn_cast<ObjCMethodDecl>(ND)) {
3793 SelectorSel = Method->getSelector();
3795 Result.AddTypedTextChunk(
3797 return Result.TakeString();
3803 Result.AddTypedTextChunk(
Result.getAllocator().CopyString(SelName));
3805 Result.AddInformativeChunk(
Result.getAllocator().CopyString(SelName));
3810 Result.AddTypedTextChunk(
"");
3817 P!= PEnd && Idx < Sel.
getNumArgs(); (
void)++
P, ++Idx) {
3836 QualTypeParamType = (*P)->getType();
3837std::optional<ArrayRef<QualType>> ObjCSubsts;
3843 false, ObjCSubsts);
3853Arg += II->getName();
3860 Result.AddTextChunk(
Result.getAllocator().CopyString(Arg));
3862 Result.AddInformativeChunk(
Result.getAllocator().CopyString(Arg));
3864 Result.AddPlaceholderChunk(
Result.getAllocator().CopyString(Arg));
3870 Result.AddTextChunk(
", ...");
3872 Result.AddInformativeChunk(
", ...");
3874 Result.AddPlaceholderChunk(
", ...");
3880 return Result.TakeString();
3887 Result.AddTypedTextChunk(
3889 return Result.TakeString();
3900 const auto*M = dyn_cast<ObjCMethodDecl>(ND);
3912 const auto*M = dyn_cast_or_null<ObjCMethodDecl>(ND);
3913 if(!M || !M->isPropertyAccessor())
3936 autoFDecl =
Result.getFunction();
3939 if(ArgIndex < FDecl->getNumParams())
3947 unsignedCurrentArg) {
3948 unsignedChunkIndex = 0;
3949 autoAddChunk = [&](llvm::StringRef Placeholder) {
3952 const char*
Copy=
Result.getAllocator().CopyString(Placeholder);
3953 if(ChunkIndex == CurrentArg)
3961 if(
auto*CRD = llvm::dyn_cast<CXXRecordDecl>(RD)) {
3962 for(
const auto&
Base: CRD->bases())
3963AddChunk(
Base.getType().getAsString(Policy));
3965 for(
const auto&Field : RD->
fields())
3975 unsignedCurrentArg,
unsignedStart = 0,
boolInOptional =
false) {
3981 boolFirstParameter =
true;
3982 unsignedNumParams =
3985 for(
unsigned P= Start;
P!= NumParams; ++
P) {
3986 if(
Function&&
Function->getParamDecl(
P)->hasDefaultArg() && !InOptional) {
3990 Result.getCodeCompletionTUInfo());
3991 if(!FirstParameter)
3995PrototypeLoc, Opt, CurrentArg,
P,
4002FirstParameter =
false;
4006InOptional =
false;
4009std::string Placeholder;
4010assert(P < Prototype->getNumParams());
4019Placeholder =
Prototype->getParamType(
P).getAsString(Policy);
4022 if(
P== CurrentArg)
4023 Result.AddCurrentParameterChunk(
4024 Result.getAllocator().CopyString(Placeholder));
4026 Result.AddPlaceholderChunk(
Result.getAllocator().CopyString(Placeholder));
4031 Result.getCodeCompletionTUInfo());
4032 if(!FirstParameter)
4035 if(CurrentArg < NumParams)
4047 if(
const auto*
Type= dyn_cast<TemplateTypeParmDecl>(Param)) {
4049}
else if(
const auto*NonType = dyn_cast<NonTypeTemplateParmDecl>(Param)) {
4050 Optional= NonType->hasDefaultArgument();
4051}
else if(
const auto*Template = dyn_cast<TemplateTemplateParmDecl>(Param)) {
4052 Optional= Template->hasDefaultArgument();
4055llvm::raw_string_ostream OS(
Result);
4056Param->
print(OS, Policy);
4062 if(
const auto*CTD = dyn_cast<ClassTemplateDecl>(TD))
4063 returnCTD->getTemplatedDecl()->getKindName().str();
4064 if(
const auto*VTD = dyn_cast<VarTemplateDecl>(TD))
4065 returnVTD->getTemplatedDecl()->getType().getAsString(Policy);
4066 if(
const auto*FTD = dyn_cast<FunctionTemplateDecl>(TD))
4067 returnFTD->getTemplatedDecl()->getReturnType().getAsString(Policy);
4068 if(isa<TypeAliasTemplateDecl>(TD))
4070 if(isa<TemplateTemplateParmDecl>(TD))
4072 if(isa<ConceptDecl>(TD))
4082Builder.getCodeCompletionTUInfo());
4084 if(!ResultType.empty())
4085Builder.AddResultTypeChunk(Builder.getAllocator().CopyString(ResultType));
4086Builder.AddTextChunk(
4092 for(
unsignedI = 0; I < Params.size(); ++I) {
4094std::string Placeholder =
4097Current = &OptionalBuilder;
4100Current->AddChunk(I == CurrentArg
4103Current->getAllocator().CopyString(Placeholder));
4106 if(Current == &OptionalBuilder)
4107Builder.AddOptionalChunk(OptionalBuilder.
TakeString());
4111 if(isa<FunctionTemplateDecl>(TD))
4112Builder.AddInformativeChunk(
"()");
4113 returnBuilder.TakeString();
4120 boolBraced)
const{
4144 if(IncludeBriefComments) {
4151llvm::raw_string_ostream OS(Name);
4153 Result.AddTextChunk(
Result.getAllocator().CopyString(Name));
4156 Result.AddResultTypeChunk(
Result.getAllocator().CopyString(
4171 return Result.TakeString();
4176 boolPreferredTypeIsPointer) {
4180 if(MacroName ==
"nil"|| MacroName ==
"NULL"|| MacroName ==
"Nil") {
4182 if(PreferredTypeIsPointer)
4186 else if(MacroName ==
"YES"|| MacroName ==
"NO"|| MacroName ==
"true"||
4187MacroName ==
"false")
4190 else if(MacroName ==
"bool")
4203 caseDecl::EnumConstant:
4207 caseDecl::Function:
4209 caseDecl::ObjCCategory:
4211 caseDecl::ObjCCategoryImpl:
4213 caseDecl::ObjCImplementation:
4216 caseDecl::ObjCInterface:
4218 caseDecl::ObjCIvar:
4220 caseDecl::ObjCMethod:
4221 returncast<ObjCMethodDecl>(
D)->isInstanceMethod()
4224 caseDecl::CXXMethod:
4226 caseDecl::CXXConstructor:
4228 caseDecl::CXXDestructor:
4230 caseDecl::CXXConversion:
4232 caseDecl::ObjCProperty:
4234 caseDecl::ObjCProtocol:
4240 caseDecl::TypeAlias:
4242 caseDecl::TypeAliasTemplate:
4246 caseDecl::Namespace:
4248 caseDecl::NamespaceAlias:
4250 caseDecl::TemplateTypeParm:
4252 caseDecl::NonTypeTemplateParm:
4254 caseDecl::TemplateTemplateParm:
4256 caseDecl::FunctionTemplate:
4258 caseDecl::ClassTemplate:
4260 caseDecl::AccessSpec:
4262 caseDecl::ClassTemplatePartialSpecialization:
4264 caseDecl::UsingDirective:
4266 caseDecl::StaticAssert:
4270 caseDecl::TranslationUnit:
4274 caseDecl::UnresolvedUsingValue:
4275 caseDecl::UnresolvedUsingTypename:
4278 caseDecl::UsingEnum:
4281 caseDecl::ObjCPropertyImpl:
4282 switch(cast<ObjCPropertyImplDecl>(
D)->getPropertyImplementation()) {
4289llvm_unreachable(
"Unexpected Kind!");
4294 caseDecl::ObjCTypeParam:
4300 caseDecl::LinkageSpec:
4304 if(
const auto*TD = dyn_cast<TagDecl>(
D)) {
4305 switch(TD->getTagKind()) {
4323 boolLoadExternal,
boolIncludeUndefined,
4324 boolTargetTypeIsPointer =
false) {
4327Results.EnterNewScope();
4333 if(IncludeUndefined || MD) {
4341TargetTypeIsPointer)));
4345Results.ExitScope();
4349ResultBuilder &Results) {
4352Results.EnterNewScope();
4356 if(LangOpts.C99 || LangOpts.CPlusPlus11)
4358Results.ExitScope();
4365 unsignedNumResults) {
4428llvm_unreachable(
"Invalid ParserCompletionContext!");
4440ResultBuilder &Results) {
4443 while(isa<BlockDecl>(CurContext))
4446 CXXMethodDecl*Method = dyn_cast<CXXMethodDecl>(CurContext);
4453 if(!
P->getDeclName())
4459Results.getCodeCompletionTUInfo());
4466S.
Context, CurContext, Overridden->getDeclContext());
4469llvm::raw_string_ostream OS(Str);
4470NNS->
print(OS, Policy);
4471Builder.AddTextChunk(Results.getAllocator().CopyString(Str));
4473}
else if(!InContext->
Equals(Overridden->getDeclContext()))
4476Builder.AddTypedTextChunk(
4477Results.getAllocator().CopyString(Overridden->getNameAsString()));
4479 boolFirstParam =
true;
4482FirstParam =
false;
4486Builder.AddPlaceholderChunk(
4487Results.getAllocator().CopyString(
P->getIdentifier()->getName()));
4493Results.Ignore(Overridden);
4500ResultBuilder Results(SemaRef, CodeCompleter->getAllocator(),
4501CodeCompleter->getCodeCompletionTUInfo(),
4503Results.EnterNewScope();
4508 if(
Path.empty()) {
4512 for(
unsignedI = 0, N = Modules.size(); I != N; ++I) {
4513Builder.AddTypedTextChunk(
4514Builder.getAllocator().CopyString(Modules[I]->Name));
4515Results.AddResult(
Result(
4520}
else if(getLangOpts().Modules) {
4527 for(
auto*Submodule : Mod->
submodules()) {
4528Builder.AddTypedTextChunk(
4529Builder.getAllocator().CopyString(Submodule->Name));
4530Results.AddResult(
Result(
4537Results.ExitScope();
4539Results.getCompletionContext(), Results.data(),
4545ResultBuilder Results(SemaRef, CodeCompleter->getAllocator(),
4546CodeCompleter->getCodeCompletionTUInfo(),
4548Results.EnterNewScope();
4553 switch(CompletionContext) {
4556 casePCC_ObjCInterface:
4557 casePCC_ObjCImplementation:
4558 casePCC_ObjCInstanceVariableList:
4560 casePCC_MemberTemplate:
4562 casePCC_LocalDeclarationSpecifiers:
4563Results.setFilter(&ResultBuilder::IsOrdinaryNonValueName);
4567 casePCC_TopLevelOrExpression:
4568 casePCC_ParenthesizedExpression:
4569 casePCC_Expression:
4573Results.setFilter(&ResultBuilder::IsOrdinaryName);
4575Results.setFilter(&ResultBuilder::IsOrdinaryNonTypeName);
4581 casePCC_RecoveryInFunction:
4589 if(!ThisType.isNull())
4590Results.setObjectTypeQualifiers(ThisType->getPointeeType().getQualifiers(),
4593CodeCompletionDeclConsumer Consumer(Results, SemaRef.
CurContext);
4595CodeCompleter->includeGlobals(),
4596CodeCompleter->loadExternal());
4599Results.ExitScope();
4601 switch(CompletionContext) {
4602 casePCC_ParenthesizedExpression:
4603 casePCC_Expression:
4605 casePCC_TopLevelOrExpression:
4606 casePCC_RecoveryInFunction:
4607 if(S->getFnParent())
4613 casePCC_ObjCInterface:
4614 casePCC_ObjCImplementation:
4615 casePCC_ObjCInstanceVariableList:
4617 casePCC_MemberTemplate:
4621 casePCC_LocalDeclarationSpecifiers:
4625 if(CodeCompleter->includeMacros())
4629Results.getCompletionContext(), Results.data(),
4636 boolAtArgumentExpression,
boolIsSuper,
4637ResultBuilder &Results);
4640 boolAllowNonIdentifiers,
4641 boolAllowNestedNameSpecifiers) {
4643ResultBuilder Results(
4644SemaRef, CodeCompleter->getAllocator(),
4645CodeCompleter->getCodeCompletionTUInfo(),
4646AllowNestedNameSpecifiers
4651Results.EnterNewScope();
4654Results.AddResult(
Result(
"const"));
4655Results.AddResult(
Result(
"volatile"));
4656 if(getLangOpts().
C99)
4657Results.AddResult(
Result(
"restrict"));
4663Results.AddResult(
"final");
4665 if(AllowNonIdentifiers) {
4666Results.AddResult(
Result(
"operator"));
4670 if(AllowNestedNameSpecifiers) {
4671Results.allowNestedNameSpecifiers();
4672Results.setFilter(&ResultBuilder::IsImpossibleToSatisfy);
4673CodeCompletionDeclConsumer Consumer(Results, SemaRef.
CurContext);
4675Consumer, CodeCompleter->includeGlobals(),
4676CodeCompleter->loadExternal());
4677Results.setFilter(
nullptr);
4680Results.ExitScope();
4686 if(AllowNonIdentifiers && !AllowNestedNameSpecifiers &&
4705Results.getCompletionContext(), Results.data(),
4710 if(
Scope==
"clang")
4712 if(
Scope==
"gnu")
4718 if(
Scope==
"_Clang")
4720 if(
Scope==
"__gnu__")
4728 if(Completion == AttributeCompletion::None)
4730ResultBuilder Results(SemaRef, CodeCompleter->getAllocator(),
4731CodeCompleter->getCodeCompletionTUInfo(),
4744llvm::StringRef InScopeName;
4745 boolInScopeUnderscore =
false;
4747InScopeName = InScope->
getName();
4749InScopeName = NoUnderscore;
4750InScopeUnderscore =
true;
4757llvm::DenseSet<llvm::StringRef> FoundScopes;
4759 if(A.IsTargetSpecific &&
4760!A.existsInTarget(getASTContext().getTargetInfo()))
4762 if(!A.acceptsLangOpts(getLangOpts()))
4764 for(
const auto&S : A.Spellings) {
4765 if(S.Syntax != Syntax)
4767llvm::StringRef Name = S.NormalizedFullName;
4768llvm::StringRef
Scope;
4771std::tie(
Scope, Name) = Name.split(
"::");
4773std::swap(Name,
Scope);
4777 if(Completion == AttributeCompletion::Scope) {
4779 if(!
Scope.empty() && FoundScopes.insert(
Scope).second) {
4790 if(!InScopeName.empty()) {
4791 if(
Scope!= InScopeName)
4796 autoAdd = [&](llvm::StringRef
Scope, llvm::StringRef Name,
4799Results.getCodeCompletionTUInfo());
4801 if(!
Scope.empty()) {
4803 Text.append(
"::");
4806 Text.append(
"__");
4809 Text.append(
"__");
4810Builder.AddTypedTextChunk(Results.getAllocator().CopyString(
Text));
4812 if(!A.ArgNames.empty()) {
4815 for(
const char*Arg : A.ArgNames) {
4819Builder.AddPlaceholderChunk(Arg);
4824Results.AddResult(Builder.TakeString());
4831 if(!InScopeUnderscore)
4832Add(
Scope, Name,
false);
4837 if(!(InScope && !InScopeUnderscore) && SyntaxSupportsGuards) {
4839 if(
Scope.empty()) {
4840Add(
Scope, Name,
true);
4845Add(GuardedScope, Name,
true);
4855 for(
const auto&Entry : ParsedAttrInfoRegistry::entries())
4856AddCompletions(*Entry.instantiate());
4859Results.getCompletionContext(), Results.data(),
4865 boolIsParenthesized =
false)
4866: PreferredType(PreferredType), IntegralConstantExpression(
false),
4867ObjCCollection(
false), IsParenthesized(IsParenthesized) {}
4878structCoveredEnumerators {
4886 constCoveredEnumerators &Enumerators) {
4888 if(Context.
getLangOpts().CPlusPlus && !Qualifier && Enumerators.Seen.empty()) {
4895Results.EnterNewScope();
4896 for(
auto*
E:
Enum->enumerators()) {
4897 if(Enumerators.Seen.count(
E))
4901Results.AddResult(R, CurContext,
nullptr,
false);
4903Results.ExitScope();
4909assert(!
T.isNull());
4932 if(!Results.includeCodePatterns())
4935Results.getCodeCompletionTUInfo());
4940 if(!Parameters.empty()) {
4949 constexprllvm::StringLiteral NamePlaceholder =
"!#!NAME_GOES_HERE!#!";
4950std::string
Type= std::string(NamePlaceholder);
4952llvm::StringRef Prefix, Suffix;
4953std::tie(Prefix, Suffix) = llvm::StringRef(
Type).split(NamePlaceholder);
4954Prefix = Prefix.rtrim();
4955Suffix = Suffix.ltrim();
4971Results.AddResult(Completion.
TakeString());
4978ResultBuilder Results(
4979SemaRef, CodeCompleter->getAllocator(),
4980CodeCompleter->getCodeCompletionTUInfo(),
4982 Data.IsParenthesized
4985 Data.PreferredType));
4987 Data.IsParenthesized ? PCC_ParenthesizedExpression : PCC_Expression;
4988 if(
Data.ObjCCollection)
4989Results.setFilter(&ResultBuilder::IsObjCCollection);
4990 else if(
Data.IntegralConstantExpression)
4991Results.setFilter(&ResultBuilder::IsIntegralConstantValue);
4993Results.setFilter(&ResultBuilder::IsOrdinaryName);
4995Results.setFilter(&ResultBuilder::IsOrdinaryNonTypeName);
4997 if(!
Data.PreferredType.isNull())
4998Results.setPreferredType(
Data.PreferredType.getNonReferenceType());
5001 for(
unsignedI = 0, N =
Data.IgnoreDecls.size(); I != N; ++I)
5002Results.Ignore(
Data.IgnoreDecls[I]);
5004CodeCompletionDeclConsumer Consumer(Results, SemaRef.
CurContext);
5006CodeCompleter->includeGlobals(),
5007CodeCompleter->loadExternal());
5009Results.EnterNewScope();
5011Results.ExitScope();
5013 boolPreferredTypeIsPointer =
false;
5014 if(!
Data.PreferredType.isNull()) {
5015PreferredTypeIsPointer =
Data.PreferredType->isAnyPointerType() ||
5016 Data.PreferredType->isMemberPointerType() ||
5017 Data.PreferredType->isBlockPointerType();
5018 if(
Data.PreferredType->isEnumeralType()) {
5020 if(
auto*Def =
Enum->getDefinition())
5025CoveredEnumerators());
5029 if(S->getFnParent() && !
Data.ObjCCollection &&
5030!
Data.IntegralConstantExpression)
5033 if(CodeCompleter->includeMacros())
5035PreferredTypeIsPointer);
5045Results.getCompletionContext(), Results.data(),
5051 boolIsParenthesized) {
5052 returnCodeCompleteExpression(
5058 if(
E.isInvalid())
5059CodeCompleteExpression(S, PreferredType);
5060 else if(getLangOpts().
ObjC)
5061CodeCompleteObjCInstanceMessage(S,
E.get(), {},
false);
5078 if(Protocol->hasDefinition())
5079 returnProtocol->getDefinition();
5093Builder.AddResultTypeChunk(
5095Policy, Builder.getAllocator()));
5101Builder.AddPlaceholderChunk(
"...");
5103 for(
unsignedI = 0, N = BlockLoc.
getNumParams(); I != N; ++I) {
5108std::string PlaceholderStr =
5111 if(I == N - 1 && BlockProtoLoc &&
5113PlaceholderStr +=
", ...";
5116Builder.AddPlaceholderChunk(
5117Builder.getAllocator().CopyString(PlaceholderStr));
5127 boolAllowNullaryMethods,
DeclContext*CurContext,
5129 boolIsBaseExprStatement =
false,
5130 boolIsClassProperty =
false,
boolInOriginalClass =
true) {
5138 if(!AddedProperties.insert(
P->getIdentifier()).second)
5143 if(!
P->getType().getTypePtr()->isBlockPointerType() ||
5144!IsBaseExprStatement) {
5146 if(!InOriginalClass)
5148Results.MaybeAddResult(R, CurContext);
5160 if(!InOriginalClass)
5162Results.MaybeAddResult(R, CurContext);
5169Results.getCodeCompletionTUInfo());
5172BlockLoc, BlockProtoLoc);
5173 ResultR =
Result(Builder.TakeString(),
P, Results.getBasePriority(
P));
5174 if(!InOriginalClass)
5176Results.MaybeAddResult(R, CurContext);
5180 if(!
P->isReadOnly()) {
5182Results.getCodeCompletionTUInfo());
5186Builder.AddTypedTextChunk(
5187Results.getAllocator().CopyString(
P->getName()));
5192BlockProtoLoc,
true);
5194Builder.AddPlaceholderChunk(
5195Builder.getAllocator().CopyString(PlaceholderStr));
5203 Result(Builder.TakeString(),
P,
5204Results.getBasePriority(
P) +
5208 if(!InOriginalClass)
5210Results.MaybeAddResult(R, CurContext);
5214 if(IsClassProperty) {
5215 for(
const auto*
P: Container->class_properties())
5218 for(
const auto*
P: Container->instance_properties())
5223 if(AllowNullaryMethods) {
5224 ASTContext&Context = Container->getASTContext();
5228 const IdentifierInfo*Name = M->getSelector().getIdentifierInfoForSlot(0);
5231 if(!AddedProperties.insert(Name).second)
5234Results.getCodeCompletionTUInfo());
5236Builder.AddTypedTextChunk(
5237Results.getAllocator().CopyString(Name->getName()));
5240 if(!InOriginalClass)
5242Results.MaybeAddResult(R, CurContext);
5245 if(IsClassProperty) {
5246 for(
const auto*M : Container->methods()) {
5250 if(!M->getSelector().isUnarySelector() ||
5251M->getReturnType()->isVoidType() || M->isInstanceMethod())
5256 for(
auto*M : Container->methods()) {
5257 if(M->getSelector().isUnarySelector())
5265 for(
auto*
P: Protocol->protocols())
5267CurContext, AddedProperties, Results,
5268IsBaseExprStatement, IsClassProperty,
5271dyn_cast<ObjCInterfaceDecl>(Container)) {
5272 if(AllowCategories) {
5274 for(
auto*Cat : IFace->known_categories())
5276CurContext, AddedProperties, Results,
5277IsBaseExprStatement, IsClassProperty,
5282 for(
auto*I : IFace->all_referenced_protocols())
5284CurContext, AddedProperties, Results,
5285IsBaseExprStatement, IsClassProperty,
5289 if(IFace->getSuperClass())
5291AllowNullaryMethods, CurContext, AddedProperties,
5292Results, IsBaseExprStatement, IsClassProperty,
5294}
else if(
const auto*
Category=
5295dyn_cast<ObjCCategoryDecl>(Container)) {
5297 for(
auto*
P:
Category->protocols())
5299CurContext, AddedProperties, Results,
5300IsBaseExprStatement, IsClassProperty,
5309std::optional<FixItHint> AccessOpFixIt) {
5312Results.setObjectTypeQualifiers(BaseType.
getQualifiers(), BaseKind);
5315Results.allowNestedNameSpecifiers();
5316std::vector<FixItHint> FixIts;
5318FixIts.emplace_back(*AccessOpFixIt);
5319CodeCompletionDeclConsumer Consumer(Results, RD, BaseType, std::move(FixIts));
5327 if(!Results.empty()) {
5333 for(
Scope*DepScope = S; DepScope; DepScope = DepScope->getParent())
5335IsDependent = Ctx->isDependentContext();
5352 if(
const auto*CTSD =
5353llvm::dyn_cast<ClassTemplateSpecializationDecl>(RD)) {
5357RD = CTSD->getSpecializedTemplate()->getTemplatedDecl();
5363 if(
const auto*TD = dyn_cast_or_null<ClassTemplateDecl>(
5364TST->getTemplateName().getAsTemplateDecl())) {
5365 returnTD->getTemplatedDecl();
5409std::optional<SmallVector<QualType, 1>> ArgTypes;
5411 enumAccessOperator {
5428std::string AsString;
5430llvm::raw_string_ostream OS(AsString);
5431 QualTypeExactType = deduceType(*ResultType);
5432 if(!ExactType.
isNull())
5437B.AddResultTypeChunk(
Alloc.CopyString(AsString));
5440B.AddTypedTextChunk(
Alloc.CopyString(Name->getName()));
5452B.AddPlaceholderChunk(
Alloc.CopyString(
5457 returnB.TakeString();
5465 auto*TemplatedEntity = getTemplatedEntity(BaseType.
getDecl(), S);
5466 for(
const Expr*
E: constraintsForTemplatedEntity(TemplatedEntity))
5467believe(
E, &BaseType);
5470std::vector<Member> members() {
5471std::vector<Member> Results;
5472 for(
const auto&
E: this->Results)
5473Results.push_back(
E.second);
5474llvm::sort(Results, [](
const Member&L,
const Member&R) {
5475 returnL.Name->getName() < R.Name->getName();
5485 if(
auto*CSE = dyn_cast<ConceptSpecializationExpr>(
E)) {
5499 for(
const auto&Arg : CSE->getTemplateArguments()) {
5500 if(Index >= Params->
size())
5502 if(isApprox(Arg,
T)) {
5503 auto*TTPD = dyn_cast<TemplateTypeParmDecl>(Params->
getParam(Index));
5507 auto*TT = cast<TemplateTypeParmType>(TTPD->getTypeForDecl());
5515}
else if(
auto*BO = dyn_cast<BinaryOperator>(
E)) {
5518 if(BO->getOpcode() == BO_LAnd || BO->getOpcode() == BO_LOr) {
5519believe(BO->getLHS(),
T);
5520believe(BO->getRHS(),
T);
5522}
else if(
auto*RE = dyn_cast<RequiresExpr>(
E)) {
5525 if(!Req->isDependent())
5529 if(
auto*TR = dyn_cast<concepts::TypeRequirement>(Req)) {
5531 QualTypeAssertedType = TR->getType()->getType();
5532ValidVisitor(
this,
T).TraverseType(AssertedType);
5533}
else if(
auto*ER = dyn_cast<concepts::ExprRequirement>(Req)) {
5534ValidVisitor Visitor(
this,
T);
5538 if(ER->getReturnTypeRequirement().isTypeConstraint()) {
5540ER->getReturnTypeRequirement().getTypeConstraint();
5541Visitor.OuterExpr = ER->getExpr();
5543Visitor.TraverseStmt(ER->getExpr());
5544}
else if(
auto*NR = dyn_cast<concepts::NestedRequirement>(Req)) {
5545believe(NR->getConstraintExpr(),
T);
5562 Expr*OuterExpr =
nullptr;
5566: Outer(Outer),
T(
T) {
5573 const Type*
Base=
E->getBaseType().getTypePtr();
5574 boolIsArrow =
E->isArrow();
5575 if(
Base->isPointerType() && IsArrow) {
5577 Base=
Base->getPointeeType().getTypePtr();
5579 if(isApprox(
Base,
T))
5580addValue(
E,
E->getMember(), IsArrow ? Member::Arrow : Member::Dot);
5586 if(
E->getQualifier() && isApprox(
E->getQualifier()->getAsType(),
T))
5587addValue(
E,
E->getDeclName(), Member::Colons);
5594 if(Q && isApprox(Q->getAsType(),
T))
5605 if(Q && isApprox(Q->getAsType(),
T))
5616 boolVisitCallExpr(
CallExpr*CE)
override{
5623 voidaddResult(
Member&&M) {
5624 autoR = Outer->Results.try_emplace(M.Name);
5625 Member&O = R.first->second;
5629std::make_tuple(M.ArgTypes.has_value(), M.ResultType !=
nullptr,
5630M.Operator) > std::make_tuple(O.ArgTypes.has_value(),
5631O.ResultType !=
nullptr,
5641M.Operator = Member::Colons;
5642addResult(std::move(M));
5646Member::AccessOperator Operator) {
5647 if(!Name.isIdentifier())
5650Result.Name = Name.getAsIdentifierInfo();
5651Result.Operator = Operator;
5654 if(Caller !=
nullptr&& Callee ==
E) {
5655Result.ArgTypes.emplace();
5656 for(
const auto*Arg : Caller->
arguments())
5657Result.ArgTypes->push_back(Arg->getType());
5658 if(Caller == OuterExpr) {
5659Result.ResultType = OuterType;
5662 if(
E== OuterExpr)
5663Result.ResultType = OuterType;
5665addResult(std::move(Result));
5674 static boolisApprox(
const Type*T1,
const Type*T2) {
5687 Scope*Inner =
nullptr;
5689 if(S->isTemplateParamScope() && S->isDeclScope(
D))
5690 returnInner ? Inner->getEntity() :
nullptr;
5706TD->getAssociatedConstraints(Result);
5708 if(
const auto*CTPSD =
5709dyn_cast<ClassTemplatePartialSpecializationDecl>(DC))
5710CTPSD->getAssociatedConstraints(Result);
5711 if(
const auto*VTPSD = dyn_cast<VarTemplatePartialSpecializationDecl>(DC))
5712VTPSD->getAssociatedConstraints(Result);
5723 if(
const auto*Args =
T.getTemplateArgsAsWritten())
5724 if(Args->getNumTemplateArgs() == 1) {
5725 const auto&Arg = Args->arguments().front().getArgument();
5732llvm::DenseMap<const IdentifierInfo *, Member> Results;
5747Decls.size() == 1) {
5748 if(
const auto*TD = dyn_cast<TypeDecl>(Decls[0]))
5749 return QualType(TD->getTypeForDecl(), 0);
5753 if(!
Unresolved->isSpecificBuiltinType(BuiltinType::Dependent)) {
5755 if(!
Auto|| !
Auto->isUndeducedAutoType())
5759 if(
const CallExpr*CE = llvm::dyn_cast<CallExpr>(
E)) {
5762 Callee->isSpecificPlaceholderType(BuiltinType::BoundMember))
5768 Callee= FnTypePtr->getPointeeType();
5770 Callee= BPT->getPointeeType();
5773 returnFnType->getReturnType().getNonReferenceType();
5776 if(
const auto*OE = llvm::dyn_cast<OverloadExpr>(CE->
getCallee())) {
5780 const Type*Common =
nullptr;
5781 for(
const auto*
D: OE->decls()) {
5783 if(
const auto*FD = llvm::dyn_cast<FunctionDecl>(
D))
5784ReturnType = FD->getReturnType();
5785 else if(
const auto*FTD = llvm::dyn_cast<FunctionTemplateDecl>(
D))
5786ReturnType = FTD->getTemplatedDecl()->getReturnType();
5787 if(ReturnType.
isNull())
5789 const Type*Candidate =
5791 if(Common && Common != Candidate)
5795 if(Common !=
nullptr)
5800 if(
const auto*CDSME = llvm::dyn_cast<CXXDependentScopeMemberExpr>(
E)) {
5802 if(
const auto*VD = dyn_cast<ValueDecl>(
Member)) {
5803 returnVD->getType().getNonReferenceType();
5808 if(
const auto*DRE = llvm::dyn_cast<DeclRefExpr>(
E)) {
5809 if(
const auto*VD = llvm::dyn_cast<VarDecl>(DRE->getDecl())) {
5811 returngetApproximateType(VD->getInit(), Resolver);
5814 if(
const auto*UO = llvm::dyn_cast<UnaryOperator>(
E)) {
5815 if(UO->getOpcode() == UnaryOperatorKind::UO_Deref) {
5819getApproximateType(UO->getSubExpr(), Resolver)->getPointeeType();
5834 if(
auto*PLE = llvm::dyn_cast_or_null<ParenListExpr>(
Base)) {
5835 if(PLE->getNumExprs() == 0)
5837 Base= PLE->getExpr(PLE->getNumExprs() - 1);
5846 boolIsBaseExprStatement,
QualTypePreferredType) {
5848OtherOpBase = unwrapParenList(OtherOpBase);
5849 if(!
Base|| !CodeCompleter)
5857getApproximateType(ConvertedBase.
get(), Resolver);
5863!PointeeType.
isNull()) {
5864ConvertedBaseType = PointeeType;
5881ResultBuilder Results(SemaRef, CodeCompleter->getAllocator(),
5882CodeCompleter->getCodeCompletionTUInfo(), CCContext,
5883&ResultBuilder::IsMember);
5885 autoDoCompletion = [&](
Expr*
Base,
boolIsArrow,
5886std::optional<FixItHint> AccessOpFixIt) ->
bool{
5896 QualTypeBaseType = getApproximateType(
Base, Resolver);
5903!PointeeType.
isNull()) {
5904BaseType = PointeeType;
5916RD, std::move(AccessOpFixIt));
5917}
else if(
const auto*TTPT =
5918dyn_cast<TemplateTypeParmType>(BaseType.
getTypePtr())) {
5920IsArrow ? ConceptInfo::Member::Arrow : ConceptInfo::Member::Dot;
5921 for(
const auto&R : ConceptInfo(*TTPT, S).members()) {
5922 if(R.Operator != Operator)
5925R.render(SemaRef, CodeCompleter->getAllocator(),
5926CodeCompleter->getCodeCompletionTUInfo()));
5928 Result.FixIts.push_back(*AccessOpFixIt);
5929Results.AddResult(std::move(
Result));
5935 if(AccessOpFixIt) {
5943assert(ObjCPtr &&
"Non-NULL pointer guaranteed above!");
5946AddedProperties, Results, IsBaseExprStatement);
5952SemaRef.
CurContext, AddedProperties, Results,
5953IsBaseExprStatement,
false,
5960 if(AccessOpFixIt) {
5966 Class= ObjCPtr->getInterfaceDecl();
5972CodeCompletionDeclConsumer Consumer(Results,
Class, BaseType);
5973Results.setFilter(&ResultBuilder::IsObjCIvar);
5975CodeCompleter->includeGlobals(),
5977CodeCompleter->loadExternal());
5985Results.EnterNewScope();
5987 boolCompletionSucceded = DoCompletion(
Base, IsArrow, std::nullopt);
5988 if(CodeCompleter->includeFixIts()) {
5991CompletionSucceded |= DoCompletion(
5992OtherOpBase, !IsArrow,
5996Results.ExitScope();
5998 if(!CompletionSucceded)
6003Results.getCompletionContext(), Results.data(),
6009 boolIsBaseExprStatement) {
6017ResultBuilder Results(SemaRef, CodeCompleter->getAllocator(),
6018CodeCompleter->getCodeCompletionTUInfo(), CCContext,
6019&ResultBuilder::IsMember);
6020Results.EnterNewScope();
6024AddedProperties, Results, IsBaseExprStatement,
6026Results.ExitScope();
6028Results.getCompletionContext(), Results.data(),
6036ResultBuilder::LookupFilter Filter =
nullptr;
6041Filter = &ResultBuilder::IsEnum;
6046Filter = &ResultBuilder::IsUnion;
6053Filter = &ResultBuilder::IsClassOrStruct;
6058llvm_unreachable(
"Unknown type specifier kind in CodeCompleteTag");
6061ResultBuilder Results(SemaRef, CodeCompleter->getAllocator(),
6062CodeCompleter->getCodeCompletionTUInfo(), ContextKind);
6063CodeCompletionDeclConsumer Consumer(Results, SemaRef.
CurContext);
6066Results.setFilter(Filter);
6068CodeCompleter->includeGlobals(),
6069CodeCompleter->loadExternal());
6071 if(CodeCompleter->includeGlobals()) {
6073Results.setFilter(&ResultBuilder::IsNestedNameSpecifier);
6075CodeCompleter->includeGlobals(),
6076CodeCompleter->loadExternal());
6080Results.getCompletionContext(), Results.data(),
6087Results.AddResult(
"const");
6089Results.AddResult(
"volatile");
6091Results.AddResult(
"restrict");
6093Results.AddResult(
"_Atomic");
6095Results.AddResult(
"__unaligned");
6099ResultBuilder Results(SemaRef, CodeCompleter->getAllocator(),
6100CodeCompleter->getCodeCompletionTUInfo(),
6102Results.EnterNewScope();
6104Results.ExitScope();
6106Results.getCompletionContext(), Results.data(),
6112ResultBuilder Results(SemaRef, CodeCompleter->getAllocator(),
6113CodeCompleter->getCodeCompletionTUInfo(),
6115Results.EnterNewScope();
6118Results.AddResult(
"noexcept");
6120!
D.isStaticMember()) {
6122Results.AddResult(
"final");
6124Results.AddResult(
"override");
6127Results.ExitScope();
6129Results.getCompletionContext(), Results.data(),
6134CodeCompleteExpression(S,
QualType(getASTContext().getSizeType()));
6144 if(!
Switch->getCond())
6147 if(!
type->isEnumeralType()) {
6149 Data.IntegralConstantExpression =
true;
6150CodeCompleteExpression(S,
Data);
6164CoveredEnumerators Enumerators;
6166SC = SC->getNextSwitchCase()) {
6167 CaseStmt*Case = dyn_cast<CaseStmt>(SC);
6172 if(
auto*DRE = dyn_cast<DeclRefExpr>(CaseVal))
6173 if(
auto*Enumerator =
6174dyn_cast<EnumConstantDecl>(DRE->getDecl())) {
6181Enumerators.Seen.insert(Enumerator);
6194Enumerators.SuggestedQualifier = DRE->getQualifier();
6199ResultBuilder Results(SemaRef, CodeCompleter->getAllocator(),
6200CodeCompleter->getCodeCompletionTUInfo(),
6205 if(CodeCompleter->includeMacros()) {
6209Results.getCompletionContext(), Results.data(),
6214 if(Args.size() && !Args.data())
6217 for(
unsignedI = 0; I != Args.size(); ++I)
6238 if(Candidate.Function) {
6239 if(Candidate.Function->isDeleted())
6242Candidate.Function) &&
6243Candidate.Function->getNumParams() <= ArgSize &&
6252 if(Candidate.Viable)
6266 for(
auto&Candidate : Candidates) {
6267 QualTypeCandidateParamType = Candidate.getParamType(N);
6268 if(CandidateParamType.
isNull())
6270 if(ParamType.
isNull()) {
6271ParamType = CandidateParamType;
6288 if(Candidates.empty())
6292SemaRef, CurrentArg, Candidates.data(), Candidates.size(), OpenParLoc,
6303 if(
const auto*
T= Fn->getType().getTypePtr()->getAs<
TypedefType>()) {
6304 Target=
T->getDecl()->getTypeSourceInfo()->getTypeLoc();
6306}
else if(
const auto*DR = dyn_cast<DeclRefExpr>(Fn)) {
6307 const auto*
D= DR->getDecl();
6308 if(
const auto*
constVD = dyn_cast<VarDecl>(
D)) {
6309 Target= VD->getTypeSourceInfo()->getTypeLoc();
6311}
else if(
const auto*ME = dyn_cast<MemberExpr>(Fn)) {
6312 const auto*MD = ME->getMemberDecl();
6313 if(
const auto*FD = dyn_cast<FieldDecl>(MD)) {
6314 Target= FD->getTypeSourceInfo()->getTypeLoc();
6328 Target= A.getModifiedLoc();
6348Fn = unwrapParenList(Fn);
6349 if(!CodeCompleter || !Fn)
6359 autoArgsWithoutDependentTypes =
6364 Expr*NakedFn = Fn->IgnoreParenCasts();
6369 if(
autoULE = dyn_cast<UnresolvedLookupExpr>(NakedFn)) {
6373}
else if(
autoUME = dyn_cast<UnresolvedMemberExpr>(NakedFn)) {
6375 if(UME->hasExplicitTemplateArgs()) {
6376UME->copyTemplateArgumentsInto(TemplateArgsBuffer);
6377TemplateArgs = &TemplateArgsBuffer;
63821, UME->isImplicitAccess() ?
nullptr: UME->getBase());
6383ArgExprs.append(ArgsWithoutDependentTypes.begin(),
6384ArgsWithoutDependentTypes.end());
6386Decls.
append(UME->decls_begin(), UME->decls_end());
6387 const boolFirstArgumentIsBase = !UME->isImplicitAccess() && UME->getBase();
6391FirstArgumentIsBase);
6394 if(
auto*MCE = dyn_cast<MemberExpr>(NakedFn))
6395FD = dyn_cast<FunctionDecl>(MCE->getMemberDecl());
6396 else if(
auto*DRE = dyn_cast<DeclRefExpr>(NakedFn))
6397FD = dyn_cast<FunctionDecl>(DRE->getDecl());
6405ArgsWithoutDependentTypes, CandidateSet,
6415getASTContext().DeclarationNames.getCXXOperatorName(OO_Call);
6420ArgExprs.append(ArgsWithoutDependentTypes.begin(),
6421ArgsWithoutDependentTypes.end());
6439ArgsWithoutDependentTypes.size(),
6455OpenParLoc,
false);
6475staticstd::optional<unsigned>
6478 static constexpr unsigned Invalid= std::numeric_limits<unsigned>::max();
6484 unsignedArgsAfterDesignator = 0;
6485 for(
const Expr*Arg : Args) {
6486 if(
const auto*DIE = dyn_cast<DesignatedInitExpr>(Arg)) {
6487 if(DIE->size() == 1 && DIE->getDesignator(0)->isFieldDesignator()) {
6488DesignatedFieldName = DIE->getDesignator(0)->getFieldName();
6489ArgsAfterDesignator = 0;
6493}
else if(isa<DesignatedInitUpdateExpr>(Arg)) {
6496++ArgsAfterDesignator;
6499 if(!DesignatedFieldName)
6500 returnstd::nullopt;
6504 unsignedDesignatedIndex = 0;
6505 const FieldDecl*DesignatedField =
nullptr;
6506 for(
const auto*Field :
Aggregate.getAggregate()->fields()) {
6507 if(Field->getIdentifier() == DesignatedFieldName) {
6508DesignatedField = Field;
6513 if(!DesignatedField)
6517 unsignedAggregateSize =
Aggregate.getNumParams();
6518 while(DesignatedIndex < AggregateSize &&
6519 Aggregate.getParamDecl(DesignatedIndex) != DesignatedField)
6523 returnDesignatedIndex + ArgsAfterDesignator + 1;
6546 if(Braced && !RD->
isUnion() &&
6549 unsignedAggregateSize = AggregateSig.
getNumParams();
6551 if(
autoNextIndex =
6554 if(*NextIndex >= AggregateSize)
6556Results.push_back(AggregateSig);
6562 if(Args.size() < AggregateSize)
6563Results.push_back(AggregateSig);
6572 if(
auto*FD = dyn_cast<FunctionDecl>(
C)) {
6575 if(Braced && getLangOpts().
CPlusPlus&&
6583}
else if(
auto*FTD = dyn_cast<FunctionTemplateDecl>(
C)) {
6584 if(Braced && getLangOpts().
CPlusPlus&&
6590 nullptr, Args, CandidateSet,
6611dyn_cast<CXXConstructorDecl>(ConstructorDecl);
6616Constructor->getParent(), SS, TemplateTypeTy, II))
6617 returnProduceConstructorSignatureHelp(MemberDecl->getType(),
6618MemberDecl->getLocation(), ArgExprs,
6619OpenParLoc, Braced);
6627 if(Index < Params.
size())
6630Param = Params.
asArray().back();
6636 returnllvm::isa<TemplateTypeParmDecl>(Param);
6638 returnllvm::isa<NonTypeTemplateParmDecl>(Param);
6640 returnllvm::isa<TemplateTemplateParmDecl>(Param);
6642llvm_unreachable(
"Unhandled switch case");
6648 if(!CodeCompleter || !ParsedTemplate)
6654 boolMatches =
true;
6655 for(
unsignedI = 0; I < Args.size(); ++I) {
6662Results.emplace_back(TD);
6670 if(
const auto*TD = llvm::dyn_cast<TemplateDecl>(ND))
6683 if(
D.isArrayDesignator() ||
D.isArrayRangeDesignator()) {
6687assert(
D.isFieldDesignator());
6689 if(RD && RD->isCompleteDefinition()) {
6690 for(
const auto*
Member: RD->lookup(
D.getFieldDecl()))
6692NextType = FD->getType();
6697BaseType = NextType;
6708 if(!RD || RD->fields().empty())
6713ResultBuilder Results(SemaRef, CodeCompleter->getAllocator(),
6714CodeCompleter->getCodeCompletionTUInfo(), CCC);
6716Results.EnterNewScope();
6717 for(
const Decl*
D: RD->decls()) {
6719 if(
auto*IFD = dyn_cast<IndirectFieldDecl>(
D))
6720FD = IFD->getAnonField();
6721 else if(
auto*DFD = dyn_cast<FieldDecl>(
D))
6731Results.ExitScope();
6733Results.getCompletionContext(), Results.data(),
6738 ValueDecl*VD = dyn_cast_or_null<ValueDecl>(
D);
6740CodeCompleteOrdinaryName(S, PCC_Expression);
6747 Data.IgnoreDecls.push_back(VD);
6749CodeCompleteExpression(S,
Data);
6753ResultBuilder Results(SemaRef, CodeCompleter->getAllocator(),
6754CodeCompleter->getCodeCompletionTUInfo(),
6756Results.setFilter(&ResultBuilder::IsOrdinaryName);
6757Results.EnterNewScope();
6759CodeCompletionDeclConsumer Consumer(Results, SemaRef.
CurContext);
6761CodeCompleter->includeGlobals(),
6762CodeCompleter->loadExternal());
6768Results.getCodeCompletionTUInfo());
6770 autoAddElseBodyPattern = [&] {
6775Builder.AddPlaceholderChunk(
"statements");
6781Builder.AddPlaceholderChunk(
"statement");
6785Builder.AddTypedTextChunk(
"else");
6786 if(Results.includeCodePatterns())
6787AddElseBodyPattern();
6788Results.AddResult(Builder.TakeString());
6791Builder.AddTypedTextChunk(
"else if");
6795Builder.AddPlaceholderChunk(
"condition");
6797Builder.AddPlaceholderChunk(
"expression");
6799 if(Results.includeCodePatterns()) {
6800AddElseBodyPattern();
6802Results.AddResult(Builder.TakeString());
6804Results.ExitScope();
6806 if(S->getFnParent())
6809 if(CodeCompleter->includeMacros())
6813Results.getCompletionContext(), Results.data(),
6818 boolEnteringContext,
6819 boolIsUsingDeclaration,
6822 if(SS.
isEmpty() || !CodeCompleter)
6837ResultBuilder DummyResults(SemaRef, CodeCompleter->getAllocator(),
6838CodeCompleter->getCodeCompletionTUInfo(), CC);
6839 if(!PreferredType.
isNull())
6840DummyResults.setPreferredType(PreferredType);
6841 if(S->getEntity()) {
6842CodeCompletionDeclConsumer Consumer(DummyResults, S->getEntity(),
6849DummyResults.getCompletionContext(),
nullptr, 0);
6864ResultBuilder Results(SemaRef, CodeCompleter->getAllocator(),
6865CodeCompleter->getCodeCompletionTUInfo(), CC);
6866 if(!PreferredType.
isNull())
6867Results.setPreferredType(PreferredType);
6868Results.EnterNewScope();
6873 if(!Results.empty() && NNS && NNS->
isDependent())
6874Results.AddResult(
"template");
6879 if(
const auto*TTPT =
6880dyn_cast_or_null<TemplateTypeParmType>(NNS->
getAsType())) {
6881 for(
const auto&R : ConceptInfo(*TTPT, S).members()) {
6882 if(R.Operator != ConceptInfo::Member::Colons)
6885R.render(SemaRef, CodeCompleter->getAllocator(),
6886CodeCompleter->getCodeCompletionTUInfo())));
6896 if(Ctx && !EnteringContext)
6898Results.ExitScope();
6901(CodeCompleter->includeNamespaceLevelDecls() || !Ctx->isFileContext())) {
6902CodeCompletionDeclConsumer Consumer(Results, Ctx, BaseType);
6906CodeCompleter->loadExternal());
6910Results.getCompletionContext(), Results.data(),
6921Context.setIsUsingDeclaration(
true);
6923ResultBuilder Results(SemaRef, CodeCompleter->getAllocator(),
6924CodeCompleter->getCodeCompletionTUInfo(), Context,
6925&ResultBuilder::IsNestedNameSpecifier);
6926Results.EnterNewScope();
6929 if(!S->isClassScope())
6934CodeCompletionDeclConsumer Consumer(Results, SemaRef.
CurContext);
6936CodeCompleter->includeGlobals(),
6937CodeCompleter->loadExternal());
6938Results.ExitScope();
6941Results.getCompletionContext(), Results.data(),
6951ResultBuilder Results(SemaRef, CodeCompleter->getAllocator(),
6952CodeCompleter->getCodeCompletionTUInfo(),
6954&ResultBuilder::IsNamespaceOrAlias);
6955Results.EnterNewScope();
6956CodeCompletionDeclConsumer Consumer(Results, SemaRef.
CurContext);
6958CodeCompleter->includeGlobals(),
6959CodeCompleter->loadExternal());
6960Results.ExitScope();
6962Results.getCompletionContext(), Results.data(),
6971 if(!S->getParent())
6974 boolSuppressedGlobalResults =
6975Ctx && !CodeCompleter->includeGlobals() && isa<TranslationUnitDecl>(Ctx);
6977ResultBuilder Results(SemaRef, CodeCompleter->getAllocator(),
6978CodeCompleter->getCodeCompletionTUInfo(),
6979SuppressedGlobalResults
6982&ResultBuilder::IsNamespace);
6984 if(Ctx && Ctx->isFileContext() && !SuppressedGlobalResults) {
6989std::map<NamespaceDecl *, NamespaceDecl *> OrigToLatest;
6991NS(Ctx->decls_begin()),
6992NSEnd(Ctx->decls_end());
6994OrigToLatest[NS->getFirstDecl()] = *NS;
6998Results.EnterNewScope();
6999 for(std::map<NamespaceDecl *, NamespaceDecl *>::iterator
7000NS = OrigToLatest.begin(),
7001NSEnd = OrigToLatest.end();
7007Results.ExitScope();
7011Results.getCompletionContext(), Results.data(),
7020ResultBuilder Results(SemaRef, CodeCompleter->getAllocator(),
7021CodeCompleter->getCodeCompletionTUInfo(),
7023&ResultBuilder::IsNamespaceOrAlias);
7024CodeCompletionDeclConsumer Consumer(Results, SemaRef.
CurContext);
7026CodeCompleter->includeGlobals(),
7027CodeCompleter->loadExternal());
7029Results.getCompletionContext(), Results.data(),
7038ResultBuilder Results(SemaRef, CodeCompleter->getAllocator(),
7039CodeCompleter->getCodeCompletionTUInfo(),
7041&ResultBuilder::IsType);
7042Results.EnterNewScope();
7046#define OVERLOADED_OPERATOR(Name, Spelling, Token, Unary, Binary, MemberOnly) \ 7047 if (OO_##Name != OO_Conditional) \ 7048 Results.AddResult(Result(Spelling)); 7049#include "clang/Basic/OperatorKinds.def" 7052Results.allowNestedNameSpecifiers();
7053CodeCompletionDeclConsumer Consumer(Results, SemaRef.
CurContext);
7055CodeCompleter->includeGlobals(),
7056CodeCompleter->loadExternal());
7060Results.ExitScope();
7063Results.getCompletionContext(), Results.data(),
7074 auto*Constructor = dyn_cast<CXXConstructorDecl>(ConstructorD);
7078ResultBuilder Results(SemaRef, CodeCompleter->getAllocator(),
7079CodeCompleter->getCodeCompletionTUInfo(),
7081Results.EnterNewScope();
7086 for(
unsignedI = 0,
E= Initializers.size(); I !=
E; ++I) {
7087 if(Initializers[I]->isBaseInitializer())
7088InitializedBases.insert(getASTContext().getCanonicalType(
7089 QualType(Initializers[I]->getBaseClass(), 0)));
7091InitializedFields.insert(
7092cast<FieldDecl>(Initializers[I]->getAnyMember()));
7097 boolSawLastInitializer = Initializers.empty();
7100 autoGenerateCCS = [&](
const NamedDecl*ND,
const char*Name) {
7102Results.getCodeCompletionTUInfo());
7103Builder.AddTypedTextChunk(Name);
7105 if(
const auto*
Function= dyn_cast<FunctionDecl>(ND))
7107 else if(
const auto*FunTemplDecl = dyn_cast<FunctionTemplateDecl>(ND))
7109FunTemplDecl->getTemplatedDecl(), Builder);
7111 returnBuilder.TakeString();
7113 autoAddDefaultCtorInit = [&](
const char*Name,
const char*
Type,
7116Results.getCodeCompletionTUInfo());
7117Builder.AddTypedTextChunk(Name);
7119Builder.AddPlaceholderChunk(
Type);
7123Builder.TakeString(), ND,
7125 if(isa<FieldDecl>(ND))
7127 returnResults.AddResult(CCR);
7130Builder.TakeString(),
7134 const char*Name,
const FieldDecl*FD) {
7136 returnAddDefaultCtorInit(Name,
7137FD ? Results.getAllocator().CopyString(
7138FD->getType().getAsString(Policy))
7142 if(Ctors.begin() == Ctors.end())
7143 returnAddDefaultCtorInit(Name, Name, RD);
7147Results.AddResult(CCR);
7151 const char*BaseName =
7152Results.getAllocator().CopyString(
Base.getType().getAsString(Policy));
7153 const auto*RD =
Base.getType()->getAsCXXRecordDecl();
7156BaseName,
nullptr);
7158 autoAddField = [&](
const FieldDecl*FD) {
7159 const char*FieldName =
7160Results.getAllocator().CopyString(FD->getIdentifier()->getName());
7161 const CXXRecordDecl*RD = FD->getType()->getAsCXXRecordDecl();
7167 for(
const auto&
Base: ClassDecl->
bases()) {
7168 if(!InitializedBases
7169.insert(getASTContext().getCanonicalType(
Base.getType()))
7171SawLastInitializer =
7172!Initializers.empty() && Initializers.back()->isBaseInitializer() &&
7173getASTContext().hasSameUnqualifiedType(
7174 Base.getType(),
QualType(Initializers.back()->getBaseClass(), 0));
7179SawLastInitializer =
false;
7183 for(
const auto&
Base: ClassDecl->
vbases()) {
7184 if(!InitializedBases
7185.insert(getASTContext().getCanonicalType(
Base.getType()))
7187SawLastInitializer =
7188!Initializers.empty() && Initializers.back()->isBaseInitializer() &&
7189getASTContext().hasSameUnqualifiedType(
7190 Base.getType(),
QualType(Initializers.back()->getBaseClass(), 0));
7195SawLastInitializer =
false;
7199 for(
auto*Field : ClassDecl->
fields()) {
7200 if(!InitializedFields.insert(cast<FieldDecl>(Field->getCanonicalDecl()))
7202SawLastInitializer = !Initializers.empty() &&
7203Initializers.back()->isAnyMemberInitializer() &&
7204Initializers.back()->getAnyMember() == Field;
7208 if(!Field->getDeclName())
7212SawLastInitializer =
false;
7214Results.ExitScope();
7217Results.getCompletionContext(), Results.data(),
7232 boolAfterAmpersand) {
7233ResultBuilder Results(SemaRef, CodeCompleter->getAllocator(),
7234CodeCompleter->getCodeCompletionTUInfo(),
7236Results.EnterNewScope();
7240 boolIncludedThis =
false;
7241 for(
const auto&
C: Intro.
Captures) {
7243IncludedThis =
true;
7247Known.insert(
C.Id);
7252 for(
const auto*
D: S->decls()) {
7253 const auto*Var = dyn_cast<VarDecl>(
D);
7254 if(!Var || !Var->hasLocalStorage() || Var->hasAttr<BlocksAttr>())
7257 if(Known.insert(Var->getIdentifier()).second)
7267Results.ExitScope();
7270Results.getCompletionContext(), Results.data(),
7277ResultBuilder Results(SemaRef, CodeCompleter->getAllocator(),
7278CodeCompleter->getCodeCompletionTUInfo(),
7280 autoShouldAddDefault = [&
D,
this]() {
7281 if(!
D.isFunctionDeclarator())
7283 auto&
Id=
D.getName();
7289 D.getFunctionTypeInfo().NumParams <= 1)
7292 autoOp =
Id.OperatorFunctionId.Operator;
7295 if(Op == OverloadedOperatorKind::OO_Equal)
7297 if(getLangOpts().CPlusPlus20 &&
7298(Op == OverloadedOperatorKind::OO_EqualEqual ||
7299Op == OverloadedOperatorKind::OO_ExclaimEqual ||
7300Op == OverloadedOperatorKind::OO_Less ||
7301Op == OverloadedOperatorKind::OO_LessEqual ||
7302Op == OverloadedOperatorKind::OO_Greater ||
7303Op == OverloadedOperatorKind::OO_GreaterEqual ||
7304Op == OverloadedOperatorKind::OO_Spaceship))
7310Results.EnterNewScope();
7311 if(ShouldAddDefault())
7312Results.AddResult(
"default");
7315Results.AddResult(
"delete");
7316Results.ExitScope();
7318Results.getCompletionContext(), Results.data(),
7324#define OBJC_AT_KEYWORD_NAME(NeedAt, Keyword) ((NeedAt) ? "@"Keyword : Keyword)
7327ResultBuilder &Results,
boolNeedAt) {
7333Results.getCodeCompletionTUInfo());
7334 if(LangOpts.ObjC) {
7338Builder.AddPlaceholderChunk(
"property");
7339Results.AddResult(
Result(Builder.TakeString()));
7344Builder.AddPlaceholderChunk(
"property");
7345Results.AddResult(
Result(Builder.TakeString()));
7350ResultBuilder &Results,
boolNeedAt) {
7356 if(LangOpts.ObjC) {
7371Results.getCodeCompletionTUInfo());
7376Builder.AddPlaceholderChunk(
"name");
7377Results.AddResult(
Result(Builder.TakeString()));
7379 if(Results.includeCodePatterns()) {
7385Builder.AddPlaceholderChunk(
"class");
7386Results.AddResult(
Result(Builder.TakeString()));
7391Builder.AddPlaceholderChunk(
"protocol");
7392Results.AddResult(
Result(Builder.TakeString()));
7397Builder.AddPlaceholderChunk(
"class");
7398Results.AddResult(
Result(Builder.TakeString()));
7402Builder.AddTypedTextChunk(
7405Builder.AddPlaceholderChunk(
"alias");
7407Builder.AddPlaceholderChunk(
"class");
7408Results.AddResult(
Result(Builder.TakeString()));
7410 if(Results.getSema().getLangOpts().Modules) {
7414Builder.AddPlaceholderChunk(
"module");
7415Results.AddResult(
Result(Builder.TakeString()));
7420ResultBuilder Results(SemaRef, CodeCompleter->getAllocator(),
7421CodeCompleter->getCodeCompletionTUInfo(),
7423Results.EnterNewScope();
7430Results.ExitScope();
7432Results.getCompletionContext(), Results.data(),
7439Results.getCodeCompletionTUInfo());
7442 const char*EncodeType =
"char[]";
7443 if(Results.getSema().getLangOpts().CPlusPlus ||
7444Results.getSema().getLangOpts().ConstStrings)
7445EncodeType =
"const char[]";
7446Builder.AddResultTypeChunk(EncodeType);
7449Builder.AddPlaceholderChunk(
"type-name");
7451Results.AddResult(
Result(Builder.TakeString()));
7454Builder.AddResultTypeChunk(
"Protocol *");
7457Builder.AddPlaceholderChunk(
"protocol-name");
7459Results.AddResult(
Result(Builder.TakeString()));
7462Builder.AddResultTypeChunk(
"SEL");
7465Builder.AddPlaceholderChunk(
"selector");
7467Results.AddResult(
Result(Builder.TakeString()));
7470Builder.AddResultTypeChunk(
"NSString *");
7472Builder.AddPlaceholderChunk(
"string");
7473Builder.AddTextChunk(
"\"");
7474Results.AddResult(
Result(Builder.TakeString()));
7477Builder.AddResultTypeChunk(
"NSArray *");
7479Builder.AddPlaceholderChunk(
"objects, ...");
7481Results.AddResult(
Result(Builder.TakeString()));
7484Builder.AddResultTypeChunk(
"NSDictionary *");
7486Builder.AddPlaceholderChunk(
"key");
7489Builder.AddPlaceholderChunk(
"object, ...");
7491Results.AddResult(
Result(Builder.TakeString()));
7494Builder.AddResultTypeChunk(
"id");
7496Builder.AddPlaceholderChunk(
"expression");
7498Results.AddResult(
Result(Builder.TakeString()));
7504Results.getCodeCompletionTUInfo());
7506 if(Results.includeCodePatterns()) {
7511Builder.AddPlaceholderChunk(
"statements");
7513Builder.AddTextChunk(
"@catch");
7515Builder.AddPlaceholderChunk(
"parameter");
7518Builder.AddPlaceholderChunk(
"statements");
7520Builder.AddTextChunk(
"@finally");
7522Builder.AddPlaceholderChunk(
"statements");
7524Results.AddResult(
Result(Builder.TakeString()));
7530Builder.AddPlaceholderChunk(
"expression");
7531Results.AddResult(
Result(Builder.TakeString()));
7533 if(Results.includeCodePatterns()) {
7538Builder.AddPlaceholderChunk(
"expression");
7541Builder.AddPlaceholderChunk(
"statements");
7543Results.AddResult(
Result(Builder.TakeString()));
7548ResultBuilder &Results,
boolNeedAt) {
7558ResultBuilder Results(SemaRef, CodeCompleter->getAllocator(),
7559CodeCompleter->getCodeCompletionTUInfo(),
7561Results.EnterNewScope();
7563Results.ExitScope();
7565Results.getCompletionContext(), Results.data(),
7570ResultBuilder Results(SemaRef, CodeCompleter->getAllocator(),
7571CodeCompleter->getCodeCompletionTUInfo(),
7573Results.EnterNewScope();
7576Results.ExitScope();
7578Results.getCompletionContext(), Results.data(),
7583ResultBuilder Results(SemaRef, CodeCompleter->getAllocator(),
7584CodeCompleter->getCodeCompletionTUInfo(),
7586Results.EnterNewScope();
7588Results.ExitScope();
7590Results.getCompletionContext(), Results.data(),
7598 if(Attributes & NewFlag)
7601Attributes |= NewFlag;
7609 unsignedAssignCopyRetMask =
7615 if(AssignCopyRetMask &&
7634ResultBuilder Results(SemaRef, CodeCompleter->getAllocator(),
7635CodeCompleter->getCodeCompletionTUInfo(),
7637Results.EnterNewScope();
7674Results.getCodeCompletionTUInfo());
7683Results.getCodeCompletionTUInfo());
7696Results.ExitScope();
7698Results.getCompletionContext(), Results.data(),
7712 boolAllowSameLength =
true) {
7713 unsignedNumSelIdents = SelIdents.size();
7726 if(!AllowSameLength && NumSelIdents && NumSelIdents == Sel.
getNumArgs())
7729 for(
unsignedI = 0; I != NumSelIdents; ++I)
7739 boolAllowSameLength =
true) {
7773ResultBuilder &Results,
boolInOriginalClass =
true,
7774 boolIsRootClass =
false) {
7778IsRootClass = IsRootClass || (IFace && !IFace->
getSuperClass());
7782 if(M->isInstanceMethod() == WantInstanceMethods ||
7783(IsRootClass && !WantInstanceMethods)) {
7789 if(!Selectors.insert(M->getSelector()).second)
7792 ResultR =
Result(M, Results.getBasePriority(M),
nullptr);
7793R.StartParameter = SelIdents.size();
7794R.AllParametersAreInformative = (WantKind !=
MK_Any);
7795 if(!InOriginalClass)
7797Results.MaybeAddResult(R, CurContext);
7802 if(
const auto*Protocol = dyn_cast<ObjCProtocolDecl>(Container)) {
7803 if(Protocol->hasDefinition()) {
7805Protocol->getReferencedProtocols();
7807 E= Protocols.
end();
7809 AddObjCMethods(*I, WantInstanceMethods, WantKind, SelIdents, CurContext,
7810Selectors, AllowSameLength, Results,
false, IsRootClass);
7819 AddObjCMethods(I, WantInstanceMethods, WantKind, SelIdents, CurContext,
7820Selectors, AllowSameLength, Results,
false, IsRootClass);
7824 AddObjCMethods(CatDecl, WantInstanceMethods, WantKind, SelIdents,
7825CurContext, Selectors, AllowSameLength, Results,
7826InOriginalClass, IsRootClass);
7830CatDecl->getReferencedProtocols();
7832 E= Protocols.
end();
7834 AddObjCMethods(*I, WantInstanceMethods, WantKind, SelIdents, CurContext,
7835Selectors, AllowSameLength, Results,
false, IsRootClass);
7839 AddObjCMethods(Impl, WantInstanceMethods, WantKind, SelIdents, CurContext,
7840Selectors, AllowSameLength, Results, InOriginalClass,
7848SelIdents, CurContext, Selectors, AllowSameLength, Results,
7853 AddObjCMethods(Impl, WantInstanceMethods, WantKind, SelIdents, CurContext,
7854Selectors, AllowSameLength, Results, InOriginalClass,
7861dyn_cast_or_null<ObjCInterfaceDecl>(SemaRef.
CurContext);
7864dyn_cast_or_null<ObjCCategoryDecl>(SemaRef.
CurContext))
7872ResultBuilder Results(SemaRef, CodeCompleter->getAllocator(),
7873CodeCompleter->getCodeCompletionTUInfo(),
7875Results.EnterNewScope();
7881Results.ExitScope();
7883Results.getCompletionContext(), Results.data(),
7890dyn_cast_or_null<ObjCInterfaceDecl>(SemaRef.
CurContext);
7893dyn_cast_or_null<ObjCCategoryDecl>(SemaRef.
CurContext))
7901ResultBuilder Results(SemaRef, CodeCompleter->getAllocator(),
7902CodeCompleter->getCodeCompletionTUInfo(),
7904Results.EnterNewScope();
7911Results.ExitScope();
7913Results.getCompletionContext(), Results.data(),
7919ResultBuilder Results(SemaRef, CodeCompleter->getAllocator(),
7920CodeCompleter->getCodeCompletionTUInfo(),
7922Results.EnterNewScope();
7925 boolAddedInOut =
false;
7928Results.AddResult(
"in");
7929Results.AddResult(
"inout");
7934Results.AddResult(
"out");
7936Results.AddResult(
"inout");
7941Results.AddResult(
"bycopy");
7942Results.AddResult(
"byref");
7943Results.AddResult(
"oneway");
7946Results.AddResult(
"nonnull");
7947Results.AddResult(
"nullable");
7948Results.AddResult(
"null_unspecified");
7958Results.getCodeCompletionTUInfo(),
7960Builder.AddTypedTextChunk(
"IBAction");
7962Builder.AddPlaceholderChunk(
"selector");
7965Builder.AddTextChunk(
"id");
7967Builder.AddTextChunk(
"sender");
7978Results.ExitScope();
7981Results.setFilter(&ResultBuilder::IsOrdinaryNonValueName);
7982CodeCompletionDeclConsumer Consumer(Results, SemaRef.
CurContext);
7984CodeCompleter->includeGlobals(),
7985CodeCompleter->loadExternal());
7987 if(CodeCompleter->includeMacros())
7991Results.getCompletionContext(), Results.data(),
8000 auto*Msg = dyn_cast_or_null<ObjCMessageExpr>(
E);
8018 switch(Msg->getReceiverKind()) {
8022IFace = ObjType->getInterface();
8026 QualType T= Msg->getInstanceReceiver()->getType();
8028IFace = Ptr->getInterfaceDecl();
8042 returnllvm::StringSwitch<ObjCInterfaceDecl *>(
Id->getName())
8043.Case(
"retain", IFace)
8044.Case(
"strong", IFace)
8045.Case(
"autorelease", IFace)
8046.Case(
"copy", IFace)
8047.Case(
"copyWithZone", IFace)
8048.Case(
"mutableCopy", IFace)
8049.Case(
"mutableCopyWithZone", IFace)
8050.Case(
"awakeFromCoder", IFace)
8051.Case(
"replacementObjectFromCoder", IFace)
8052.Case(
"class", IFace)
8053.Case(
"classForCoder", IFace)
8054.Case(
"superclass", Super)
8055.Default(
nullptr);
8057 returnllvm::StringSwitch<ObjCInterfaceDecl *>(
Id->getName())
8058.Case(
"new", IFace)
8059.Case(
"alloc", IFace)
8060.Case(
"allocWithZone", IFace)
8061.Case(
"class", IFace)
8062.Case(
"superclass", Super)
8063.Default(
nullptr);
8085ResultBuilder &Results) {
8096 while((
Class=
Class->getSuperClass()) && !SuperMethod) {
8103 for(
const auto*Cat :
Class->known_categories()) {
8104 if((SuperMethod = Cat->getMethod(CurMethod->
getSelector(),
8122CurP != CurPEnd; ++CurP, ++SuperP) {
8125(*SuperP)->getType()))
8129 if(!(*CurP)->getIdentifier())
8135Results.getCodeCompletionTUInfo());
8139Results.getCompletionContext().getBaseType(), Builder);
8142 if(NeedSuperKeyword) {
8143Builder.AddTypedTextChunk(
"super");
8149 if(NeedSuperKeyword)
8150Builder.AddTextChunk(
8153Builder.AddTypedTextChunk(
8157 for(
unsignedI = 0, N = Sel.
getNumArgs(); I != N; ++I, ++CurP) {
8158 if(I > SelIdents.size())
8161 if(I < SelIdents.size())
8162Builder.AddInformativeChunk(
8163Builder.getAllocator().CopyString(Sel.
getNameForSlot(I) +
":"));
8164 else if(NeedSuperKeyword || I > SelIdents.size()) {
8165Builder.AddTextChunk(
8166Builder.getAllocator().CopyString(Sel.
getNameForSlot(I) +
":"));
8167Builder.AddPlaceholderChunk(Builder.getAllocator().CopyString(
8168(*CurP)->getIdentifier()->getName()));
8170Builder.AddTypedTextChunk(
8171Builder.getAllocator().CopyString(Sel.
getNameForSlot(I) +
":"));
8172Builder.AddPlaceholderChunk(Builder.getAllocator().CopyString(
8173(*CurP)->getIdentifier()->getName()));
8185ResultBuilder Results(
8186SemaRef, CodeCompleter->getAllocator(),
8187CodeCompleter->getCodeCompletionTUInfo(),
8190? &ResultBuilder::IsObjCMessageReceiverOrLambdaCapture
8191: &ResultBuilder::IsObjCMessageReceiver);
8193CodeCompletionDeclConsumer Consumer(Results, SemaRef.
CurContext);
8194Results.EnterNewScope();
8196CodeCompleter->includeGlobals(),
8197CodeCompleter->loadExternal());
8203 if(Iface->getSuperClass()) {
8204Results.AddResult(
Result(
"super"));
8212Results.ExitScope();
8214 if(CodeCompleter->includeMacros())
8217Results.getCompletionContext(), Results.data(),
8227CDecl = CurMethod->getClassInterface();
8236 if(CurMethod->isInstanceMethod()) {
8240 returnCodeCompleteObjCInstanceMessage(S,
nullptr, SelIdents,
8241AtArgumentExpression, CDecl);
8251 if((CDecl = dyn_cast_or_null<ObjCInterfaceDecl>(ND))) {
8253}
else if(
TypeDecl*TD = dyn_cast_or_null<TypeDecl>(ND)) {
8255getASTContext().getTypeDeclType(TD)->getAs<ObjCObjectType>())
8256CDecl = Iface->getInterface();
8257}
else if(ND && isa<UnresolvedUsingTypenameDecl>(ND)) {
8269 returnCodeCompleteObjCInstanceMessage(S, (
Expr*)SuperExpr.
get(),
8270SelIdents, AtArgumentExpression);
8279 returnCodeCompleteObjCClassMessage(S, Receiver, SelIdents,
8280AtArgumentExpression,
8287 unsignedNumSelIdents) {
8289 ASTContext&Context = Results.getSema().Context;
8293 Result*ResultsData = Results.data();
8294 for(
unsignedI = 0, N = Results.size(); I != N; ++I) {
8295 Result&R = ResultsData[I];
8296 if(R.Kind == Result::RK_Declaration &&
8297isa<ObjCMethodDecl>(R.Declaration)) {
8298 if(R.Priority <= BestPriority) {
8299 const ObjCMethodDecl*Method = cast<ObjCMethodDecl>(R.Declaration);
8300 if(NumSelIdents <= Method->param_size()) {
8302Method->
parameters()[NumSelIdents - 1]->getType();
8303 if(R.Priority < BestPriority || PreferredType.
isNull()) {
8304BestPriority = R.Priority;
8305PreferredType = MyPreferredType;
8315 returnPreferredType;
8321 boolAtArgumentExpression,
boolIsSuper,
8322ResultBuilder &Results) {
8337Results.EnterNewScope();
8344Results.Ignore(SuperMethod);
8350Results.setPreferredSelector(CurMethod->getSelector());
8355Selectors, AtArgumentExpression, Results);
8362 for(uint32_t I = 0,
8373 for(SemaObjC::GlobalMethodPool::iterator
8378MethList && MethList->
getMethod(); MethList = MethList->getNext()) {
8382 ResultR(MethList->getMethod(),
8383Results.getBasePriority(MethList->getMethod()),
nullptr);
8384R.StartParameter = SelIdents.size();
8385R.AllParametersAreInformative =
false;
8386Results.MaybeAddResult(R, SemaRef.
CurContext);
8391Results.ExitScope();
8396 boolAtArgumentExpression,
boolIsSuper) {
8400ResultBuilder Results(
8401SemaRef, CodeCompleter->getAllocator(),
8402CodeCompleter->getCodeCompletionTUInfo(),
8407AtArgumentExpression, IsSuper, Results);
8414 if(AtArgumentExpression) {
8417 if(PreferredType.
isNull())
8418CodeCompleteOrdinaryName(S, PCC_Expression);
8420CodeCompleteExpression(S, PreferredType);
8425Results.getCompletionContext(), Results.data(),
8435 Expr*RecExpr =
static_cast<Expr*
>(Receiver);
8443RecExpr = Conv.
get();
8457 returnCodeCompleteObjCClassMessage(
8459AtArgumentExpression, Super);
8464}
else if(RecExpr && getLangOpts().CPlusPlus) {
8467RecExpr = Conv.
get();
8468ReceiverType = RecExpr->
getType();
8473ResultBuilder Results(
8474SemaRef, CodeCompleter->getAllocator(),
8475CodeCompleter->getCodeCompletionTUInfo(),
8477ReceiverType, SelIdents));
8479Results.EnterNewScope();
8486Results.Ignore(SuperMethod);
8492Results.setPreferredSelector(CurMethod->getSelector());
8505Selectors, AtArgumentExpression, Results);
8512 for(
auto*I : QualID->quals())
8514AtArgumentExpression, Results);
8521SemaRef.
CurContext, Selectors, AtArgumentExpression,
8525 for(
auto*I : IFacePtr->quals())
8527AtArgumentExpression, Results);
8537 for(uint32_t I = 0,
8548 for(SemaObjC::GlobalMethodPool::iterator
8553MethList && MethList->
getMethod(); MethList = MethList->getNext()) {
8557 if(!Selectors.insert(MethList->getMethod()->getSelector()).second)
8560 ResultR(MethList->getMethod(),
8561Results.getBasePriority(MethList->getMethod()),
nullptr);
8562R.StartParameter = SelIdents.size();
8563R.AllParametersAreInformative =
false;
8564Results.MaybeAddResult(R, SemaRef.
CurContext);
8568Results.ExitScope();
8575 if(AtArgumentExpression) {
8578 if(PreferredType.
isNull())
8579CodeCompleteOrdinaryName(S, PCC_Expression);
8581CodeCompleteExpression(S, PreferredType);
8586Results.getCompletionContext(), Results.data(),
8593 Data.ObjCCollection =
true;
8599 Data.IgnoreDecls.push_back(*I);
8603CodeCompleteExpression(S,
Data);
8611 for(uint32_t I = 0, N = SemaRef.
ExternalSource->GetNumExternalSelectors();
8621ResultBuilder Results(SemaRef, CodeCompleter->getAllocator(),
8622CodeCompleter->getCodeCompletionTUInfo(),
8624Results.EnterNewScope();
8625 for(SemaObjC::GlobalMethodPool::iterator
8635Results.getCodeCompletionTUInfo());
8637Builder.AddTypedTextChunk(
8639Results.AddResult(Builder.TakeString());
8643std::string Accumulator;
8644 for(
unsignedI = 0, N = Sel.
getNumArgs(); I != N; ++I) {
8645 if(I == SelIdents.size()) {
8646 if(!Accumulator.empty()) {
8647Builder.AddInformativeChunk(
8648Builder.getAllocator().CopyString(Accumulator));
8649Accumulator.clear();
8654Accumulator +=
':';
8656Builder.AddTypedTextChunk(Builder.getAllocator().CopyString(Accumulator));
8657Results.AddResult(Builder.TakeString());
8659Results.ExitScope();
8662Results.getCompletionContext(), Results.data(),
8669 boolOnlyForwardDeclarations,
8670ResultBuilder &Results) {
8673 for(
const auto*
D: Ctx->decls()) {
8675 if(
const auto*Proto = dyn_cast<ObjCProtocolDecl>(
D))
8676 if(!OnlyForwardDeclarations || !Proto->hasDefinition())
8678 Result(Proto, Results.getBasePriority(Proto),
nullptr), CurContext,
8685ResultBuilder Results(SemaRef, CodeCompleter->getAllocator(),
8686CodeCompleter->getCodeCompletionTUInfo(),
8689 if(CodeCompleter->includeGlobals()) {
8690Results.EnterNewScope();
8698Results.Ignore(Protocol);
8704Results.ExitScope();
8708Results.getCompletionContext(), Results.data(),
8713ResultBuilder Results(SemaRef, CodeCompleter->getAllocator(),
8714CodeCompleter->getCodeCompletionTUInfo(),
8717 if(CodeCompleter->includeGlobals()) {
8718Results.EnterNewScope();
8724Results.ExitScope();
8728Results.getCompletionContext(), Results.data(),
8735 boolOnlyForwardDeclarations,
8736 boolOnlyUnimplemented,
8737ResultBuilder &Results) {
8740 for(
const auto*
D: Ctx->decls()) {
8742 if(
const auto*
Class= dyn_cast<ObjCInterfaceDecl>(
D))
8743 if((!OnlyForwardDeclarations || !
Class->hasDefinition()) &&
8744(!OnlyUnimplemented || !
Class->getImplementation()))
8752ResultBuilder Results(SemaRef, CodeCompleter->getAllocator(),
8753CodeCompleter->getCodeCompletionTUInfo(),
8755Results.EnterNewScope();
8757 if(CodeCompleter->includeGlobals()) {
8760SemaRef.
CurContext,
false,
false, Results);
8763Results.ExitScope();
8766Results.getCompletionContext(), Results.data(),
8771ResultBuilder Results(SemaRef, CodeCompleter->getAllocator(),
8772CodeCompleter->getCodeCompletionTUInfo(),
8774Results.EnterNewScope();
8776 if(CodeCompleter->includeGlobals()) {
8779SemaRef.
CurContext,
false,
false, Results);
8782Results.ExitScope();
8785Results.getCompletionContext(), Results.data(),
8791ResultBuilder Results(SemaRef, CodeCompleter->getAllocator(),
8792CodeCompleter->getCodeCompletionTUInfo(),
8794Results.EnterNewScope();
8799 if(CurClass && isa<ObjCInterfaceDecl>(CurClass))
8800Results.Ignore(CurClass);
8802 if(CodeCompleter->includeGlobals()) {
8805SemaRef.
CurContext,
false,
false, Results);
8808Results.ExitScope();
8811Results.getCompletionContext(), Results.data(),
8816ResultBuilder Results(SemaRef, CodeCompleter->getAllocator(),
8817CodeCompleter->getCodeCompletionTUInfo(),
8819Results.EnterNewScope();
8821 if(CodeCompleter->includeGlobals()) {
8824SemaRef.
CurContext,
false,
true, Results);
8827Results.ExitScope();
8830Results.getCompletionContext(), Results.data(),
8838ResultBuilder Results(SemaRef, CodeCompleter->getAllocator(),
8839CodeCompleter->getCodeCompletionTUInfo(),
8848dyn_cast_or_null<ObjCInterfaceDecl>(CurClass)) {
8849 for(
const auto*Cat :
Class->visible_categories())
8850CategoryNames.insert(Cat->getIdentifier());
8854Results.EnterNewScope();
8856 for(
const auto*
D: TU->
decls())
8857 if(
const auto*
Category= dyn_cast<ObjCCategoryDecl>(
D))
8858 if(CategoryNames.insert(
Category->getIdentifier()).second)
8862Results.ExitScope();
8865Results.getCompletionContext(), Results.data(),
8880 returnCodeCompleteObjCInterfaceCategory(S, ClassName, ClassNameLoc);
8882ResultBuilder Results(SemaRef, CodeCompleter->getAllocator(),
8883CodeCompleter->getCodeCompletionTUInfo(),
8890Results.EnterNewScope();
8891 boolIgnoreImplemented =
true;
8893 for(
const auto*Cat :
Class->visible_categories()) {
8894 if((!IgnoreImplemented || !Cat->getImplementation()) &&
8895CategoryNames.insert(Cat->getIdentifier()).second)
8896Results.AddResult(
Result(Cat, Results.getBasePriority(Cat),
nullptr),
8901IgnoreImplemented =
false;
8903Results.ExitScope();
8906Results.getCompletionContext(), Results.data(),
8912ResultBuilder Results(SemaRef, CodeCompleter->getAllocator(),
8913CodeCompleter->getCodeCompletionTUInfo(), CCContext);
8917dyn_cast_or_null<ObjCContainerDecl>(SemaRef.
CurContext);
8918 if(!Container || (!isa<ObjCImplementationDecl>(Container) &&
8919!isa<ObjCCategoryImplDecl>(Container)))
8924 for(
const auto*
D: Container->decls())
8925 if(
const auto*PropertyImpl = dyn_cast<ObjCPropertyImplDecl>(
D))
8926Results.Ignore(PropertyImpl->getPropertyDecl());
8930Results.EnterNewScope();
8932dyn_cast<ObjCImplementationDecl>(Container))
8935AddedProperties, Results);
8938cast<ObjCCategoryImplDecl>(Container)->getCategoryDecl(),
8940AddedProperties, Results);
8941Results.ExitScope();
8944Results.getCompletionContext(), Results.data(),
8951ResultBuilder Results(SemaRef, CodeCompleter->getAllocator(),
8952CodeCompleter->getCodeCompletionTUInfo(),
8957dyn_cast_or_null<ObjCContainerDecl>(SemaRef.
CurContext);
8958 if(!Container || (!isa<ObjCImplementationDecl>(Container) &&
8959!isa<ObjCCategoryImplDecl>(Container)))
8965dyn_cast<ObjCImplementationDecl>(Container))
8966 Class= ClassImpl->getClassInterface();
8968 Class= cast<ObjCCategoryImplDecl>(Container)
8970->getClassInterface();
8973 QualTypePropertyType = getASTContext().getObjCIdType();
8978 Property->getType().getNonReferenceType().getUnqualifiedType();
8981Results.setPreferredType(PropertyType);
8986Results.EnterNewScope();
8987 boolSawSimilarlyNamedIvar =
false;
8988std::string NameWithPrefix;
8989NameWithPrefix +=
'_';
8990NameWithPrefix += PropertyName->getName();
8991std::string NameWithSuffix = PropertyName->getName().str();
8992NameWithSuffix +=
'_';
8995Ivar = Ivar->getNextIvar()) {
8996Results.AddResult(
Result(Ivar, Results.getBasePriority(Ivar),
nullptr),
9001 if((PropertyName == Ivar->getIdentifier() ||
9002NameWithPrefix == Ivar->getName() ||
9003NameWithSuffix == Ivar->getName())) {
9004SawSimilarlyNamedIvar =
true;
9008 if(Results.size() &&
9009Results.data()[Results.size() - 1].Kind ==
9011Results.data()[Results.size() - 1].Declaration == Ivar)
9012Results.data()[Results.size() - 1].Priority--;
9017 if(!SawSimilarlyNamedIvar) {
9028PropertyType, getASTContext(), Policy, Allocator));
9029Builder.AddTypedTextChunk(Allocator.CopyString(NameWithPrefix));
9034Results.ExitScope();
9037Results.getCompletionContext(), Results.data(),
9044llvm::PointerIntPair<ObjCMethodDecl *, 1, bool>>
9053std::optional<bool> WantInstanceMethods,
9056 boolInOriginalClass =
true) {
9059 if(!IFace->hasDefinition())
9062IFace = IFace->getDefinition();
9066IFace->getReferencedProtocols();
9068 E= Protocols.
end();
9071KnownMethods, InOriginalClass);
9074 for(
auto*Cat : IFace->visible_categories()) {
9076KnownMethods,
false);
9080 if(IFace->getSuperClass())
9082WantInstanceMethods, ReturnType, KnownMethods,
9089 Category->getReferencedProtocols();
9091 E= Protocols.
end();
9094KnownMethods, InOriginalClass);
9097 if(InOriginalClass &&
Category->getClassInterface())
9099WantInstanceMethods, ReturnType, KnownMethods,
9105 if(!Protocol->hasDefinition())
9107Protocol = Protocol->getDefinition();
9108Container = Protocol;
9112Protocol->getReferencedProtocols();
9114 E= Protocols.
end();
9117KnownMethods,
false);
9123 for(
auto*M : Container->methods()) {
9124 if(!WantInstanceMethods || M->isInstanceMethod() == *WantInstanceMethods) {
9125 if(!ReturnType.
isNull() &&
9129KnownMethods[M->getSelector()] =
9130KnownMethodsMap::mapped_type(M, InOriginalClass);
9144Builder.AddTextChunk(Builder.getAllocator().CopyString(Quals));
9145Builder.AddTextChunk(
9156 if(
Class->getIdentifier() &&
Class->getIdentifier()->getName() == Name)
9165 boolIsInstanceMethod,
9168ResultBuilder &Results) {
9170 if(!PropName || PropName->
getLength() == 0)
9188 const char*CopiedKey;
9191: Allocator(Allocator), Key(Key), CopiedKey(
nullptr) {}
9193 operator const char*() {
9197 returnCopiedKey = Allocator.CopyString(Key);
9199} Key(Allocator, PropName->
getName());
9202std::string UpperKey = std::string(PropName->
getName());
9203 if(!UpperKey.empty())
9206 boolReturnTypeMatchesProperty =
9210 boolReturnTypeMatchesVoid = ReturnType.
isNull() || ReturnType->
isVoidType();
9213 if(IsInstanceMethod &&
9215ReturnTypeMatchesProperty && !
Property->getGetterMethodDecl()) {
9216 if(ReturnType.
isNull())
9220Builder.AddTypedTextChunk(Key);
9227 if(IsInstanceMethod &&
9228((!ReturnType.
isNull() &&
9230(ReturnType.
isNull() && (
Property->getType()->isIntegerType() ||
9231 Property->getType()->isBooleanType())))) {
9232std::string SelectorName = (Twine(
"is") + UpperKey).str();
9236 if(ReturnType.
isNull()) {
9238Builder.AddTextChunk(
"BOOL");
9242Builder.AddTypedTextChunk(Allocator.CopyString(SelectorId->
getName()));
9249 if(IsInstanceMethod && ReturnTypeMatchesVoid &&
9250!
Property->getSetterMethodDecl()) {
9251std::string SelectorName = (Twine(
"set") + UpperKey).str();
9253 if(KnownSelectors.insert(Selectors.
getUnarySelector(SelectorId)).second) {
9254 if(ReturnType.
isNull()) {
9256Builder.AddTextChunk(
"void");
9260Builder.AddTypedTextChunk(
9261Allocator.CopyString(SelectorId->
getName() +
":"));
9264Builder.AddTextChunk(Key);
9275 if(
const auto*ObjCPointer =
9300 if(IsInstanceMethod &&
9302std::string SelectorName = (Twine(
"countOf") + UpperKey).str();
9306 if(ReturnType.
isNull()) {
9308Builder.AddTextChunk(
"NSUInteger");
9312Builder.AddTypedTextChunk(Allocator.CopyString(SelectorId->
getName()));
9314 Result(Builder.TakeString(),
9315std::min(IndexedGetterPriority, UnorderedGetterPriority),
9322 if(IsInstanceMethod &&
9324std::string SelectorName = (Twine(
"objectIn") + UpperKey +
"AtIndex").str();
9326 if(KnownSelectors.insert(Selectors.
getUnarySelector(SelectorId)).second) {
9327 if(ReturnType.
isNull()) {
9329Builder.AddTextChunk(
"id");
9333Builder.AddTypedTextChunk(Allocator.CopyString(SelectorName +
":"));
9335Builder.AddTextChunk(
"NSUInteger");
9337Builder.AddTextChunk(
"index");
9338Results.AddResult(
Result(Builder.TakeString(), IndexedGetterPriority,
9344 if(IsInstanceMethod &&
9345(ReturnType.
isNull() ||
9350->
getName() ==
"NSArray"))) {
9351std::string SelectorName = (Twine(
Property->getName()) +
"AtIndexes").str();
9353 if(KnownSelectors.insert(Selectors.
getUnarySelector(SelectorId)).second) {
9354 if(ReturnType.
isNull()) {
9356Builder.AddTextChunk(
"NSArray *");
9360Builder.AddTypedTextChunk(Allocator.CopyString(SelectorName +
":"));
9362Builder.AddTextChunk(
"NSIndexSet *");
9364Builder.AddTextChunk(
"indexes");
9365Results.AddResult(
Result(Builder.TakeString(), IndexedGetterPriority,
9371 if(IsInstanceMethod && ReturnTypeMatchesVoid) {
9372std::string SelectorName = (Twine(
"get") + UpperKey).str();
9376 if(KnownSelectors.insert(Selectors.
getSelector(2, SelectorIds)).second) {
9377 if(ReturnType.
isNull()) {
9379Builder.AddTextChunk(
"void");
9383Builder.AddTypedTextChunk(Allocator.CopyString(SelectorName +
":"));
9385Builder.AddPlaceholderChunk(
"object-type");
9386Builder.AddTextChunk(
" **");
9388Builder.AddTextChunk(
"buffer");
9390Builder.AddTypedTextChunk(
"range:");
9392Builder.AddTextChunk(
"NSRange");
9394Builder.AddTextChunk(
"inRange");
9395Results.AddResult(
Result(Builder.TakeString(), IndexedGetterPriority,
9403 if(IsInstanceMethod && ReturnTypeMatchesVoid) {
9404std::string SelectorName = (Twine(
"in") + UpperKey +
"AtIndex").str();
9408 if(KnownSelectors.insert(Selectors.
getSelector(2, SelectorIds)).second) {
9409 if(ReturnType.
isNull()) {
9411Builder.AddTextChunk(
"void");
9415Builder.AddTypedTextChunk(
"insertObject:");
9417Builder.AddPlaceholderChunk(
"object-type");
9418Builder.AddTextChunk(
" *");
9420Builder.AddTextChunk(
"object");
9422Builder.AddTypedTextChunk(Allocator.CopyString(SelectorName +
":"));
9424Builder.AddPlaceholderChunk(
"NSUInteger");
9426Builder.AddTextChunk(
"index");
9427Results.AddResult(
Result(Builder.TakeString(), IndexedSetterPriority,
9433 if(IsInstanceMethod && ReturnTypeMatchesVoid) {
9434std::string SelectorName = (Twine(
"insert") + UpperKey).str();
9436&Context.
Idents.
get(
"atIndexes")};
9438 if(KnownSelectors.insert(Selectors.
getSelector(2, SelectorIds)).second) {
9439 if(ReturnType.
isNull()) {
9441Builder.AddTextChunk(
"void");
9445Builder.AddTypedTextChunk(Allocator.CopyString(SelectorName +
":"));
9447Builder.AddTextChunk(
"NSArray *");
9449Builder.AddTextChunk(
"array");
9451Builder.AddTypedTextChunk(
"atIndexes:");
9453Builder.AddPlaceholderChunk(
"NSIndexSet *");
9455Builder.AddTextChunk(
"indexes");
9456Results.AddResult(
Result(Builder.TakeString(), IndexedSetterPriority,
9462 if(IsInstanceMethod && ReturnTypeMatchesVoid) {
9463std::string SelectorName =
9464(Twine(
"removeObjectFrom") + UpperKey +
"AtIndex").str();
9466 if(KnownSelectors.insert(Selectors.
getUnarySelector(SelectorId)).second) {
9467 if(ReturnType.
isNull()) {
9469Builder.AddTextChunk(
"void");
9473Builder.AddTypedTextChunk(Allocator.CopyString(SelectorName +
":"));
9475Builder.AddTextChunk(
"NSUInteger");
9477Builder.AddTextChunk(
"index");
9478Results.AddResult(
Result(Builder.TakeString(), IndexedSetterPriority,
9484 if(IsInstanceMethod && ReturnTypeMatchesVoid) {
9485std::string SelectorName = (Twine(
"remove") + UpperKey +
"AtIndexes").str();
9487 if(KnownSelectors.insert(Selectors.
getUnarySelector(SelectorId)).second) {
9488 if(ReturnType.
isNull()) {
9490Builder.AddTextChunk(
"void");
9494Builder.AddTypedTextChunk(Allocator.CopyString(SelectorName +
":"));
9496Builder.AddTextChunk(
"NSIndexSet *");
9498Builder.AddTextChunk(
"indexes");
9499Results.AddResult(
Result(Builder.TakeString(), IndexedSetterPriority,
9505 if(IsInstanceMethod && ReturnTypeMatchesVoid) {
9506std::string SelectorName =
9507(Twine(
"replaceObjectIn") + UpperKey +
"AtIndex").str();
9509&Context.
Idents.
get(
"withObject")};
9511 if(KnownSelectors.insert(Selectors.
getSelector(2, SelectorIds)).second) {
9512 if(ReturnType.
isNull()) {
9514Builder.AddTextChunk(
"void");
9518Builder.AddTypedTextChunk(Allocator.CopyString(SelectorName +
":"));
9520Builder.AddPlaceholderChunk(
"NSUInteger");
9522Builder.AddTextChunk(
"index");
9524Builder.AddTypedTextChunk(
"withObject:");
9526Builder.AddTextChunk(
"id");
9528Builder.AddTextChunk(
"object");
9529Results.AddResult(
Result(Builder.TakeString(), IndexedSetterPriority,
9535 if(IsInstanceMethod && ReturnTypeMatchesVoid) {
9536std::string SelectorName1 =
9537(Twine(
"replace") + UpperKey +
"AtIndexes").str();
9538std::string SelectorName2 = (Twine(
"with") + UpperKey).str();
9540&Context.
Idents.
get(SelectorName2)};
9542 if(KnownSelectors.insert(Selectors.
getSelector(2, SelectorIds)).second) {
9543 if(ReturnType.
isNull()) {
9545Builder.AddTextChunk(
"void");
9549Builder.AddTypedTextChunk(Allocator.CopyString(SelectorName1 +
":"));
9551Builder.AddPlaceholderChunk(
"NSIndexSet *");
9553Builder.AddTextChunk(
"indexes");
9555Builder.AddTypedTextChunk(Allocator.CopyString(SelectorName2 +
":"));
9557Builder.AddTextChunk(
"NSArray *");
9559Builder.AddTextChunk(
"array");
9560Results.AddResult(
Result(Builder.TakeString(), IndexedSetterPriority,
9567 if(IsInstanceMethod &&
9568(ReturnType.
isNull() ||
9573->
getName() ==
"NSEnumerator"))) {
9574std::string SelectorName = (Twine(
"enumeratorOf") + UpperKey).str();
9578 if(ReturnType.
isNull()) {
9580Builder.AddTextChunk(
"NSEnumerator *");
9584Builder.AddTypedTextChunk(Allocator.CopyString(SelectorName));
9585Results.AddResult(
Result(Builder.TakeString(), UnorderedGetterPriority,
9591 if(IsInstanceMethod &&
9593std::string SelectorName = (Twine(
"memberOf") + UpperKey).str();
9595 if(KnownSelectors.insert(Selectors.
getUnarySelector(SelectorId)).second) {
9596 if(ReturnType.
isNull()) {
9598Builder.AddPlaceholderChunk(
"object-type");
9599Builder.AddTextChunk(
" *");
9603Builder.AddTypedTextChunk(Allocator.CopyString(SelectorName +
":"));
9605 if(ReturnType.
isNull()) {
9606Builder.AddPlaceholderChunk(
"object-type");
9607Builder.AddTextChunk(
" *");
9610ReturnType, Context, Policy, Builder.getAllocator()));
9613Builder.AddTextChunk(
"object");
9614Results.AddResult(
Result(Builder.TakeString(), UnorderedGetterPriority,
9621 if(IsInstanceMethod && ReturnTypeMatchesVoid) {
9622std::string SelectorName =
9623(Twine(
"add") + UpperKey + Twine(
"Object")).str();
9625 if(KnownSelectors.insert(Selectors.
getUnarySelector(SelectorId)).second) {
9626 if(ReturnType.
isNull()) {
9628Builder.AddTextChunk(
"void");
9632Builder.AddTypedTextChunk(Allocator.CopyString(SelectorName +
":"));
9634Builder.AddPlaceholderChunk(
"object-type");
9635Builder.AddTextChunk(
" *");
9637Builder.AddTextChunk(
"object");
9638Results.AddResult(
Result(Builder.TakeString(), UnorderedSetterPriority,
9644 if(IsInstanceMethod && ReturnTypeMatchesVoid) {
9645std::string SelectorName = (Twine(
"add") + UpperKey).str();
9647 if(KnownSelectors.insert(Selectors.
getUnarySelector(SelectorId)).second) {
9648 if(ReturnType.
isNull()) {
9650Builder.AddTextChunk(
"void");
9654Builder.AddTypedTextChunk(Allocator.CopyString(SelectorName +
":"));
9656Builder.AddTextChunk(
"NSSet *");
9658Builder.AddTextChunk(
"objects");
9659Results.AddResult(
Result(Builder.TakeString(), UnorderedSetterPriority,
9665 if(IsInstanceMethod && ReturnTypeMatchesVoid) {
9666std::string SelectorName =
9667(Twine(
"remove") + UpperKey + Twine(
"Object")).str();
9669 if(KnownSelectors.insert(Selectors.
getUnarySelector(SelectorId)).second) {
9670 if(ReturnType.
isNull()) {
9672Builder.AddTextChunk(
"void");
9676Builder.AddTypedTextChunk(Allocator.CopyString(SelectorName +
":"));
9678Builder.AddPlaceholderChunk(
"object-type");
9679Builder.AddTextChunk(
" *");
9681Builder.AddTextChunk(
"object");
9682Results.AddResult(
Result(Builder.TakeString(), UnorderedSetterPriority,
9688 if(IsInstanceMethod && ReturnTypeMatchesVoid) {
9689std::string SelectorName = (Twine(
"remove") + UpperKey).str();
9691 if(KnownSelectors.insert(Selectors.
getUnarySelector(SelectorId)).second) {
9692 if(ReturnType.
isNull()) {
9694Builder.AddTextChunk(
"void");
9698Builder.AddTypedTextChunk(Allocator.CopyString(SelectorName +
":"));
9700Builder.AddTextChunk(
"NSSet *");
9702Builder.AddTextChunk(
"objects");
9703Results.AddResult(
Result(Builder.TakeString(), UnorderedSetterPriority,
9709 if(IsInstanceMethod && ReturnTypeMatchesVoid) {
9710std::string SelectorName = (Twine(
"intersect") + UpperKey).str();
9712 if(KnownSelectors.insert(Selectors.
getUnarySelector(SelectorId)).second) {
9713 if(ReturnType.
isNull()) {
9715Builder.AddTextChunk(
"void");
9719Builder.AddTypedTextChunk(Allocator.CopyString(SelectorName +
":"));
9721Builder.AddTextChunk(
"NSSet *");
9723Builder.AddTextChunk(
"objects");
9724Results.AddResult(
Result(Builder.TakeString(), UnorderedSetterPriority,
9731 if(!IsInstanceMethod &&
9732(ReturnType.
isNull() ||
9737->
getName() ==
"NSSet"))) {
9738std::string SelectorName =
9739(Twine(
"keyPathsForValuesAffecting") + UpperKey).str();
9743 if(ReturnType.
isNull()) {
9745Builder.AddTextChunk(
"NSSet<NSString *> *");
9749Builder.AddTypedTextChunk(Allocator.CopyString(SelectorName));
9756 if(!IsInstanceMethod &&
9759std::string SelectorName =
9760(Twine(
"automaticallyNotifiesObserversOf") + UpperKey).str();
9764 if(ReturnType.
isNull()) {
9766Builder.AddTextChunk(
"BOOL");
9770Builder.AddTypedTextChunk(Allocator.CopyString(SelectorName));
9778 Scope*S, std::optional<bool> IsInstanceMethod,
ParsedTypeReturnTy) {
9783 Decl*IDecl =
nullptr;
9790 boolIsInImplementation =
false;
9791 if(
Decl*
D= IDecl) {
9793SearchDecl = Impl->getClassInterface();
9794IsInImplementation =
true;
9796dyn_cast<ObjCCategoryImplDecl>(
D)) {
9797SearchDecl = CatImpl->getCategoryDecl();
9798IsInImplementation =
true;
9800SearchDecl = dyn_cast<ObjCContainerDecl>(
D);
9803 if(!SearchDecl && S) {
9805SearchDecl = dyn_cast<ObjCContainerDecl>(DC);
9821ResultBuilder Results(SemaRef, CodeCompleter->getAllocator(),
9822CodeCompleter->getCodeCompletionTUInfo(),
9824Results.EnterNewScope();
9826 for(KnownMethodsMap::iterator M = KnownMethods.begin(),
9827MEnd = KnownMethods.end();
9831Results.getCodeCompletionTUInfo());
9834 if(!IsInstanceMethod) {
9841 if(ReturnType.
isNull()) {
9852Builder.AddTypedTextChunk(
9859 P!= PEnd; (
void)++
P, ++I) {
9862Builder.AddTypedTextChunk(
9863Builder.getAllocator().CopyString(Sel.
getNameForSlot(I) +
":"));
9866Builder.AddTypedTextChunk(
9867Builder.getAllocator().CopyString(Sel.
getNameForSlot(I) +
":"));
9874ParamType = (*P)->getType();
9876ParamType = (*P)->getOriginalType();
9881Context, Policy, Builder);
9884Builder.AddTextChunk(
9885Builder.getAllocator().CopyString(
Id->getName()));
9892Builder.AddTextChunk(
"...");
9895 if(IsInImplementation && Results.includeCodePatterns()) {
9902Builder.AddTextChunk(
"return");
9904Builder.AddPlaceholderChunk(
"expression");
9907Builder.AddPlaceholderChunk(
"statements");
9915 if(!M->second.getInt())
9917Results.AddResult(std::move(R));
9924Containers.push_back(SearchDecl);
9927 for(KnownMethodsMap::iterator M = KnownMethods.begin(),
9928MEnd = KnownMethods.end();
9930KnownSelectors.insert(M->first);
9935IFace =
Category->getClassInterface();
9940 if(IsInstanceMethod) {
9941 for(
unsignedI = 0, N = Containers.size(); I != N; ++I)
9942 for(
auto*
P: Containers[I]->instance_properties())
9944KnownSelectors, Results);
9948Results.ExitScope();
9951Results.getCompletionContext(), Results.data(),
9956 Scope*S,
boolIsInstanceMethod,
boolAtParameterName,
ParsedTypeReturnTy,
9961 for(uint32_t I = 0, N = SemaRef.
ExternalSource->GetNumExternalSelectors();
9973ResultBuilder Results(SemaRef, CodeCompleter->getAllocator(),
9974CodeCompleter->getCodeCompletionTUInfo(),
9978Results.setPreferredType(
9981Results.EnterNewScope();
9982 for(SemaObjC::GlobalMethodPool::iterator
9986 for(
ObjCMethodList*MethList = IsInstanceMethod ? &M->second.first
9987: &M->second.second;
9988MethList && MethList->getMethod(); MethList = MethList->getNext()) {
9992 if(AtParameterName) {
9994 unsignedNumSelIdents = SelIdents.size();
9996NumSelIdents <= MethList->getMethod()->param_size()) {
9998MethList->getMethod()->parameters()[NumSelIdents - 1];
10001Results.getCodeCompletionTUInfo());
10002Builder.AddTypedTextChunk(Builder.getAllocator().CopyString(
10004Results.AddResult(Builder.TakeString());
10011 ResultR(MethList->getMethod(),
10012Results.getBasePriority(MethList->getMethod()),
nullptr);
10013R.StartParameter = SelIdents.size();
10014R.AllParametersAreInformative =
false;
10015R.DeclaringEntity =
true;
10016Results.MaybeAddResult(R, SemaRef.
CurContext);
10020Results.ExitScope();
10022 if(!AtParameterName && !SelIdents.empty() &&
10023SelIdents.front()->getName().starts_with(
"init")) {
10024 for(
const auto&M : SemaRef.
PP.
macros()) {
10025 if(M.first->getName() !=
"NS_DESIGNATED_INITIALIZER")
10027Results.EnterNewScope();
10029Results.getCodeCompletionTUInfo());
10030Builder.AddTypedTextChunk(
10031Builder.getAllocator().CopyString(M.first->getName()));
10034Results.ExitScope();
10039Results.getCompletionContext(), Results.data(),
10044ResultBuilder Results(SemaRef, CodeCompleter->getAllocator(),
10045CodeCompleter->getCodeCompletionTUInfo(),
10047Results.EnterNewScope();
10051Results.getCodeCompletionTUInfo());
10052Builder.AddTypedTextChunk(
"if");
10054Builder.AddPlaceholderChunk(
"condition");
10055Results.AddResult(Builder.TakeString());
10058Builder.AddTypedTextChunk(
"ifdef");
10060Builder.AddPlaceholderChunk(
"macro");
10061Results.AddResult(Builder.TakeString());
10064Builder.AddTypedTextChunk(
"ifndef");
10066Builder.AddPlaceholderChunk(
"macro");
10067Results.AddResult(Builder.TakeString());
10069 if(InConditional) {
10071Builder.AddTypedTextChunk(
"elif");
10073Builder.AddPlaceholderChunk(
"condition");
10074Results.AddResult(Builder.TakeString());
10077Builder.AddTypedTextChunk(
"elifdef");
10079Builder.AddPlaceholderChunk(
"macro");
10080Results.AddResult(Builder.TakeString());
10083Builder.AddTypedTextChunk(
"elifndef");
10085Builder.AddPlaceholderChunk(
"macro");
10086Results.AddResult(Builder.TakeString());
10089Builder.AddTypedTextChunk(
"else");
10090Results.AddResult(Builder.TakeString());
10093Builder.AddTypedTextChunk(
"endif");
10094Results.AddResult(Builder.TakeString());
10098Builder.AddTypedTextChunk(
"include");
10100Builder.AddTextChunk(
"\"");
10101Builder.AddPlaceholderChunk(
"header");
10102Builder.AddTextChunk(
"\"");
10103Results.AddResult(Builder.TakeString());
10106Builder.AddTypedTextChunk(
"include");
10108Builder.AddTextChunk(
"<");
10109Builder.AddPlaceholderChunk(
"header");
10110Builder.AddTextChunk(
">");
10111Results.AddResult(Builder.TakeString());
10114Builder.AddTypedTextChunk(
"define");
10116Builder.AddPlaceholderChunk(
"macro");
10117Results.AddResult(Builder.TakeString());
10120Builder.AddTypedTextChunk(
"define");
10122Builder.AddPlaceholderChunk(
"macro");
10124Builder.AddPlaceholderChunk(
"args");
10126Results.AddResult(Builder.TakeString());
10129Builder.AddTypedTextChunk(
"undef");
10131Builder.AddPlaceholderChunk(
"macro");
10132Results.AddResult(Builder.TakeString());
10135Builder.AddTypedTextChunk(
"line");
10137Builder.AddPlaceholderChunk(
"number");
10138Results.AddResult(Builder.TakeString());
10141Builder.AddTypedTextChunk(
"line");
10143Builder.AddPlaceholderChunk(
"number");
10145Builder.AddTextChunk(
"\"");
10146Builder.AddPlaceholderChunk(
"filename");
10147Builder.AddTextChunk(
"\"");
10148Results.AddResult(Builder.TakeString());
10151Builder.AddTypedTextChunk(
"error");
10153Builder.AddPlaceholderChunk(
"message");
10154Results.AddResult(Builder.TakeString());
10157Builder.AddTypedTextChunk(
"pragma");
10159Builder.AddPlaceholderChunk(
"arguments");
10160Results.AddResult(Builder.TakeString());
10162 if(getLangOpts().
ObjC) {
10164Builder.AddTypedTextChunk(
"import");
10166Builder.AddTextChunk(
"\"");
10167Builder.AddPlaceholderChunk(
"header");
10168Builder.AddTextChunk(
"\"");
10169Results.AddResult(Builder.TakeString());
10172Builder.AddTypedTextChunk(
"import");
10174Builder.AddTextChunk(
"<");
10175Builder.AddPlaceholderChunk(
"header");
10176Builder.AddTextChunk(
">");
10177Results.AddResult(Builder.TakeString());
10181Builder.AddTypedTextChunk(
"include_next");
10183Builder.AddTextChunk(
"\"");
10184Builder.AddPlaceholderChunk(
"header");
10185Builder.AddTextChunk(
"\"");
10186Results.AddResult(Builder.TakeString());
10189Builder.AddTypedTextChunk(
"include_next");
10191Builder.AddTextChunk(
"<");
10192Builder.AddPlaceholderChunk(
"header");
10193Builder.AddTextChunk(
">");
10194Results.AddResult(Builder.TakeString());
10197Builder.AddTypedTextChunk(
"warning");
10199Builder.AddPlaceholderChunk(
"message");
10200Results.AddResult(Builder.TakeString());
10207Results.ExitScope();
10210Results.getCompletionContext(), Results.data(),
10216CodeCompleteOrdinaryName(S, S->getFnParent()
10222ResultBuilder Results(SemaRef, CodeCompleter->getAllocator(),
10223CodeCompleter->getCodeCompletionTUInfo(),
10226 if(!IsDefinition && CodeCompleter->includeMacros()) {
10229Results.getCodeCompletionTUInfo());
10230Results.EnterNewScope();
10234Builder.AddTypedTextChunk(
10235Builder.getAllocator().CopyString(M->first->getName()));
10239Results.ExitScope();
10240}
else if(IsDefinition) {
10245Results.getCompletionContext(), Results.data(),
10250ResultBuilder Results(SemaRef, CodeCompleter->getAllocator(),
10251CodeCompleter->getCodeCompletionTUInfo(),
10254 if(CodeCompleter->includeMacros())
10258Results.EnterNewScope();
10260Results.getCodeCompletionTUInfo());
10261Builder.AddTypedTextChunk(
"defined");
10264Builder.AddPlaceholderChunk(
"macro");
10266Results.AddResult(Builder.TakeString());
10267Results.ExitScope();
10270Results.getCompletionContext(), Results.data(),
10290std::string RelDir = llvm::sys::path::convert_to_slash(Dir);
10293llvm::sys::path::native(NativeRelDir);
10294llvm::vfs::FileSystem &FS =
10297ResultBuilder Results(SemaRef, CodeCompleter->getAllocator(),
10298CodeCompleter->getCodeCompletionTUInfo(),
10300llvm::DenseSet<StringRef> SeenResults;
10303 autoAddCompletion = [&](StringRef
Filename,
boolIsDirectory) {
10306TypedChunk.push_back(IsDirectory ?
'/': Angled ?
'>':
'"');
10307 autoR = SeenResults.insert(TypedChunk);
10309 const char*InternedTyped = Results.getAllocator().CopyString(TypedChunk);
10310*R.first = InternedTyped;
10312CodeCompleter->getCodeCompletionTUInfo());
10313Builder.AddTypedTextChunk(InternedTyped);
10321 autoAddFilesFromIncludeDir = [&](StringRef IncludeDir,
10325 if(!NativeRelDir.empty()) {
10329 auto Begin= llvm::sys::path::begin(NativeRelDir);
10330 autoEnd = llvm::sys::path::end(NativeRelDir);
10332llvm::sys::path::append(Dir, *
Begin+
".framework",
"Headers");
10333llvm::sys::path::append(Dir, ++
Begin, End);
10335llvm::sys::path::append(Dir, NativeRelDir);
10339 constStringRef &Dirname = llvm::sys::path::filename(Dir);
10340 const boolisQt = Dirname.starts_with(
"Qt") || Dirname ==
"ActiveQt";
10341 const boolExtensionlessHeaders =
10342IsSystem || isQt || Dir.ends_with(
".framework/Headers");
10343std::error_code EC;
10344 unsignedCount = 0;
10345 for(
autoIt = FS.dir_begin(Dir, EC);
10346!EC && It != llvm::vfs::directory_iterator(); It.increment(EC)) {
10347 if(++Count == 2500)
10349StringRef
Filename= llvm::sys::path::filename(It->path());
10354llvm::sys::fs::file_type
Type= It->type();
10355 if(
Type== llvm::sys::fs::file_type::symlink_file) {
10356 if(
autoFileStatus = FS.status(It->path()))
10357 Type= FileStatus->getType();
10360 casellvm::sys::fs::file_type::directory_file:
10364NativeRelDir.empty() && !
Filename.consume_back(
".framework"))
10369 casellvm::sys::fs::file_type::regular_file: {
10371 const boolIsHeader =
Filename.ends_with_insensitive(
".h") ||
10372 Filename.ends_with_insensitive(
".hh") ||
10373 Filename.ends_with_insensitive(
".hpp") ||
10374 Filename.ends_with_insensitive(
".hxx") ||
10375 Filename.ends_with_insensitive(
".inc") ||
10376(ExtensionlessHeaders && !
Filename.contains(
'.'));
10379AddCompletion(
Filename,
false);
10391 switch(IncludeDir.getLookupType()) {
10396AddFilesFromIncludeDir(IncludeDir.getDirRef()->getName(), IsSystem,
10400AddFilesFromIncludeDir(IncludeDir.getFrameworkDirRef()->getName(),
10410 usingllvm::make_range;
10414AddFilesFromIncludeDir(CurFile->getDir().getName(),
false,
10416 for(
const auto&
D: make_range(S.quoted_dir_begin(), S.quoted_dir_end()))
10417AddFilesFromDirLookup(
D,
false);
10419 for(
const auto&
D: make_range(S.angled_dir_begin(), S.angled_dir_end()))
10420AddFilesFromDirLookup(
D,
false);
10421 for(
const auto&
D: make_range(S.system_dir_begin(), S.system_dir_end()))
10422AddFilesFromDirLookup(
D,
true);
10425Results.getCompletionContext(), Results.data(),
10436ResultBuilder Results(SemaRef, CodeCompleter->getAllocator(),
10437CodeCompleter->getCodeCompletionTUInfo(),
10439Results.EnterNewScope();
10440 static const char*Platforms[] = {
"macOS",
"iOS",
"watchOS",
"tvOS"};
10444Twine(Platform) +
"ApplicationExtension")));
10446Results.ExitScope();
10448Results.getCompletionContext(), Results.data(),
10455ResultBuilder Builder(SemaRef, Allocator, CCTUInfo,
10457 if(!CodeCompleter || CodeCompleter->includeGlobals()) {
10458CodeCompletionDeclConsumer Consumer(
10459Builder, getASTContext().getTranslationUnitDecl());
10462!CodeCompleter || CodeCompleter->loadExternal());
10465 if(!CodeCompleter || CodeCompleter->includeMacros())
10467!CodeCompleter || CodeCompleter->loadExternal(),
true);
10470Results.insert(Results.end(), Builder.data(),
10471Builder.data() + Builder.size());
10476:
SemaBase(S), CodeCompleter(CompletionConsumer),
10477Resolver(S.getASTContext()) {}
This file provides AST data structures related to concepts.
llvm::DenseMap< const Stmt *, CFGBlock * > SMap
enum clang::sema::@1704::IndirectLocalPathEntry::EntryKind Kind
static Decl::Kind getKind(const Decl *D)
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate....
Defines the C++ template declaration subclasses.
Defines the clang::Expr interface and subclasses for C++ expressions.
Defines Expressions and AST nodes for C++2a concepts.
llvm::MachO::Target Target
llvm::MachO::Record Record
Defines the clang::MacroInfo and clang::MacroDirective classes.
Defines an enumeration for C++ overloaded operators.
Defines the clang::Preprocessor interface.
static std::string getName(const CallEvent &Call)
static AccessResult IsAccessible(Sema &S, const EffectiveContext &EC, AccessTarget &Entity)
Determines whether the accessed entity is accessible.
static QualType getPreferredArgumentTypeForMessageSend(ResultBuilder &Results, unsigned NumSelIdents)
Given a set of code-completion results for the argument of a message send, determine the preferred ty...
static void printOverrideString(const CodeCompletionString &CCS, std::string &BeforeName, std::string &NameAndSignature)
static bool isConstructor(const Decl *ND)
static void findTypeLocationForBlockDecl(const TypeSourceInfo *TSInfo, FunctionTypeLoc &Block, FunctionProtoTypeLoc &BlockProto, bool SuppressBlock=false)
Tries to find the most appropriate type location for an Objective-C block placeholder.
static void AddQualifierToCompletionString(CodeCompletionBuilder &Result, NestedNameSpecifier *Qualifier, bool QualifierIsInformative, ASTContext &Context, const PrintingPolicy &Policy)
Add a qualifier to the given code-completion string, if the provided nested-name-specifier is non-NUL...
static bool isObjCReceiverType(ASTContext &C, QualType T)
static void AddMacroResults(Preprocessor &PP, ResultBuilder &Results, bool LoadExternal, bool IncludeUndefined, bool TargetTypeIsPointer=false)
static std::string formatTemplateParameterPlaceholder(const NamedDecl *Param, bool &Optional, const PrintingPolicy &Policy)
static std::string formatBlockPlaceholder(const PrintingPolicy &Policy, const NamedDecl *BlockDecl, FunctionTypeLoc &Block, FunctionProtoTypeLoc &BlockProto, bool SuppressBlockName=false, bool SuppressBlock=false, std::optional< ArrayRef< QualType > > ObjCSubsts=std::nullopt)
Returns a placeholder string that corresponds to an Objective-C block declaration.
static void AddTemplateParameterChunks(ASTContext &Context, const PrintingPolicy &Policy, const TemplateDecl *Template, CodeCompletionBuilder &Result, unsigned MaxParameters=0, unsigned Start=0, bool InDefaultArg=false)
Add template parameter chunks to the given code completion string.
static void AddObjCTopLevelResults(ResultBuilder &Results, bool NeedAt)
static FunctionProtoTypeLoc GetPrototypeLoc(Expr *Fn)
static void AddFunctionParameterChunks(Preprocessor &PP, const PrintingPolicy &Policy, const FunctionDecl *Function, CodeCompletionBuilder &Result, unsigned Start=0, bool InOptional=false)
Add function parameter chunks to the given code completion string.
llvm::SmallPtrSet< const IdentifierInfo *, 16 > AddedPropertiesSet
The set of properties that have already been added, referenced by property name.
static bool argMatchesTemplateParams(const ParsedTemplateArgument &Arg, unsigned Index, const TemplateParameterList &Params)
static void setInBaseClass(ResultBuilder::Result &R)
static void AddObjCMethods(ObjCContainerDecl *Container, bool WantInstanceMethods, ObjCMethodKind WantKind, ArrayRef< const IdentifierInfo * > SelIdents, DeclContext *CurContext, VisitedSelectorSet &Selectors, bool AllowSameLength, ResultBuilder &Results, bool InOriginalClass=true, bool IsRootClass=false)
Add all of the Objective-C methods in the given Objective-C container to the set of results.
static bool shouldIgnoreDueToReservedName(const NamedDecl *ND, Sema &SemaRef)
static RecordDecl * getAsRecordDecl(QualType BaseType)
static CodeCompletionString * createTemplateSignatureString(const TemplateDecl *TD, CodeCompletionBuilder &Builder, unsigned CurrentArg, const PrintingPolicy &Policy)
static QualType getParamType(Sema &SemaRef, ArrayRef< ResultCandidate > Candidates, unsigned N)
Get the type of the Nth parameter from a given set of overload candidates.
static void AddStorageSpecifiers(SemaCodeCompletion::ParserCompletionContext CCC, const LangOptions &LangOpts, ResultBuilder &Results)
static const NamedDecl * extractFunctorCallOperator(const NamedDecl *ND)
static void AddFunctionSpecifiers(SemaCodeCompletion::ParserCompletionContext CCC, const LangOptions &LangOpts, ResultBuilder &Results)
static QualType ProduceSignatureHelp(Sema &SemaRef, MutableArrayRef< ResultCandidate > Candidates, unsigned CurrentArg, SourceLocation OpenParLoc, bool Braced)
static std::string FormatFunctionParameter(const PrintingPolicy &Policy, const DeclaratorDecl *Param, bool SuppressName=false, bool SuppressBlock=false, std::optional< ArrayRef< QualType > > ObjCSubsts=std::nullopt)
static void AddOverrideResults(ResultBuilder &Results, const CodeCompletionContext &CCContext, CodeCompletionBuilder &Builder)
static std::string formatObjCParamQualifiers(unsigned ObjCQuals, QualType &Type)
llvm::SmallPtrSet< Selector, 16 > VisitedSelectorSet
A set of selectors, which is used to avoid introducing multiple completions with the same selector in...
static void AddOverloadAggregateChunks(const RecordDecl *RD, const PrintingPolicy &Policy, CodeCompletionBuilder &Result, unsigned CurrentArg)
static void AddTypedefResult(ResultBuilder &Results)
static void AddPrettyFunctionResults(const LangOptions &LangOpts, ResultBuilder &Results)
static QualType getDesignatedType(QualType BaseType, const Designation &Desig)
static void AddObjCPassingTypeChunk(QualType Type, unsigned ObjCDeclQuals, ASTContext &Context, const PrintingPolicy &Policy, CodeCompletionBuilder &Builder)
Add the parenthesized return or parameter type chunk to a code completion string.
static void AddObjCKeyValueCompletions(ObjCPropertyDecl *Property, bool IsInstanceMethod, QualType ReturnType, ASTContext &Context, VisitedSelectorSet &KnownSelectors, ResultBuilder &Results)
Add code completions for Objective-C Key-Value Coding (KVC) and Key-Value Observing (KVO).
static void AddObjCStatementResults(ResultBuilder &Results, bool NeedAt)
static bool ObjCPropertyFlagConflicts(unsigned Attributes, unsigned NewFlag)
Determine whether the addition of the given flag to an Objective-C property's attributes will cause a...
static void AddEnumerators(ResultBuilder &Results, ASTContext &Context, EnumDecl *Enum, DeclContext *CurContext, const CoveredEnumerators &Enumerators)
llvm::DenseMap< Selector, llvm::PointerIntPair< ObjCMethodDecl *, 1, bool > > KnownMethodsMap
static const FunctionProtoType * TryDeconstructFunctionLike(QualType T)
Try to find a corresponding FunctionProtoType for function-like types (e.g.
static DeclContext::lookup_result getConstructors(ASTContext &Context, const CXXRecordDecl *Record)
static void AddResultTypeChunk(ASTContext &Context, const PrintingPolicy &Policy, const NamedDecl *ND, QualType BaseType, CodeCompletionBuilder &Result)
If the given declaration has an associated type, add it as a result type chunk.
static void AddObjCVisibilityResults(const LangOptions &LangOpts, ResultBuilder &Results, bool NeedAt)
static void addThisCompletion(Sema &S, ResultBuilder &Results)
Add a completion for "this", if we're in a member function.
static void AddObjCImplementationResults(const LangOptions &LangOpts, ResultBuilder &Results, bool NeedAt)
static ObjCMethodDecl * AddSuperSendCompletion(Sema &S, bool NeedSuperKeyword, ArrayRef< const IdentifierInfo * > SelIdents, ResultBuilder &Results)
static void AddRecordMembersCompletionResults(Sema &SemaRef, ResultBuilder &Results, Scope *S, QualType BaseType, ExprValueKind BaseKind, RecordDecl *RD, std::optional< FixItHint > AccessOpFixIt)
static void AddObjCBlockCall(ASTContext &Context, const PrintingPolicy &Policy, CodeCompletionBuilder &Builder, const NamedDecl *BD, const FunctionTypeLoc &BlockLoc, const FunctionProtoTypeLoc &BlockProtoLoc)
Adds a block invocation code completion result for the given block declaration BD.
static void AddLambdaCompletion(ResultBuilder &Results, llvm::ArrayRef< QualType > Parameters, const LangOptions &LangOpts)
Adds a pattern completion for a lambda expression with the specified parameter types and placeholders...
static void AddTypeSpecifierResults(const LangOptions &LangOpts, ResultBuilder &Results)
Add type specifiers for the current language as keyword results.
static std::optional< unsigned > getNextAggregateIndexAfterDesignatedInit(const ResultCandidate &Aggregate, ArrayRef< Expr * > Args)
static std::string GetDefaultValueString(const ParmVarDecl *Param, const SourceManager &SM, const LangOptions &LangOpts)
static CodeCompletionContext mapCodeCompletionContext(Sema &S, SemaCodeCompletion::ParserCompletionContext PCC)
static void AddInterfaceResults(DeclContext *Ctx, DeclContext *CurContext, bool OnlyForwardDeclarations, bool OnlyUnimplemented, ResultBuilder &Results)
Add all of the Objective-C interface declarations that we find in the given (translation unit) contex...
static NestedNameSpecifier * getRequiredQualification(ASTContext &Context, const DeclContext *CurContext, const DeclContext *TargetContext)
Compute the qualification required to get from the current context (CurContext) to the target context...
static OverloadCompare compareOverloads(const CXXMethodDecl &Candidate, const CXXMethodDecl &Incumbent, const Qualifiers &ObjectQuals, ExprValueKind ObjectKind, const ASTContext &Ctx)
static void FindImplementableMethods(ASTContext &Context, ObjCContainerDecl *Container, std::optional< bool > WantInstanceMethods, QualType ReturnType, KnownMethodsMap &KnownMethods, bool InOriginalClass=true)
Find all of the methods that reside in the given container (and its superclasses, protocols,...
static bool anyNullArguments(ArrayRef< Expr * > Args)
static const char * noUnderscoreAttrScope(llvm::StringRef Scope)
static void AddFunctionTypeQualsToCompletionString(CodeCompletionBuilder &Result, const FunctionDecl *Function)
static void MaybeAddSentinel(Preprocessor &PP, const NamedDecl *FunctionOrMethod, CodeCompletionBuilder &Result)
static void AddOverloadParameterChunks(ASTContext &Context, const PrintingPolicy &Policy, const FunctionDecl *Function, const FunctionProtoType *Prototype, FunctionProtoTypeLoc PrototypeLoc, CodeCompletionBuilder &Result, unsigned CurrentArg, unsigned Start=0, bool InOptional=false)
Add function overload parameter chunks to the given code completion string.
static void AddObjCProperties(const CodeCompletionContext &CCContext, ObjCContainerDecl *Container, bool AllowCategories, bool AllowNullaryMethods, DeclContext *CurContext, AddedPropertiesSet &AddedProperties, ResultBuilder &Results, bool IsBaseExprStatement=false, bool IsClassProperty=false, bool InOriginalClass=true)
static void HandleCodeCompleteResults(Sema *S, CodeCompleteConsumer *CodeCompleter, const CodeCompletionContext &Context, CodeCompletionResult *Results, unsigned NumResults)
static void AddTypeQualifierResults(DeclSpec &DS, ResultBuilder &Results, const LangOptions &LangOpts)
static void MaybeAddOverrideCalls(Sema &S, DeclContext *InContext, ResultBuilder &Results)
If we're in a C++ virtual member function, add completion results that invoke the functions we overri...
static ObjCContainerDecl * getContainerDef(ObjCContainerDecl *Container)
Retrieve the container definition, if any?
static const char * underscoreAttrScope(llvm::StringRef Scope)
static bool isAcceptableObjCMethod(ObjCMethodDecl *Method, ObjCMethodKind WantKind, ArrayRef< const IdentifierInfo * > SelIdents, bool AllowSameLength=true)
static void AddObjCExpressionResults(ResultBuilder &Results, bool NeedAt)
static bool WantTypesInContext(SemaCodeCompletion::ParserCompletionContext CCC, const LangOptions &LangOpts)
CodeCompleteConsumer::OverloadCandidate ResultCandidate
static std::string templateResultType(const TemplateDecl *TD, const PrintingPolicy &Policy)
static void AddTypedNameChunk(ASTContext &Context, const PrintingPolicy &Policy, const NamedDecl *ND, CodeCompletionBuilder &Result)
Add the name of the given declaration.
static void AddClassMessageCompletions(Sema &SemaRef, Scope *S, ParsedType Receiver, ArrayRef< const IdentifierInfo * > SelIdents, bool AtArgumentExpression, bool IsSuper, ResultBuilder &Results)
static const char * GetCompletionTypeString(QualType T, ASTContext &Context, const PrintingPolicy &Policy, CodeCompletionAllocator &Allocator)
Retrieve the string representation of the given type as a string that has the appropriate lifetime fo...
static bool InheritsFromClassNamed(ObjCInterfaceDecl *Class, StringRef Name)
Determine whether the given class is or inherits from a class by the given name.
#define OBJC_AT_KEYWORD_NAME(NeedAt, Keyword)
Macro that optionally prepends an "@" to the string literal passed in via Keyword,...
static bool isAcceptableObjCSelector(Selector Sel, ObjCMethodKind WantKind, ArrayRef< const IdentifierInfo * > SelIdents, bool AllowSameLength=true)
static QualType getPreferredTypeOfBinaryRHS(Sema &S, Expr *LHS, tok::TokenKind Op)
static void AddOrdinaryNameResults(SemaCodeCompletion::ParserCompletionContext CCC, Scope *S, Sema &SemaRef, ResultBuilder &Results)
Add language constructs that show up for "ordinary" names.
static QualType getPreferredTypeOfUnaryArg(Sema &S, QualType ContextType, tok::TokenKind Op)
Get preferred type for an argument of an unary expression.
static void AddUsingAliasResult(CodeCompletionBuilder &Builder, ResultBuilder &Results)
static ObjCInterfaceDecl * GetAssumedMessageSendExprType(Expr *E)
When we have an expression with type "id", we may assume that it has some more-specific class type ba...
ObjCMethodKind
Describes the kind of Objective-C method that we want to find via code completion.
@ MK_OneArgSelector
One-argument selector.
@ MK_ZeroArgSelector
Zero-argument (unary) selector.
@ MK_Any
Any kind of method, provided it means other specified criteria.
static void mergeCandidatesWithResults(Sema &SemaRef, SmallVectorImpl< ResultCandidate > &Results, OverloadCandidateSet &CandidateSet, SourceLocation Loc, size_t ArgSize)
static void AddProtocolResults(DeclContext *Ctx, DeclContext *CurContext, bool OnlyForwardDeclarations, ResultBuilder &Results)
Add all of the protocol declarations that we find in the given (translation unit) context.
static void AddStaticAssertResult(CodeCompletionBuilder &Builder, ResultBuilder &Results, const LangOptions &LangOpts)
static void AddObjCInterfaceResults(const LangOptions &LangOpts, ResultBuilder &Results, bool NeedAt)
static bool isNamespaceScope(Scope *S)
Determine whether this scope denotes a namespace.
static PrintingPolicy getCompletionPrintingPolicy(const ASTContext &Context, const Preprocessor &PP)
This file declares facilities that support code completion.
This file declares semantic analysis for Objective-C.
static TemplateDecl * getDescribedTemplate(Decl *Templated)
Defines various enumerations that describe declaration and type specifiers.
enum clang::format::@1315::AnnotatingParser::Context::@350 ContextType
C Language Family Type Representation.
pointer(const DeclIndexPair &Value)
const DeclIndexPair * operator->() const
pointer operator->() const
reference operator*() const
std::ptrdiff_t difference_type
friend bool operator!=(const iterator &X, const iterator &Y)
iterator(const NamedDecl *SingleDecl, unsigned Index)
std::input_iterator_tag iterator_category
iterator(const DeclIndexPair *Iterator)
friend bool operator==(const iterator &X, const iterator &Y)
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
SourceManager & getSourceManager()
TranslationUnitDecl * getTranslationUnitDecl() const
QualType getObjCInterfaceType(const ObjCInterfaceDecl *Decl, ObjCInterfaceDecl *PrevDecl=nullptr) const
getObjCInterfaceType - Return the unique reference to the type for the specified ObjC interface decl.
DeclarationNameTable DeclarationNames
CanQualType getCanonicalType(QualType T) const
Return the canonical (structural) type corresponding to the specified potentially non-canonical type ...
bool hasSameType(QualType T1, QualType T2) const
Determine whether the given types T1 and T2 are equivalent.
QualType getPointerType(QualType T) const
Return the uniqued reference to the type for a pointer to the specified type.
QualType getTypeDeclType(const TypeDecl *Decl, const TypeDecl *PrevDecl=nullptr) const
Return the unique reference to the type for the specified type declaration.
const LangOptions & getLangOpts() const
SelectorTable & Selectors
QualType getBaseElementType(const ArrayType *VAT) const
Return the innermost element type of an array type.
QualType getPointerDiffType() const
Return the unique type for "ptrdiff_t" (C99 7.17) defined in <stddef.h>.
QualType getObjCObjectPointerType(QualType OIT) const
Return a ObjCObjectPointerType type for the given ObjCObjectType.
const RawComment * getRawCommentForAnyRedecl(const Decl *D, const Decl **OriginalDecl=nullptr) const
Return the documentation comment attached to a given declaration.
QualType getObjCIdType() const
Represents the Objective-CC id type.
bool hasSameUnqualifiedType(QualType T1, QualType T2) const
Determine whether the given types are equivalent after cvr-qualifiers have been removed.
QualType getElementType() const
Syntax
The style used to specify an attribute.
@ AS_GNU
attribute((...))
Type source information for an attributed type.
static std::optional< NullabilityKind > stripOuterNullability(QualType &T)
Strip off the top-level nullability annotation on the given type, if it's there.
Represents a C++11 auto or C++14 decltype(auto) type, possibly constrained by a type-constraint.
Represents a block literal declaration, which is like an unnamed FunctionDecl.
Wrapper for source info for block pointers.
This class is used for builtin types like 'int'.
Represents a base class of a C++ class.
Represents a C++ constructor within a class.
Represents a C++ member access expression where the actual member referenced could not be resolved be...
Represents a static or instance method of a struct/union/class.
overridden_method_range overridden_methods() const
RefQualifierKind getRefQualifier() const
Retrieve the ref-qualifier associated with this method.
const CXXRecordDecl * getParent() const
Return the parent of this method declaration, which is the class in which this method is defined.
Qualifiers getMethodQualifiers() const
CXXMethodDecl * getCanonicalDecl() override
Retrieves the "canonical" declaration of the given declaration.
Represents a C++ struct/union/class.
bool isAggregate() const
Determine whether this class is an aggregate (C++ [dcl.init.aggr]), which is a class with no user-dec...
CXXRecordDecl * getDefinition() const
base_class_range vbases()
CXXRecordDecl * getCanonicalDecl() override
Retrieves the "canonical" declaration of the given declaration.
bool isDerivedFrom(const CXXRecordDecl *Base) const
Determine whether this class is derived from the class Base.
Represents a C++ nested-name-specifier or a global scope specifier.
bool isValid() const
A scope specifier is present, and it refers to a real scope.
NestedNameSpecifier * getScopeRep() const
Retrieve the representation of the nested-name-specifier.
bool isInvalid() const
An error occurred during parsing of the scope specifier.
bool isEmpty() const
No scope specifier.
CallExpr - Represents a function call (C99 6.5.2.2, C++ [expr.call]).
CaseStmt - Represent a case statement.
Represents a character-granular source range.
static CharSourceRange getTokenRange(SourceRange R)
Declaration of a class template.
CodeCompletionString * CreateSignatureString(unsigned CurrentArg, Sema &S, CodeCompletionAllocator &Allocator, CodeCompletionTUInfo &CCTUInfo, bool IncludeBriefComments, bool Braced) const
Create a new code-completion string that describes the function signature of this overload candidate.
const FunctionType * getFunctionType() const
Retrieve the function type of the entity, regardless of how the function is stored.
const TemplateDecl * getTemplate() const
CandidateKind getKind() const
Determine the kind of overload candidate.
const RecordDecl * getAggregate() const
Retrieve the aggregate type being initialized.
FunctionDecl * getFunction() const
Retrieve the function overload candidate or the templated function declaration for a function templat...
const FunctionProtoTypeLoc getFunctionProtoTypeLoc() const
Retrieve the function ProtoTypeLoc candidate.
@ CK_Aggregate
The candidate is aggregate initialization of a record type.
@ CK_Template
The candidate is a template, template arguments are being completed.
unsigned getNumParams() const
Get the number of parameters in this signature.
Abstract interface for a consumer of code-completion information.
bool includeGlobals() const
Whether to include global (top-level) declaration results.
virtual void ProcessCodeCompleteResults(Sema &S, CodeCompletionContext Context, CodeCompletionResult *Results, unsigned NumResults)
Process the finalized code-completion results.
bool includeCodePatterns() const
Whether the code-completion consumer wants to see code patterns.
bool loadExternal() const
Hint whether to load data from the external AST in order to provide full results.
virtual void ProcessOverloadCandidates(Sema &S, unsigned CurrentArg, OverloadCandidate *Candidates, unsigned NumCandidates, SourceLocation OpenParLoc, bool Braced)
An allocator used specifically for the purpose of code completion.
const char * CopyString(const Twine &String)
Copy the given string into this allocator.
A builder class used to construct new code-completion strings.
CodeCompletionString * TakeString()
Take the resulting completion string.
void AddPlaceholderChunk(const char *Placeholder)
Add a new placeholder chunk.
void AddTextChunk(const char *Text)
Add a new text chunk.
void AddCurrentParameterChunk(const char *CurrentParameter)
Add a new current-parameter chunk.
void AddTypedTextChunk(const char *Text)
Add a new typed-text chunk.
void AddChunk(CodeCompletionString::ChunkKind CK, const char *Text="")
Add a new chunk.
CodeCompletionAllocator & getAllocator() const
Retrieve the allocator into which the code completion strings should be allocated.
The context in which code completion occurred, so that the code-completion consumer can process the r...
Kind getKind() const
Retrieve the kind of code-completion context.
void setCXXScopeSpecifier(CXXScopeSpec SS)
Sets the scope specifier that comes before the completion token.
@ CCC_TypeQualifiers
Code completion within a type-qualifier list.
@ CCC_ObjCMessageReceiver
Code completion occurred where an Objective-C message receiver is expected.
@ CCC_PreprocessorExpression
Code completion occurred within a preprocessor expression.
@ CCC_ObjCCategoryName
Code completion where an Objective-C category name is expected.
@ CCC_ObjCIvarList
Code completion occurred within the instance variable list of an Objective-C interface,...
@ CCC_Statement
Code completion occurred where a statement (or declaration) is expected in a function,...
@ CCC_Type
Code completion occurred where a type name is expected.
@ CCC_ArrowMemberAccess
Code completion occurred on the right-hand side of a member access expression using the arrow operato...
@ CCC_ClassStructUnion
Code completion occurred within a class, struct, or union.
@ CCC_ObjCInterface
Code completion occurred within an Objective-C interface, protocol, or category interface.
@ CCC_ObjCPropertyAccess
Code completion occurred on the right-hand side of an Objective-C property access expression.
@ CCC_Expression
Code completion occurred where an expression is expected.
@ CCC_SelectorName
Code completion for a selector, as in an @selector expression.
@ CCC_TopLevelOrExpression
Code completion at a top level, i.e.
@ CCC_EnumTag
Code completion occurred after the "enum" keyword, to indicate an enumeration name.
@ CCC_UnionTag
Code completion occurred after the "union" keyword, to indicate a union name.
@ CCC_ParenthesizedExpression
Code completion in a parenthesized expression, which means that we may also have types here in C and ...
@ CCC_TopLevel
Code completion occurred within a "top-level" completion context, e.g., at namespace or global scope.
@ CCC_ClassOrStructTag
Code completion occurred after the "struct" or "class" keyword, to indicate a struct or class name.
@ CCC_ObjCClassMessage
Code completion where an Objective-C class message is expected.
@ CCC_ObjCImplementation
Code completion occurred within an Objective-C implementation or category implementation.
@ CCC_IncludedFile
Code completion inside the filename part of a #include directive.
@ CCC_ObjCInstanceMessage
Code completion where an Objective-C instance message is expected.
@ CCC_SymbolOrNewName
Code completion occurred where both a new name and an existing symbol is permissible.
@ CCC_Recovery
An unknown context, in which we are recovering from a parsing error and don't know which completions ...
@ CCC_ObjCProtocolName
Code completion occurred where a protocol name is expected.
@ CCC_NewName
Code completion occurred where a new name is expected.
@ CCC_MacroNameUse
Code completion occurred where a macro name is expected (without any arguments, in the case of a func...
@ CCC_Symbol
Code completion occurred where an existing name(such as type, function or variable) is expected.
@ CCC_Attribute
Code completion of an attribute name.
@ CCC_Other
An unspecified code-completion context.
@ CCC_DotMemberAccess
Code completion occurred on the right-hand side of a member access expression using the dot operator.
@ CCC_MacroName
Code completion occurred where an macro is being defined.
@ CCC_Namespace
Code completion occurred where a namespace or namespace alias is expected.
@ CCC_PreprocessorDirective
Code completion occurred where a preprocessor directive is expected.
@ CCC_NaturalLanguage
Code completion occurred in a context where natural language is expected, e.g., a comment or string l...
@ CCC_ObjCInterfaceName
Code completion where the name of an Objective-C class is expected.
@ CCC_ObjCClassForwardDecl
QualType getBaseType() const
Retrieve the type of the base object in a member-access expression.
void setPreferredType(QualType T)
bool wantConstructorResults() const
Determines whether we want C++ constructors as results within this context.
void setIsUsingDeclaration(bool V)
void addVisitedContext(DeclContext *Ctx)
Adds a visited context.
Captures a result of code completion.
bool DeclaringEntity
Whether we're completing a declaration of the given entity, rather than a use of that entity.
ResultKind Kind
The kind of result stored here.
const char * Keyword
When Kind == RK_Keyword, the string representing the keyword or symbol's spelling.
CXAvailabilityKind Availability
The availability of this result.
NestedNameSpecifier * Qualifier
If the result should have a nested-name-specifier, this is it.
CodeCompletionString * CreateCodeCompletionString(Sema &S, const CodeCompletionContext &CCContext, CodeCompletionAllocator &Allocator, CodeCompletionTUInfo &CCTUInfo, bool IncludeBriefComments)
Create a new code-completion string that describes how to insert this result into a program.
bool QualifierIsInformative
Whether this result was found via lookup into a base class.
const NamedDecl * Declaration
When Kind == RK_Declaration or RK_Pattern, the declaration we are referring to.
CodeCompletionString * createCodeCompletionStringForDecl(Preprocessor &PP, ASTContext &Ctx, CodeCompletionBuilder &Result, bool IncludeBriefComments, const CodeCompletionContext &CCContext, PrintingPolicy &Policy)
CodeCompletionString * CreateCodeCompletionStringForMacro(Preprocessor &PP, CodeCompletionAllocator &Allocator, CodeCompletionTUInfo &CCTUInfo)
Creates a new code-completion string for the macro result.
unsigned StartParameter
Specifies which parameter (of a function, Objective-C method, macro, etc.) we should start with when ...
bool InBaseClass
Whether this is a class member from base class.
unsigned Priority
The priority of this particular code-completion result.
bool StartsNestedNameSpecifier
Whether this declaration is the beginning of a nested-name-specifier and, therefore,...
CodeCompletionString * Pattern
When Kind == RK_Pattern, the code-completion string that describes the completion text to insert.
bool FunctionCanBeCall
When completing a function, whether it can be a call.
bool AllParametersAreInformative
Whether all parameters (of a function, Objective-C method, etc.) should be considered "informative".
CodeCompletionString * createCodeCompletionStringForOverride(Preprocessor &PP, ASTContext &Ctx, CodeCompletionBuilder &Result, bool IncludeBriefComments, const CodeCompletionContext &CCContext, PrintingPolicy &Policy)
const IdentifierInfo * Macro
When Kind == RK_Macro, the identifier that refers to a macro.
@ RK_Pattern
Refers to a precomputed pattern.
@ RK_Declaration
Refers to a declaration.
@ RK_Macro
Refers to a macro.
@ RK_Keyword
Refers to a keyword or symbol.
A "string" used to describe how code completion can be performed for an entity.
@ CK_Optional
A code completion string that is entirely optional.
@ CK_CurrentParameter
A piece of text that describes the parameter that corresponds to the code-completion location within ...
@ CK_Comma
A comma separator (',').
@ CK_Placeholder
A string that acts as a placeholder for, e.g., a function call argument.
@ CK_LeftParen
A left parenthesis ('(').
@ CK_HorizontalSpace
Horizontal whitespace (' ').
@ CK_RightAngle
A right angle bracket ('>').
@ CK_LeftBracket
A left bracket ('[').
@ CK_Colon
A colon (':').
@ CK_RightParen
A right parenthesis (')').
@ CK_RightBrace
A right brace ('}').
@ CK_VerticalSpace
Vertical whitespace ('\n' or '\r\n', depending on the platform).
@ CK_SemiColon
A semicolon (';').
@ CK_TypedText
The piece of text that the user is expected to type to match the code-completion string,...
@ CK_RightBracket
A right bracket (']').
@ CK_LeftBrace
A left brace ('{').
@ CK_LeftAngle
A left angle bracket ('<').
Declaration of a C++20 concept.
Expr * getConstraintExpr() const
const TypeClass * getTypePtr() const
static DeclAccessPair make(NamedDecl *D, AccessSpecifier AS)
The results of name lookup within a DeclContext.
specific_decl_iterator - Iterates over a subrange of declarations stored in a DeclContext,...
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
DeclContext * getParent()
getParent - Returns the containing DeclContext.
bool Equals(const DeclContext *DC) const
Determine whether this declaration context is equivalent to the declaration context DC.
bool isRequiresExprBody() const
bool isFileContext() const
bool isObjCContainer() const
ASTContext & getParentASTContext() const
bool isDependentContext() const
Determines whether this context is dependent on a template parameter.
bool isTranslationUnit() const
DeclContext * getRedeclContext()
getRedeclContext - Retrieve the context in which an entity conflicts with other entities of the same ...
decl_range decls() const
decls_begin/decls_end - Iterate over the declarations stored in this context.
bool isFunctionOrMethod() const
bool Encloses(const DeclContext *DC) const
Determine whether this declaration context encloses the declaration context DC.
Captures information about "declaration specifiers".
static const TST TST_typename
TST getTypeSpecType() const
static const TST TST_interface
unsigned getTypeQualifiers() const
getTypeQualifiers - Return a set of TQs.
static const TST TST_union
TSC getTypeSpecComplex() const
ParsedType getRepAsType() const
static const TST TST_enum
static const TST TST_class
unsigned getParsedSpecifiers() const
Return a bitmask of which flavors of specifiers this DeclSpec includes.
bool isTypeAltiVecVector() const
TypeSpecifierSign getTypeSpecSign() const
static const TST TST_struct
Decl - This represents one declaration (or definition), e.g.
FriendObjectKind getFriendObjectKind() const
Determines whether this declaration is the object of a friend declaration and, if so,...
ASTContext & getASTContext() const LLVM_READONLY
@ FOK_Undeclared
A friend of a previously-undeclared entity.
FunctionDecl * getAsFunction() LLVM_READONLY
Returns the function itself, or the templated function if this is a function template.
ObjCDeclQualifier
ObjCDeclQualifier - 'Qualifiers' written next to the return and parameter types in method declaration...
@ OBJC_TQ_CSNullability
The nullability qualifier is set when the nullability of the result or parameter was expressed via a ...
unsigned getIdentifierNamespace() const
llvm::iterator_range< specific_attr_iterator< T > > specific_attrs() const
SourceLocation getLocation() const
@ IDNS_Ordinary
Ordinary names.
@ IDNS_Member
Members, declared with object declarations within tag definitions.
@ IDNS_ObjCProtocol
Objective C @protocol.
@ IDNS_Namespace
Namespaces, declared with 'namespace foo {}'.
@ IDNS_LocalExtern
This declaration is a function-local extern declaration of a variable or function.
@ IDNS_Tag
Tags, declared with 'struct foo;' and referenced with 'struct foo'.
DeclContext * getDeclContext()
AccessSpecifier getAccess() const
TranslationUnitDecl * getTranslationUnitDecl()
void print(raw_ostream &Out, unsigned Indentation=0, bool PrintInstantiation=false) const
DeclContext * getLexicalDeclContext()
getLexicalDeclContext - The declaration context where this Decl was lexically declared (LexicalDC).
virtual Decl * getCanonicalDecl()
Retrieves the "canonical" declaration of the given declaration.
The name of a declaration.
uintptr_t getAsOpaqueInteger() const
Get the representation of this declaration name as an opaque integer.
IdentifierInfo * getAsIdentifierInfo() const
Retrieve the IdentifierInfo * stored in this declaration name, or null if this declaration name isn't...
void print(raw_ostream &OS, const PrintingPolicy &Policy) const
@ CXXConversionFunctionName
NameKind getNameKind() const
Determine what kind of name this is.
bool isIdentifier() const
Predicate functions for querying what type of name this is.
Represents a ValueDecl that came out of a declarator.
TypeSourceInfo * getTypeSourceInfo() const
Information about one declarator, including the parsed type information and the identifier.
Represents a qualified type name for which the type name is dependent.
NestedNameSpecifier * getQualifier() const
Retrieve the qualification on this type.
const IdentifierInfo * getIdentifier() const
Retrieve the identifier that terminates this type name.
A qualified reference to a name whose declaration cannot yet be resolved.
Designation - Represent a full designation, which is a sequence of designators.
const Designator & getDesignator(unsigned Idx) const
unsigned getNumDesignators() const
DirectoryLookup - This class represents one entry in the search list that specifies the search order ...
Recursive AST visitor that supports extension via dynamic dispatch.
virtual bool TraverseNestedNameSpecifierLoc(NestedNameSpecifierLoc NNS)
Recursively visit a C++ nested-name-specifier with location information.
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of enums.
This represents one expression.
static QualType findBoundMemberType(const Expr *expr)
Given an expression of bound-member type, find the type of the member.
Expr * IgnoreParenCasts() LLVM_READONLY
Skip past any parentheses and casts which might surround this expression until reaching a fixed point...
bool isTypeDependent() const
Determines whether the type of this expression depends on.
Expr * IgnoreParenImpCasts() LLVM_READONLY
Skip past any parentheses and implicit casts which might surround this expression until reaching a fi...
virtual Selector GetExternalSelector(uint32_t ID)
Resolve a selector ID into a selector.
virtual uint32_t GetNumExternalSelectors()
Returns the number of selectors known to the external AST source.
Represents a member of a struct/union/class.
llvm::vfs::FileSystem & getVirtualFileSystem() const
static FixItHint CreateReplacement(CharSourceRange RemoveRange, StringRef Code)
Create a code modification hint that replaces the given source range with the given code string.
Represents a function declaration or definition.
unsigned getMinRequiredArguments() const
Returns the minimum number of arguments needed to call this function.
param_iterator param_end()
QualType getReturnType() const
ArrayRef< ParmVarDecl * > parameters() const
param_iterator param_begin()
bool isVariadic() const
Whether this function is variadic.
unsigned getNumParams() const
Return the number of parameters this function must have based on its FunctionType.
size_t param_size() const
Represents a prototype with parameter type info, e.g.
bool isVariadic() const
Whether this function prototype is variadic.
Declaration of a template function.
Wrapper for source info for functions.
unsigned getNumParams() const
ParmVarDecl * getParam(unsigned i) const
TypeLoc getReturnLoc() const
FunctionType - C99 6.7.5.3 - Function Declarators.
QualType getReturnType() const
const QualType getPointeeType(QualType T) const
std::vector< const NamedDecl * > resolveMemberExpr(const CXXDependentScopeMemberExpr *ME) const
std::vector< const NamedDecl * > resolveDependentNameType(const DependentNameType *DNT) const
One of these records is kept for each identifier that is lexed.
unsigned getLength() const
Efficiently return the length of this identifier info.
bool isStr(const char(&Str)[StrLen]) const
Return true if this is the identifier for the specified string.
StringRef deuglifiedName() const
If the identifier is an "uglified" reserved name, return a cleaned form.
StringRef getName() const
Return the actual identifier string.
IdentifierInfo & get(StringRef Name)
Return the identifier token info for the specified named identifier.
const TypeClass * getTypePtr() const
The injected class name of a C++ class template or class template partial specialization.
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
static StringRef getSourceText(CharSourceRange Range, const SourceManager &SM, const LangOptions &LangOpts, bool *Invalid=nullptr)
Returns a string for the source that the range encompasses.
Represents the results of name lookup.
const UnresolvedSetImpl & asUnresolvedSet() const
void suppressDiagnostics()
Suppress the diagnostics that would normally fire because of this lookup.
Encapsulates the data about a macro definition (e.g.
bool isC99Varargs() const
bool isFunctionLike() const
param_iterator param_begin() const
IdentifierInfo *const * param_iterator
Parameters - The list of parameters for a function-like macro.
param_iterator param_end() const
bool isUsedForHeaderGuard() const
Determine whether this macro was used for a header guard.
virtual ModuleLoadResult loadModule(SourceLocation ImportLoc, ModuleIdPath Path, Module::NameVisibilityKind Visibility, bool IsInclusionDirective)=0
Attempt to load the given module.
Describes a module or submodule.
@ AllVisible
All of the names in this module are visible.
ModuleKind Kind
The kind of this module.
llvm::iterator_range< submodule_iterator > submodules()
@ ImplicitGlobalModuleFragment
This is an implicit fragment of the global module which contains only language linkage declarations (...
@ ModulePartitionInterface
This is a C++20 module partition interface.
@ ModuleInterfaceUnit
This is a C++20 module interface unit.
@ PrivateModuleFragment
This is the private module fragment within some C++ module.
@ ExplicitGlobalModuleFragment
This is the explicit Global Module Fragment of a modular TU.
This represents a decl that may have a name.
NamedDecl * getUnderlyingDecl()
Looks through UsingDecls and ObjCCompatibleAliasDecls for the underlying named decl.
IdentifierInfo * getIdentifier() const
Get the identifier that names this declaration, if there is one.
StringRef getName() const
Get the name of identifier for this declaration as a StringRef.
DeclarationName getDeclName() const
Get the actual, stored name of the declaration, which may be a special name.
std::string getNameAsString() const
Get a human-readable name for the declaration, even if it is one of the special kinds of names (C++ c...
ReservedIdentifierStatus isReserved(const LangOptions &LangOpts) const
Determine if the declaration obeys the reserved identifier rules of the given language.
Represent a C++ namespace.
A C++ nested-name-specifier augmented with source location information.
NestedNameSpecifier * getNestedNameSpecifier() const
Retrieve the nested-name-specifier to which this instance refers.
Represents a C++ nested name specifier, such as "\::std::vector<int>::".
bool isDependent() const
Whether this nested name specifier refers to a dependent type or not.
static NestedNameSpecifier * Create(const ASTContext &Context, NestedNameSpecifier *Prefix, const IdentifierInfo *II)
Builds a specifier combining a prefix and an identifier.
IdentifierInfo * getAsIdentifier() const
Retrieve the identifier stored in this nested name specifier.
NestedNameSpecifier * getPrefix() const
Return the prefix of this nested name specifier.
void print(raw_ostream &OS, const PrintingPolicy &Policy, bool ResolveTemplateArguments=false) const
Print this nested name specifier to the given output stream.
const Type * getAsType() const
Retrieve the type stored in this nested name specifier.
NonTypeTemplateParmDecl - Declares a non-type template parameter, e.g., "Size" in.
ObjCCategoryDecl - Represents a category declaration.
ObjCCategoryImplDecl - An object of this class encapsulates a category @implementation declaration.
ObjCContainerDecl - Represents a container for method declarations.
Captures information about "declaration specifiers" specific to Objective-C.
ObjCPropertyAttribute::Kind getPropertyAttributes() const
ObjCDeclQualifier getObjCDeclQualifier() const
ObjCImplementationDecl - Represents a class definition - this is where method definitions are specifi...
Represents an ObjC class declaration.
bool hasDefinition() const
Determine whether this class has been defined.
protocol_range protocols() const
known_categories_range known_categories() const
ObjCImplementationDecl * getImplementation() const
visible_categories_range visible_categories() const
ObjCInterfaceDecl * getSuperClass() const
ObjCIvarDecl - Represents an ObjC instance variable.
ObjCList - This is a simple template class used to hold various lists of decls etc,...
@ SuperInstance
The receiver is the instance of the superclass object.
@ Instance
The receiver is an object instance.
@ SuperClass
The receiver is a superclass.
@ Class
The receiver is a class.
ObjCMethodDecl - Represents an instance or class method declaration.
ObjCDeclQualifier getObjCDeclQualifier() const
ArrayRef< ParmVarDecl * > parameters() const
unsigned param_size() const
param_const_iterator param_end() const
QualType getSendResultType() const
Determine the type of an expression that sends a message to this function.
param_const_iterator param_begin() const
const ParmVarDecl *const * param_const_iterator
Selector getSelector() const
bool isInstanceMethod() const
QualType getReturnType() const
ParmVarDecl *const * param_iterator
ObjCInterfaceDecl * getClassInterface()
Represents a pointer to an Objective C object.
ObjCInterfaceDecl * getInterfaceDecl() const
If this pointer points to an Objective @interface type, gets the declaration for that interface.
Represents a class type in Objective C.
Represents one property declaration in an Objective-C interface.
static ObjCPropertyDecl * findPropertyDecl(const DeclContext *DC, const IdentifierInfo *propertyID, ObjCPropertyQueryKind queryKind)
Lookup a property by name in the specified DeclContext.
Selector getGetterName() const
Represents an Objective-C protocol declaration.
void * getAsOpaquePtr() const
static OpaquePtr make(QualType P)
OverloadCandidateSet - A set of overload candidates, used in C++ overload resolution (C++ 13....
@ CSK_Normal
Normal lookup.
CandidateSetKind getKind() const
Represents a parameter to a function.
SourceRange getDefaultArgRange() const
Retrieve the source range that covers the entire default argument.
bool hasDefaultArg() const
Determines whether this parameter has a default argument, either parsed or not.
Represents the parsed form of a C++ template argument.
KindType getKind() const
Determine what kind of template argument we have.
@ Type
A template type parameter, stored as a type.
@ Template
A template template argument, stored as a template name.
@ NonType
A non-type template parameter, stored as an expression.
Wrapper for source info for pointers.
PointerType - C99 6.7.5.1 - Pointer Declarators.
void enterFunctionArgument(SourceLocation Tok, llvm::function_ref< QualType()> ComputeType)
Computing a type for the function argument may require running overloading, so we postpone its comput...
void enterCondition(Sema &S, SourceLocation Tok)
void enterTypeCast(SourceLocation Tok, QualType CastType)
Handles all type casts, including C-style cast, C++ casts, etc.
void enterMemAccess(Sema &S, SourceLocation Tok, Expr *Base)
void enterSubscript(Sema &S, SourceLocation Tok, Expr *LHS)
void enterUnary(Sema &S, SourceLocation Tok, tok::TokenKind OpKind, SourceLocation OpLoc)
void enterReturn(Sema &S, SourceLocation Tok)
void enterDesignatedInitializer(SourceLocation Tok, QualType BaseType, const Designation &D)
Handles e.g. BaseType{ .D = Tok...
void enterBinary(Sema &S, SourceLocation Tok, Expr *LHS, tok::TokenKind Op)
void enterParenExpr(SourceLocation Tok, SourceLocation LParLoc)
void enterVariableInit(SourceLocation Tok, Decl *D)
QualType get(SourceLocation Tok) const
Get the expected type associated with this location, if any.
OptionalFileEntryRef getFileEntry() const
getFileEntry - Return the FileEntry corresponding to this FileID.
Engages in a tight little dance with the lexer to efficiently preprocess tokens.
const MacroInfo * getMacroInfo(const IdentifierInfo *II) const
macro_iterator macro_begin(bool IncludeExternalMacros=true) const
ModuleLoader & getModuleLoader() const
Retrieve the module loader associated with this preprocessor.
macro_iterator macro_end(bool IncludeExternalMacros=true) const
SourceManager & getSourceManager() const
MacroDefinition getMacroDefinition(const IdentifierInfo *II)
bool isMacroDefined(StringRef Id)
MacroMap::const_iterator macro_iterator
llvm::iterator_range< macro_iterator > macros(bool IncludeExternalMacros=true) const
PreprocessorLexer * getCurrentFileLexer() const
Return the current file lexer being lexed from.
HeaderSearch & getHeaderSearchInfo() const
const LangOptions & getLangOpts() const
bool isCodeCompletionReached() const
Returns true if code-completion is enabled and we have hit the code-completion point.
A (possibly-)qualified type.
bool isNull() const
Return true if this QualType doesn't point to a type yet.
const Type * getTypePtr() const
Retrieves a pointer to the underlying (unqualified) type.
Qualifiers getQualifiers() const
Retrieve the set of qualifiers applied to this type.
QualType stripObjCKindOfType(const ASTContext &ctx) const
Strip Objective-C "__kindof" types from the given type.
void print(raw_ostream &OS, const PrintingPolicy &Policy, const Twine &PlaceHolder=Twine(), unsigned Indentation=0) const
void getAsStringInternal(std::string &Str, const PrintingPolicy &Policy) const
QualType getNonReferenceType() const
If Type is a reference type (e.g., const int&), returns the type that the reference refers to ("const...
QualType getCanonicalType() const
QualType getUnqualifiedType() const
Retrieve the unqualified variant of the given type, removing as little sugar as possible.
QualType substObjCTypeArgs(ASTContext &ctx, ArrayRef< QualType > typeArgs, ObjCSubstitutionContext context) const
Substitute type arguments for the Objective-C type parameters used in the subject type.
static std::string getAsString(SplitQualType split, const PrintingPolicy &Policy)
Wrapper of type source information for a type with non-trivial direct qualifiers.
The collection of all-type qualifiers we support.
bool compatiblyIncludes(Qualifiers other, const ASTContext &Ctx) const
Determines if these qualifiers compatibly include another set.
Represents a struct/union/class.
bool isLambda() const
Determine whether this record is a class describing a lambda function object.
field_range fields() const
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of structs/unions/cl...
Base for LValueReferenceType and RValueReferenceType.
QualType getPointeeType() const
Scope - A scope is a transient data structure that is used while parsing the program.
@ FunctionPrototypeScope
This is a scope that corresponds to the parameters within a function prototype.
@ AtCatchScope
This is a scope that corresponds to the Objective-C @catch statement.
@ TemplateParamScope
This is a scope that corresponds to the template parameters of a C++ template.
@ ClassScope
The scope of a struct/union/class definition.
@ DeclScope
This is a scope that can contain a declaration.
This table allows us to fully hide how we implement multi-keyword caching.
Selector getNullarySelector(const IdentifierInfo *ID)
Selector getSelector(unsigned NumArgs, const IdentifierInfo **IIV)
Can create any sort of selector.
Selector getUnarySelector(const IdentifierInfo *ID)
Smart pointer class that efficiently represents Objective-C method names.
StringRef getNameForSlot(unsigned argIndex) const
Retrieve the name at a given position in the selector.
const IdentifierInfo * getIdentifierInfoForSlot(unsigned argIndex) const
Retrieve the identifier at a given position in the selector.
bool isUnarySelector() const
bool isNull() const
Determine whether this is the empty selector.
unsigned getNumArgs() const
void CodeCompleteObjCInstanceMessage(Scope *S, Expr *Receiver, ArrayRef< const IdentifierInfo * > SelIdents, bool AtArgumentExpression, ObjCInterfaceDecl *Super=nullptr)
void CodeCompleteObjCPropertySynthesizeIvar(Scope *S, IdentifierInfo *PropertyName)
void CodeCompleteAttribute(AttributeCommonInfo::Syntax Syntax, AttributeCompletion Completion=AttributeCompletion::Attribute, const IdentifierInfo *Scope=nullptr)
QualType ProduceTemplateArgumentSignatureHelp(TemplateTy, ArrayRef< ParsedTemplateArgument >, SourceLocation LAngleLoc)
QualType ProduceCtorInitMemberSignatureHelp(Decl *ConstructorDecl, CXXScopeSpec SS, ParsedType TemplateTypeTy, ArrayRef< Expr * > ArgExprs, IdentifierInfo *II, SourceLocation OpenParLoc, bool Braced)
void CodeCompleteObjCClassForwardDecl(Scope *S)
void CodeCompleteNamespaceAliasDecl(Scope *S)
void GatherGlobalCodeCompletions(CodeCompletionAllocator &Allocator, CodeCompletionTUInfo &CCTUInfo, SmallVectorImpl< CodeCompletionResult > &Results)
void CodeCompleteObjCAtStatement(Scope *S)
void CodeCompleteUsing(Scope *S)
void CodeCompleteObjCMessageReceiver(Scope *S)
void CodeCompleteOperatorName(Scope *S)
void CodeCompleteUsingDirective(Scope *S)
void CodeCompleteObjCProtocolDecl(Scope *S)
void CodeCompleteObjCPropertyFlags(Scope *S, ObjCDeclSpec &ODS)
ParserCompletionContext
Describes the context in which code completion occurs.
@ PCC_LocalDeclarationSpecifiers
Code completion occurs within a sequence of declaration specifiers within a function,...
@ PCC_MemberTemplate
Code completion occurs following one or more template headers within a class.
@ PCC_Condition
Code completion occurs within the condition of an if, while, switch, or for statement.
@ PCC_ParenthesizedExpression
Code completion occurs in a parenthesized expression, which might also be a type cast.
@ PCC_TopLevelOrExpression
Code completion occurs at top-level in a REPL session.
@ PCC_Class
Code completion occurs within a class, struct, or union.
@ PCC_ForInit
Code completion occurs at the beginning of the initialization statement (or expression) in a for loop...
@ PCC_Type
Code completion occurs where only a type is permitted.
@ PCC_ObjCImplementation
Code completion occurs within an Objective-C implementation or category implementation.
@ PCC_ObjCInterface
Code completion occurs within an Objective-C interface, protocol, or category.
@ PCC_Namespace
Code completion occurs at top-level or namespace context.
@ PCC_Expression
Code completion occurs within an expression.
@ PCC_RecoveryInFunction
Code completion occurs within the body of a function on a recovery path, where we do not have a speci...
@ PCC_ObjCInstanceVariableList
Code completion occurs within the list of instance variables in an Objective-C interface,...
@ PCC_Template
Code completion occurs following one or more template headers.
@ PCC_Statement
Code completion occurs within a statement, which may also be an expression or a declaration.
void CodeCompleteObjCAtDirective(Scope *S)
void CodeCompleteObjCPropertySetter(Scope *S)
void CodeCompleteLambdaIntroducer(Scope *S, LambdaIntroducer &Intro, bool AfterAmpersand)
void CodeCompleteCase(Scope *S)
void CodeCompleteObjCImplementationCategory(Scope *S, IdentifierInfo *ClassName, SourceLocation ClassNameLoc)
void CodeCompleteObjCInterfaceDecl(Scope *S)
void CodeCompleteFunctionQualifiers(DeclSpec &DS, Declarator &D, const VirtSpecifiers *VS=nullptr)
void CodeCompletePreprocessorMacroName(bool IsDefinition)
void CodeCompleteInPreprocessorConditionalExclusion(Scope *S)
void CodeCompleteObjCAtExpression(Scope *S)
void CodeCompletePreprocessorExpression()
void CodeCompleteTypeQualifiers(DeclSpec &DS)
void CodeCompleteObjCPropertyDefinition(Scope *S)
void CodeCompleteObjCSuperMessage(Scope *S, SourceLocation SuperLoc, ArrayRef< const IdentifierInfo * > SelIdents, bool AtArgumentExpression)
CodeCompleteConsumer * CodeCompleter
Code-completion consumer.
void CodeCompleteAfterFunctionEquals(Declarator &D)
QualType ProduceConstructorSignatureHelp(QualType Type, SourceLocation Loc, ArrayRef< Expr * > Args, SourceLocation OpenParLoc, bool Braced)
void CodeCompleteExpression(Scope *S, const CodeCompleteExpressionData &Data)
Perform code-completion in an expression context when we know what type we're looking for.
QualType ProduceCallSignatureHelp(Expr *Fn, ArrayRef< Expr * > Args, SourceLocation OpenParLoc)
Determines the preferred type of the current function argument, by examining the signatures of all po...
void CodeCompleteObjCMethodDeclSelector(Scope *S, bool IsInstanceMethod, bool AtParameterName, ParsedType ReturnType, ArrayRef< const IdentifierInfo * > SelIdents)
void CodeCompleteQualifiedId(Scope *S, CXXScopeSpec &SS, bool EnteringContext, bool IsUsingDeclaration, QualType BaseType, QualType PreferredType)
void CodeCompleteIncludedFile(llvm::StringRef Dir, bool IsAngled)
void CodeCompletePreprocessorMacroArgument(Scope *S, IdentifierInfo *Macro, MacroInfo *MacroInfo, unsigned Argument)
void CodeCompleteModuleImport(SourceLocation ImportLoc, ModuleIdPath Path)
void CodeCompleteObjCInterfaceCategory(Scope *S, IdentifierInfo *ClassName, SourceLocation ClassNameLoc)
void CodeCompleteObjCSelector(Scope *S, ArrayRef< const IdentifierInfo * > SelIdents)
void CodeCompleteConstructorInitializer(Decl *Constructor, ArrayRef< CXXCtorInitializer * > Initializers)
void CodeCompleteObjCImplementationDecl(Scope *S)
void CodeCompleteAfterIf(Scope *S, bool IsBracedThen)
void CodeCompleteObjCMethodDecl(Scope *S, std::optional< bool > IsInstanceMethod, ParsedType ReturnType)
void CodeCompleteOrdinaryName(Scope *S, ParserCompletionContext CompletionContext)
void CodeCompleteObjCProtocolReferences(ArrayRef< IdentifierLocPair > Protocols)
void CodeCompleteNaturalLanguage()
void CodeCompleteObjCClassPropertyRefExpr(Scope *S, const IdentifierInfo &ClassName, SourceLocation ClassNameLoc, bool IsBaseExprStatement)
void CodeCompleteInitializer(Scope *S, Decl *D)
void CodeCompleteNamespaceDecl(Scope *S)
void CodeCompleteDesignator(const QualType BaseType, llvm::ArrayRef< Expr * > InitExprs, const Designation &D)
Trigger code completion for a record of BaseType.
void CodeCompletePreprocessorDirective(bool InConditional)
SemaCodeCompletion(Sema &S, CodeCompleteConsumer *CompletionConsumer)
void CodeCompleteBracketDeclarator(Scope *S)
void CodeCompleteObjCSuperclass(Scope *S, IdentifierInfo *ClassName, SourceLocation ClassNameLoc)
void CodeCompleteObjCAtVisibility(Scope *S)
void CodeCompleteTag(Scope *S, unsigned TagSpec)
void CodeCompleteObjCClassMessage(Scope *S, ParsedType Receiver, ArrayRef< const IdentifierInfo * > SelIdents, bool AtArgumentExpression, bool IsSuper=false)
void CodeCompleteObjCForCollection(Scope *S, DeclGroupPtrTy IterationVar)
void CodeCompleteAvailabilityPlatformName()
void CodeCompleteMemberReferenceExpr(Scope *S, Expr *Base, Expr *OtherOpBase, SourceLocation OpLoc, bool IsArrow, bool IsBaseExprStatement, QualType PreferredType)
void CodeCompleteObjCPassingType(Scope *S, ObjCDeclSpec &DS, bool IsParameter)
void CodeCompleteObjCPropertyGetter(Scope *S)
void CodeCompleteDeclSpec(Scope *S, DeclSpec &DS, bool AllowNonIdentifiers, bool AllowNestedNameSpecifiers)
void CodeCompletePostfixExpression(Scope *S, ExprResult LHS, QualType PreferredType)
ObjCInterfaceDecl * getObjCInterfaceDecl(const IdentifierInfo *&Id, SourceLocation IdLoc, bool TypoCorrection=false)
Look for an Objective-C class in the translation unit.
ObjCProtocolDecl * LookupProtocol(IdentifierInfo *II, SourceLocation IdLoc, RedeclarationKind Redecl=RedeclarationKind::NotForRedeclaration)
Find the protocol with the given name, if any.
GlobalMethodPool MethodPool
Method Pool - allows efficient lookup when typechecking messages to "id".
void ReadMethodPool(Selector Sel)
Read the contents of the method pool for a given selector from external storage.
Sema - This implements semantic analysis and AST building for C.
QualType getCurrentThisType()
Try to retrieve the type of the 'this' pointer.
ExprResult PerformContextuallyConvertToObjCPointer(Expr *From)
PerformContextuallyConvertToObjCPointer - Perform a contextual conversion of the expression From to a...
bool IsOverload(FunctionDecl *New, FunctionDecl *Old, bool UseMemberUsingDeclRules, bool ConsiderCudaAttrs=true)
@ LookupOrdinaryName
Ordinary name lookup, which finds ordinary names (functions, variables, typedefs, etc....
@ LookupNestedNameSpecifierName
Look up of a name that precedes the '::' scope resolution operator in C++.
@ LookupMemberName
Member name lookup, which finds the names of class/struct/union members.
@ LookupTagName
Tag name lookup, which finds the names of enums, classes, structs, and unions.
@ LookupAnyName
Look up any declaration with any name.
TemplateDecl * AdjustDeclIfTemplate(Decl *&Decl)
AdjustDeclIfTemplate - If the given decl happens to be a template, reset the parameter D to reference...
bool RequireCompleteDeclContext(CXXScopeSpec &SS, DeclContext *DC)
Require that the context specified by SS be complete.
ExprResult ActOnIdExpression(Scope *S, CXXScopeSpec &SS, SourceLocation TemplateKWLoc, UnqualifiedId &Id, bool HasTrailingLParen, bool IsAddressOfOperand, CorrectionCandidateCallback *CCC=nullptr, bool IsInlineAsmIdentifier=false, Token *KeywordReplacement=nullptr)
Preprocessor & getPreprocessor() const
NamedDecl * LookupSingleName(Scope *S, DeclarationName Name, SourceLocation Loc, LookupNameKind NameKind, RedeclarationKind Redecl=RedeclarationKind::NotForRedeclaration)
Look up a name, looking for a single declaration.
IdentifierInfo * getSuperIdentifier() const
static bool TooManyArguments(size_t NumParams, size_t NumArgs, bool PartialOverloading=false)
To be used for checking whether the arguments being passed to function exceeds the number of paramete...
ExprResult PerformMemberExprBaseConversion(Expr *Base, bool IsArrow)
Perform conversions on the LHS of a member access expression.
void AddOverloadCandidate(FunctionDecl *Function, DeclAccessPair FoundDecl, ArrayRef< Expr * > Args, OverloadCandidateSet &CandidateSet, bool SuppressUserConversions=false, bool PartialOverloading=false, bool AllowExplicit=true, bool AllowExplicitConversion=false, ADLCallKind IsADLCandidate=ADLCallKind::NotADL, ConversionSequenceList EarlyConversions={}, OverloadCandidateParamOrder PO={}, bool AggregateCandidateDeduction=false, bool HasMatchedPackOnParmToNonPackOnArg=false)
AddOverloadCandidate - Adds the given function to the set of candidate functions, using the given fun...
ExprResult DefaultFunctionArrayLvalueConversion(Expr *E, bool Diagnose=true)
ASTContext & getASTContext() const
bool isInitListConstructor(const FunctionDecl *Ctor)
Determine whether Ctor is an initializer-list constructor, as defined in [dcl.init....
ValueDecl * tryLookupCtorInitMemberDecl(CXXRecordDecl *ClassDecl, CXXScopeSpec &SS, ParsedType TemplateTypeTy, IdentifierInfo *MemberOrBase)
PrintingPolicy getPrintingPolicy() const
Retrieve a suitable printing policy for diagnostics.
ObjCMethodDecl * getCurMethodDecl()
getCurMethodDecl - If inside of a method body, this returns a pointer to the method decl for the meth...
void AddTemplateOverloadCandidate(FunctionTemplateDecl *FunctionTemplate, DeclAccessPair FoundDecl, TemplateArgumentListInfo *ExplicitTemplateArgs, ArrayRef< Expr * > Args, OverloadCandidateSet &CandidateSet, bool SuppressUserConversions=false, bool PartialOverloading=false, bool AllowExplicit=true, ADLCallKind IsADLCandidate=ADLCallKind::NotADL, OverloadCandidateParamOrder PO={}, bool AggregateCandidateDeduction=false)
Add a C++ function template specialization as a candidate in the candidate set, using template argume...
const LangOptions & getLangOpts() const
void LookupVisibleDecls(Scope *S, LookupNameKind Kind, VisibleDeclConsumer &Consumer, bool IncludeGlobalScope=true, bool LoadExternal=true)
SemaCodeCompletion & CodeCompletion()
sema::FunctionScopeInfo * getCurFunction() const
void AddOverloadedCallCandidates(UnresolvedLookupExpr *ULE, ArrayRef< Expr * > Args, OverloadCandidateSet &CandidateSet, bool PartialOverloading=false)
Add the overload candidates named by callee and/or found by argument dependent lookup to the given ov...
Module * getCurrentModule() const
Get the module unit whose scope we are currently within.
sema::BlockScopeInfo * getCurBlock()
Retrieve the current block, if any.
DeclContext * CurContext
CurContext - This is the current declaration context of parsing.
SourceManager & getSourceManager() const
DeclContext * computeDeclContext(QualType T)
Compute the DeclContext that is associated with the given type.
ExternalSemaSource * getExternalSource() const
bool isCompleteType(SourceLocation Loc, QualType T, CompleteTypeKind Kind=CompleteTypeKind::Default)
IntrusiveRefCntPtr< ExternalSemaSource > ExternalSource
Source of additional semantic information.
void AddFunctionCandidates(const UnresolvedSetImpl &Functions, ArrayRef< Expr * > Args, OverloadCandidateSet &CandidateSet, TemplateArgumentListInfo *ExplicitTemplateArgs=nullptr, bool SuppressUserConversions=false, bool PartialOverloading=false, bool FirstArgumentIsBase=false)
Add all of the function declarations in the given function set to the overload candidate set.
bool isAcceptableNestedNameSpecifier(const NamedDecl *SD, bool *CanCorrect=nullptr)
Determines whether the given declaration is an valid acceptable result for name lookup of a nested-na...
Scope * TUScope
Translation Unit Scope - useful to Objective-C actions that need to lookup file scope declarations in...
bool LookupQualifiedName(LookupResult &R, DeclContext *LookupCtx, bool InUnqualifiedLookup=false)
Perform qualified name lookup into a given context.
SourceManager & SourceMgr
static QualType GetTypeFromParser(ParsedType Ty, TypeSourceInfo **TInfo=nullptr)
DeclContextLookupResult LookupConstructors(CXXRecordDecl *Class)
Look up the constructors for the given class.
void MarkDeducedTemplateParameters(const FunctionTemplateDecl *FunctionTemplate, llvm::SmallBitVector &Deduced)
Encodes a location in the source.
This class handles loading and caching of source files into memory.
SourceLocation getSpellingLoc(SourceLocation Loc) const
Given a SourceLocation object, return the spelling location referenced by the ID.
FileManager & getFileManager() const
bool isInSystemHeader(SourceLocation Loc) const
Returns if a SourceLocation is in a system header.
A trivial tuple used to represent a source range.
SwitchStmt - This represents a 'switch' stmt.
Represents the declaration of a struct/union/class/enum.
A convenient class for passing around template argument information.
Represents a template argument.
QualType getAsType() const
Retrieve the type for a type template argument.
@ Type
The template argument is a type.
ArgKind getKind() const
Return the kind of stored template argument.
The base class of all kinds of template declarations (e.g., class, function, etc.).
TemplateParameterList * getTemplateParameters() const
Get the list of template parameters.
Represents a C++ template name within the type system.
TemplateDecl * getAsTemplateDecl(bool IgnoreDeduced=false) const
Retrieve the underlying template declaration that this template name refers to, if known.
OverloadedTemplateStorage * getAsOverloadedTemplate() const
Retrieve the underlying, overloaded function template declarations that this template name refers to,...
Stores a list of template parameters for a TemplateDecl and its derived classes.
NamedDecl * getParam(unsigned Idx)
bool hasParameterPack() const
Determine whether this template parameter list contains a parameter pack.
ArrayRef< NamedDecl * > asArray()
Represents a type template specialization; the template must be a class template, a type alias templa...
TemplateTemplateParmDecl - Declares a template template parameter, e.g., "T" in.
bool hasDefaultArgument() const
Determine whether this template parameter has a default argument.
Declaration of a template type parameter.
TemplateTypeParmDecl * getDecl() const
The top declaration context.
Models the abbreviated syntax to constrain a template type parameter: template <convertible_to<string...
void print(llvm::raw_ostream &OS, const PrintingPolicy &Policy) const
Represents a declaration of a type.
Base wrapper for a particular "section" of type source info.
UnqualTypeLoc getUnqualifiedLoc() const
Skips past any qualifiers, if this is qualified.
QualType getType() const
Get the type for which this source info wrapper provides information.
T getAs() const
Convert to the specified TypeLoc type, returning a null TypeLoc if this TypeLoc is not of the desired...
TypeLoc IgnoreParens() const
T getAsAdjusted() const
Convert to the specified TypeLoc type, returning a null TypeLoc if this TypeLoc is not of the desired...
A container of type source information.
TypeLoc getTypeLoc() const
Return the TypeLoc wrapper for the type source info.
The base class of the type hierarchy.
CXXRecordDecl * getAsCXXRecordDecl() const
Retrieves the CXXRecordDecl that this type refers to, either because the type is a RecordType or beca...
bool isBlockPointerType() const
bool isBooleanType() const
const ObjCObjectPointerType * getAsObjCQualifiedIdType() const
bool isPointerType() const
CanQualType getCanonicalTypeUnqualified() const
bool isIntegerType() const
isIntegerType() does not include complex integers (a GCC extension).
const T * castAs() const
Member-template castAs<specific type>.
const ObjCObjectPointerType * getAsObjCInterfacePointerType() const
QualType getPointeeType() const
If this is a pointer, ObjC object pointer, or block pointer, this returns the respective pointee.
bool isIntegralOrEnumerationType() const
Determine whether this type is an integral or enumeration type.
bool isObjCObjectOrInterfaceType() const
bool isDependentType() const
Whether this type is a dependent type, meaning that its definition somehow depends on a template para...
bool isTemplateTypeParmType() const
bool isMemberPointerType() const
bool isObjCIdType() const
bool isObjCObjectType() const
const ArrayType * getAsArrayTypeUnsafe() const
A variant of getAs<> for array types which silently discards qualifiers from the outermost type.
bool isObjCObjectPointerType() const
bool isObjCQualifiedClassType() const
bool isObjCClassType() const
std::optional< ArrayRef< QualType > > getObjCSubstitutions(const DeclContext *dc) const
Retrieve the set of substitutions required when accessing a member of the Objective-C receiver type t...
TypeClass getTypeClass() const
const T * getAs() const
Member-template getAs<specific type>'.
bool isRecordType() const
RecordDecl * getAsRecordDecl() const
Retrieves the RecordDecl this type refers to.
Wrapper for source info for typedefs.
Represents a C++ unqualified-id that has been parsed.
void setIdentifier(const IdentifierInfo *Id, SourceLocation IdLoc)
Specify that this unqualified-id was parsed as an identifier.
void append(iterator I, iterator E)
A set of unresolved declarations.
Represents a shadow declaration implicitly introduced into a scope by a (resolved) using-declaration ...
Represent the declaration of a variable (in which case it is an lvalue) a function (in which case it ...
Represents a C++11 virt-specifier-seq.
bool isOverrideSpecified() const
bool isFinalSpecified() const
Consumes visible declarations found when searching for all visible names within a given scope or cont...
A static requirement that can be used in a requires-expression to check properties of types and expre...
Retains information about a block that is currently being parsed.
QualType ReturnType
ReturnType - The target type of return statements in this context, or null if unknown.
SmallVector< SwitchInfo, 8 > SwitchStack
SwitchStack - This is the current set of active switch statements in the block.
CXCursorKind
Describes the kind of entity that a cursor refers to.
@ CXCursor_ObjCInterfaceDecl
An Objective-C @interface.
@ CXCursor_Namespace
A C++ namespace.
@ CXCursor_TypedefDecl
A typedef.
@ CXCursor_CXXAccessSpecifier
An access specifier.
@ CXCursor_EnumConstantDecl
An enumerator constant.
@ CXCursor_ConversionFunction
A C++ conversion function.
@ CXCursor_ConceptDecl
a concept declaration.
@ CXCursor_ClassTemplate
A C++ class template.
@ CXCursor_UnionDecl
A C or C++ union.
@ CXCursor_ObjCSynthesizeDecl
An Objective-C @synthesize definition.
@ CXCursor_ParmDecl
A function or method parameter.
@ CXCursor_FieldDecl
A field (in C) or non-static data member (in C++) in a struct, union, or C++ class.
@ CXCursor_CXXMethod
A C++ class method.
@ CXCursor_EnumDecl
An enumeration.
@ CXCursor_ObjCClassMethodDecl
An Objective-C class method.
@ CXCursor_TranslationUnit
Cursor that represents the translation unit itself.
@ CXCursor_ClassTemplatePartialSpecialization
A C++ class template partial specialization.
@ CXCursor_ObjCProtocolDecl
An Objective-C @protocol declaration.
@ CXCursor_FunctionTemplate
A C++ function template.
@ CXCursor_ObjCImplementationDecl
An Objective-C @implementation.
@ CXCursor_NonTypeTemplateParameter
A C++ non-type template parameter.
@ CXCursor_FunctionDecl
A function.
@ CXCursor_ObjCPropertyDecl
An Objective-C @property declaration.
@ CXCursor_Destructor
A C++ destructor.
@ CXCursor_ObjCIvarDecl
An Objective-C instance variable.
@ CXCursor_TypeAliasTemplateDecl
@ CXCursor_ObjCCategoryImplDecl
An Objective-C @implementation for a category.
@ CXCursor_ObjCDynamicDecl
An Objective-C @dynamic definition.
@ CXCursor_MacroDefinition
@ CXCursor_VarDecl
A variable.
@ CXCursor_TemplateTypeParameter
A C++ template type parameter.
@ CXCursor_TemplateTemplateParameter
A C++ template template parameter.
@ CXCursor_UnexposedDecl
A declaration whose specific kind is not exposed via this interface.
@ CXCursor_ObjCInstanceMethodDecl
An Objective-C instance method.
@ CXCursor_StructDecl
A C or C++ struct.
@ CXCursor_UsingDeclaration
A C++ using declaration.
@ CXCursor_LinkageSpec
A linkage specification, e.g.
@ CXCursor_ClassDecl
A C++ class.
@ CXCursor_ObjCCategoryDecl
An Objective-C @interface for a category.
@ CXCursor_StaticAssert
A static_assert or _Static_assert node.
@ CXCursor_ModuleImportDecl
A module import declaration.
@ CXCursor_MemberRef
A reference to a member of a struct, union, or class that occurs in some non-expression context,...
@ CXCursor_NamespaceAlias
A C++ namespace alias declaration.
@ CXCursor_Constructor
A C++ constructor.
@ CXCursor_FriendDecl
a friend declaration.
@ CXCursor_TypeAliasDecl
A C++ alias declaration.
@ CXCursor_UsingDirective
A C++ using directive.
@ CXAvailability_Available
The entity is available.
@ CXAvailability_Deprecated
The entity is available, but has been deprecated (and its use is not recommended).
@ CXAvailability_NotAvailable
The entity is not available; any use of it will be an error.
@ kind_nullability
Indicates that the nullability of the type was spelled with a property attribute rather than a type q...
QualType getFullyQualifiedType(QualType QT, const ASTContext &Ctx, bool WithGlobalNsPrefix=false)
Generates a QualType that can be used to name the same type if used at the end of the current transla...
const internal::VariadicAllOfMatcher< Type > type
Matches Types in the clang AST.
bool Alloc(InterpState &S, CodePtr OpPC, const Descriptor *Desc)
bool Add(InterpState &S, CodePtr OpPC)
TokenKind
Provides a simple uniform namespace for tokens from all C languages.
The JSON file list parser is used to communicate input to InstallAPI.
TypeSpecifierType
Specifies the kind of type.
@ OO_None
Not an overloaded operator.
@ NUM_OVERLOADED_OPERATORS
@ Specialization
We are substituting template parameters for template arguments in order to form a template specializa...
@ CCP_Type
Priority for a type.
@ CCP_ObjC_cmd
Priority for the Objective-C "_cmd" implicit parameter.
@ CCP_Keyword
Priority for a language keyword (that isn't any of the other categories).
@ CCP_Macro
Priority for a preprocessor macro.
@ CCP_LocalDeclaration
Priority for a declaration that is in the local scope.
@ CCP_Unlikely
Priority for a result that isn't likely to be what the user wants, but is included for completeness.
@ CCP_NestedNameSpecifier
Priority for a nested-name-specifier.
@ CCP_SuperCompletion
Priority for a send-to-super completion.
@ CCP_NextInitializer
Priority for the next initialization in a constructor initializer list.
@ CCP_Declaration
Priority for a non-type declaration.
@ CCP_Constant
Priority for a constant value (e.g., enumerator).
@ CCP_MemberDeclaration
Priority for a member declaration found from the current method or member function.
@ CCP_EnumInCase
Priority for an enumeration constant inside a switch whose condition is of the enumeration type.
@ CCP_CodePattern
Priority for a code pattern.
QualType getDeclUsageType(ASTContext &C, const NamedDecl *ND)
Determine the type that this declaration will have if it is used as a type or in an expression.
bool isReservedInAllContexts(ReservedIdentifierStatus Status)
Determine whether an identifier is reserved in all contexts.
@ Nullable
Values of this type can be null.
@ Unspecified
Whether values of this type can be null is (explicitly) unspecified.
@ NonNull
Values of this type can never be null.
CXCursorKind getCursorKindForDecl(const Decl *D)
Determine the libclang cursor kind associated with the given declaration.
RefQualifierKind
The kind of C++11 ref-qualifier associated with a function type.
@ RQ_None
No ref-qualifier was provided.
@ RQ_LValue
An lvalue ref-qualifier was provided (&).
@ RQ_RValue
An rvalue ref-qualifier was provided (&&).
const RawComment * getParameterComment(const ASTContext &Ctx, const CodeCompleteConsumer::OverloadCandidate &Result, unsigned ArgIndex)
Get the documentation comment used to produce CodeCompletionString::BriefComment for OverloadCandidat...
@ LCK_This
Capturing the *this object by reference.
@ IK_ConstructorName
A constructor name.
@ IK_DestructorName
A destructor name.
@ IK_OperatorFunctionId
An overloaded operator name, e.g., operator+.
@ Property
The type of a property.
@ Parameter
The parameter type of a method or function.
@ Result
The result type of a method or function.
SimplifiedTypeClass
A simplified classification of types used when determining "similar" types for code completion.
const RawComment * getPatternCompletionComment(const ASTContext &Ctx, const NamedDecl *Decl)
Get the documentation comment used to produce CodeCompletionString::BriefComment for RK_Pattern.
@ CCD_SelectorMatch
The selector of the given message exactly matches the selector of the current method,...
@ CCD_ObjectQualifierMatch
The result is a C++ non-static member function whose qualifiers exactly match the object type on whic...
@ CCD_bool_in_ObjC
Adjustment to the "bool" type in Objective-C, where the typedef "BOOL" is preferred.
@ CCD_InBaseClass
The result is in a base class.
@ CCD_ProbablyNotObjCCollection
Adjustment for KVC code pattern priorities when it doesn't look like the.
@ CCD_BlockPropertySetter
An Objective-C block property completed as a setter with a block placeholder.
@ CCD_MethodAsProperty
An Objective-C method being used as a property.
@ Interface
The "__interface" keyword.
@ Struct
The "struct" keyword.
@ Class
The "class" keyword.
@ Union
The "union" keyword.
@ Enum
The "enum" keyword.
LLVM_READONLY char toUppercase(char c)
Converts the given ASCII character to its uppercase equivalent.
const RawComment * getCompletionComment(const ASTContext &Ctx, const NamedDecl *Decl)
Get the documentation comment used to produce CodeCompletionString::BriefComment for RK_Declaration.
SimplifiedTypeClass getSimplifiedTypeClass(CanQualType T)
Determine the simplified type class of the given canonical type.
ExprValueKind
The categorization of expression values, currently following the C++11 scheme.
@ VK_XValue
An x-value expression is a reference to an object with independent storage but which can be "moved",...
@ VK_LValue
An l-value expression is a reference to an object with independent storage.
bool isBetterOverloadCandidate(Sema &S, const OverloadCandidate &Cand1, const OverloadCandidate &Cand2, SourceLocation Loc, OverloadCandidateSet::CandidateSetKind Kind)
isBetterOverloadCandidate - Determines whether the first overload candidate is a better candidate tha...
@ CCF_ExactTypeMatch
Divide by this factor when a code-completion result's type exactly matches the type we expect.
@ CCF_SimilarTypeMatch
Divide by this factor when a code-completion result's type is similar to the type we expect (e....
const FunctionProtoType * T
unsigned getMacroUsagePriority(StringRef MacroName, const LangOptions &LangOpts, bool PreferredTypeIsPointer=false)
Determine the priority to be given to a macro code completion result with the given name.
bool shouldEnforceArgLimit(bool PartialOverloading, FunctionDecl *Function)
llvm::StringRef getAsString(SyncScope S)
@ TSK_Undeclared
This template specialization was formed from a template-id but has not yet been declared,...
std::pair< IdentifierInfo *, SourceLocation > IdentifierLocPair
A simple pair of identifier info and location.
@ Interface
The "__interface" keyword introduces the elaborated-type-specifier.
@ Class
The "class" keyword introduces the elaborated-type-specifier.
@ Enum
The "enum" keyword introduces the elaborated-type-specifier.
@ StartsWithDoubleUnderscore
__UINTPTR_TYPE__ uintptr_t
An unsigned integer type with the property that any valid pointer to void can be converted to this ty...
bool IntegralConstantExpression
SmallVector< Decl *, 4 > IgnoreDecls
CodeCompleteExpressionData(QualType PreferredType=QualType(), bool IsParenthesized=false)
Represents a complete lambda introducer.
SmallVector< LambdaCapture, 4 > Captures
LambdaCaptureDefault Default
a linked list of methods with the same selector name but different signatures.
ObjCMethodDecl * getMethod() const
OverloadCandidate - A single candidate in an overload set (C++ 13.3).
static ArrayRef< const ParsedAttrInfo * > getAllBuiltin()
Describes how types, statements, expressions, and declarations should be printed.
unsigned SuppressUnwrittenScope
Suppress printing parts of scope specifiers that are never written, e.g., for anonymous namespaces.
unsigned AnonymousTagLocations
When printing an anonymous tag name, also print the location of that entity (e.g.,...
unsigned CleanUglifiedParameters
Whether to strip underscores when printing reserved parameter names.
unsigned SuppressStrongLifetime
When true, suppress printing of the __strong lifetime qualifier in ARC.
unsigned SuppressScope
Suppresses printing of scope specifiers.
unsigned SuppressTemplateArgsInCXXConstructors
When true, suppresses printing template arguments in names of C++ constructors.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4