@@ -184,7 +184,7 @@ class ResultBuilder {
184
184
185
185
// / Overloaded C++ member functions found by SemaLookup.
186
186
// / Used to determine when one overload is dominated by another.
187
- llvm::DenseMap<std::pair<DeclContext *, /* Name*/ uintptr_t >, ShadowMapEntry>
187
+ llvm::DenseMap<std::pair<DeclContext *, /* Name*/ uintptr_t >, ShadowMapEntry>
188
188
OverloadMap;
189
189
190
190
// / If we're potentially referring to a C++ member function, the set
@@ -1426,16 +1426,16 @@ void ResultBuilder::AddResult(Result R, DeclContext *CurContext,
1426
1426
}
1427
1427
// Detect cases where a ref-qualified method cannot be invoked.
1428
1428
switch (Method->getRefQualifier ()) {
1429
- case RQ_LValue:
1430
- if (ObjectKind != VK_LValue && !MethodQuals.hasConst ())
1431
- return ;
1432
- break ;
1433
- case RQ_RValue:
1434
- if (ObjectKind == VK_LValue)
1435
- return ;
1436
- break ;
1437
- case RQ_None:
1438
- break ;
1429
+ case RQ_LValue:
1430
+ if (ObjectKind != VK_LValue && !MethodQuals.hasConst ())
1431
+ return ;
1432
+ break ;
1433
+ case RQ_RValue:
1434
+ if (ObjectKind == VK_LValue)
1435
+ return ;
1436
+ break ;
1437
+ case RQ_None:
1438
+ break ;
1439
1439
}
1440
1440
1441
1441
// / Check whether this dominates another overloaded method, which should
@@ -1483,9 +1483,7 @@ void ResultBuilder::AddResult(Result R) {
1483
1483
void ResultBuilder::EnterNewScope () { ShadowMaps.emplace_back (); }
1484
1484
1485
1485
// / Exit from the current scope.
1486
- void ResultBuilder::ExitScope () {
1487
- ShadowMaps.pop_back ();
1488
- }
1486
+ void ResultBuilder::ExitScope () { ShadowMaps.pop_back (); }
1489
1487
1490
1488
// / Determines whether this given declaration will be found by
1491
1489
// / ordinary name lookup.
@@ -2468,7 +2466,8 @@ static void AddOrdinaryNameResults(Sema::ParserCompletionContext CCC, Scope *S,
2468
2466
ReturnType = Method->getReturnType ();
2469
2467
else if (SemaRef.getCurBlock () &&
2470
2468
!SemaRef.getCurBlock ()->ReturnType .isNull ())
2471
- ReturnType = SemaRef.getCurBlock ()->ReturnType ;;
2469
+ ReturnType = SemaRef.getCurBlock ()->ReturnType ;
2470
+ ;
2472
2471
if (ReturnType.isNull () || ReturnType->isVoidType ()) {
2473
2472
Builder.AddTypedTextChunk (" return" );
2474
2473
Builder.AddChunk (CodeCompletionString::CK_SemiColon);
@@ -3294,7 +3293,7 @@ AddFunctionTypeQualsToCompletionString(CodeCompletionBuilder &Result,
3294
3293
}
3295
3294
3296
3295
static void
3297
- AddFunctionExceptSpecToCompletionString (CodeCompletionBuilder &Result ,
3296
+ AddFunctionExceptSpecToCompletionString (std::string &NameAndSignature ,
3298
3297
const FunctionDecl *Function) {
3299
3298
const auto *Proto = Function->getType ()->getAs <FunctionProtoType>();
3300
3299
if (!Proto)
@@ -3304,7 +3303,7 @@ AddFunctionExceptSpecToCompletionString(CodeCompletionBuilder &Result,
3304
3303
switch (ExceptInfo.Type ) {
3305
3304
case EST_BasicNoexcept:
3306
3305
case EST_NoexceptTrue:
3307
- Result. AddInformativeChunk ( " noexcept" ) ;
3306
+ NameAndSignature += " noexcept" ;
3308
3307
break ;
3309
3308
3310
3309
default :
@@ -3527,6 +3526,13 @@ CodeCompletionResult::createCodeCompletionStringForOverride(
3527
3526
std::string NameAndSignature;
3528
3527
// For overrides all chunks go into the result, none are informative.
3529
3528
printOverrideString (*CCS, BeforeName, NameAndSignature);
3529
+
3530
+ // If the virtual function is declared with "noexcept", add it in the result
3531
+ // code completion string.
3532
+ const auto *VirtualFunc = dyn_cast<FunctionDecl>(Declaration);
3533
+ assert (VirtualFunc && " overridden decl must be a function" );
3534
+ AddFunctionExceptSpecToCompletionString (NameAndSignature, VirtualFunc);
3535
+
3530
3536
NameAndSignature += " override" ;
3531
3537
3532
3538
Result.AddTextChunk (Result.getAllocator ().CopyString (BeforeName));
@@ -3580,7 +3586,6 @@ CodeCompletionString *CodeCompletionResult::createCodeCompletionStringForDecl(
3580
3586
AddFunctionParameterChunks (PP, Policy, Function, Result);
3581
3587
Result.AddChunk (CodeCompletionString::CK_RightParen);
3582
3588
AddFunctionTypeQualsToCompletionString (Result, Function);
3583
- AddFunctionExceptSpecToCompletionString (Result, Function);
3584
3589
};
3585
3590
3586
3591
if (const auto *Function = dyn_cast<FunctionDecl>(ND)) {
@@ -3663,7 +3668,6 @@ CodeCompletionString *CodeCompletionResult::createCodeCompletionStringForDecl(
3663
3668
AddFunctionParameterChunks (PP, Policy, Function, Result);
3664
3669
Result.AddChunk (CodeCompletionString::CK_RightParen);
3665
3670
AddFunctionTypeQualsToCompletionString (Result, Function);
3666
- AddFunctionExceptSpecToCompletionString (Result, Function);
3667
3671
return Result.TakeString ();
3668
3672
}
3669
3673
@@ -4770,7 +4774,8 @@ static void AddEnumerators(ResultBuilder &Results, ASTContext &Context,
4770
4774
EnumDecl *Enum, DeclContext *CurContext,
4771
4775
const CoveredEnumerators &Enumerators) {
4772
4776
NestedNameSpecifier *Qualifier = Enumerators.SuggestedQualifier ;
4773
- if (Context.getLangOpts ().CPlusPlus && !Qualifier && Enumerators.Seen .empty ()) {
4777
+ if (Context.getLangOpts ().CPlusPlus && !Qualifier &&
4778
+ Enumerators.Seen .empty ()) {
4774
4779
// If there are no prior enumerators in C++, check whether we have to
4775
4780
// qualify the names of the enumerators that we suggest, because they
4776
4781
// may not be visible in this scope.
@@ -5173,8 +5178,7 @@ AddObjCProperties(const CodeCompletionContext &CCContext,
5173
5178
AllowNullaryMethods, CurContext, AddedProperties,
5174
5179
Results, IsBaseExprStatement, IsClassProperty,
5175
5180
/* InOriginalClass*/ false );
5176
- } else if (const auto *Category =
5177
- dyn_cast<ObjCCategoryDecl>(Container)) {
5181
+ } else if (const auto *Category = dyn_cast<ObjCCategoryDecl>(Container)) {
5178
5182
// Look through protocols.
5179
5183
for (auto *P : Category->protocols ())
5180
5184
AddObjCProperties (CCContext, P, AllowCategories, AllowNullaryMethods,
@@ -6032,8 +6036,7 @@ void Sema::CodeCompleteCase(Scope *S) {
6032
6036
6033
6037
Expr *CaseVal = Case->getLHS ()->IgnoreParenCasts ();
6034
6038
if (auto *DRE = dyn_cast<DeclRefExpr>(CaseVal))
6035
- if (auto *Enumerator =
6036
- dyn_cast<EnumConstantDecl>(DRE->getDecl ())) {
6039
+ if (auto *Enumerator = dyn_cast<EnumConstantDecl>(DRE->getDecl ())) {
6037
6040
// We look into the AST of the case statement to determine which
6038
6041
// enumerator was named. Alternatively, we could compute the value of
6039
6042
// the integral constant expression, then compare it against the
@@ -8260,11 +8263,10 @@ void Sema::CodeCompleteObjCInstanceMessage(Scope *S, Expr *Receiver,
8260
8263
return ;
8261
8264
RecExpr = Conv.get ();
8262
8265
}
8263
- QualType ReceiverType = RecExpr
8264
- ? RecExpr->getType ()
8265
- : Super ? Context.getObjCObjectPointerType (
8266
- Context.getObjCInterfaceType (Super))
8267
- : Context.getObjCIdType ();
8266
+ QualType ReceiverType = RecExpr ? RecExpr->getType ()
8267
+ : Super ? Context.getObjCObjectPointerType (
8268
+ Context.getObjCInterfaceType (Super))
8269
+ : Context.getObjCIdType ();
8268
8270
8269
8271
// If we're messaging an expression with type "id" or "Class", check
8270
8272
// whether we know something special about the receiver that allows
@@ -10113,8 +10115,7 @@ void Sema::CodeCompleteIncludedFile(llvm::StringRef Dir, bool Angled) {
10113
10115
};
10114
10116
10115
10117
// Helper: scans IncludeDir for nice files, and adds results for each.
10116
- auto AddFilesFromIncludeDir = [&](StringRef IncludeDir,
10117
- bool IsSystem,
10118
+ auto AddFilesFromIncludeDir = [&](StringRef IncludeDir, bool IsSystem,
10118
10119
DirectoryLookup::LookupType_t LookupType) {
10119
10120
llvm::SmallString<128 > Dir = IncludeDir;
10120
10121
if (!NativeRelDir.empty ()) {
0 commit comments