File tree Expand file tree Collapse file tree 2 files changed +21
-5
lines changed Expand file tree Collapse file tree 2 files changed +21
-5
lines changed Original file line number Diff line number Diff line change @@ -539,13 +539,17 @@ class CollectExtraHighlightings
539
539
if (isa<UserDefinedLiteral>(E))
540
540
return true ;
541
541
542
- // FIXME ...here it would make sense though.
543
- if (isa<CXXOperatorCallExpr>(E))
544
- return true ;
542
+ // FIXME: consider highlighting parameters of some other overloaded
543
+ // operators as well
544
+ llvm::ArrayRef<const Expr *> Args = {E->getArgs (), E->getNumArgs ()};
545
+ if (const auto callOp = dyn_cast<CXXOperatorCallExpr>(E)) {
546
+ if (callOp->getOperator () != OO_Call)
547
+ return true ;
548
+ Args = Args.drop_front (); // Drop object parameter
549
+ }
545
550
546
551
highlightMutableReferenceArguments (
547
- dyn_cast_or_null<FunctionDecl>(E->getCalleeDecl ()),
548
- {E->getArgs (), E->getNumArgs ()});
552
+ dyn_cast_or_null<FunctionDecl>(E->getCalleeDecl ()), Args);
549
553
550
554
return true ;
551
555
}
Original file line number Diff line number Diff line change @@ -738,6 +738,11 @@ sizeof...($TemplateParameter[[Elements]]);
738
738
)cpp" ,
739
739
// Modifier for variables passed as non-const references
740
740
R"cpp(
741
+ struct $Class_decl[[ClassWithOp]] {
742
+ void operator()(int);
743
+ void operator()(int, int &);
744
+ void operator()(int, int, const int &);
745
+ };
741
746
void $Function_decl[[fun]](int, const int,
742
747
int*, const int*,
743
748
int&, const int&,
@@ -759,6 +764,13 @@ sizeof...($TemplateParameter[[Elements]]);
759
764
$LocalVariable[[array]], $LocalVariable_usedAsMutableReference[[array]],
760
765
$LocalVariable[[array]]
761
766
);
767
+ [](int){}($LocalVariable[[val]]);
768
+ [](int&){}($LocalVariable_usedAsMutableReference[[val]]);
769
+ [](const int&){}($LocalVariable[[val]]);
770
+ $Class[[ClassWithOp]] $LocalVariable_decl[[c]];
771
+ $LocalVariable[[c]]($LocalVariable[[val]]);
772
+ $LocalVariable[[c]](0, $LocalVariable_usedAsMutableReference[[val]]);
773
+ $LocalVariable[[c]](0, 0, $LocalVariable[[val]]);
762
774
}
763
775
struct $Class_decl[[S]] {
764
776
$Class_decl[[S]](int&) {
You can’t perform that action at this time.
0 commit comments