Bug 1435345 - Part 1: Index use sites of overloaded C++ operators. r=emilio

MozReview-Commit-ID: 1nTIGliiQIz

--HG--
extra : rebase_source : 7ec5898035a19ee70409c15a24475d56a9c3bec6
This commit is contained in:
Kartikaya Gupta 2018-02-02 22:39:39 -05:00
Родитель e1d953260f
Коммит fe694732ac
1 изменённых файлов: 12 добавлений и 7 удалений

Просмотреть файл

@ -813,7 +813,8 @@ public:
}
enum {
NoCrossref = 1,
NoCrossref = 1 << 0,
OperatorToken = 1 << 1,
};
// This is the only function that emits analysis JSON data. It should be
@ -836,11 +837,13 @@ public:
std::string RangeStr = locationToString(Loc, EndOffset - StartOffset);
std::string PeekRangeStr;
// Get the token's characters so we can make sure it's a valid token.
const char *StartChars = SM.getCharacterData(Loc);
std::string Text(StartChars, EndOffset - StartOffset);
if (!isValidIdentifier(Text)) {
return;
if (!(Flags & OperatorToken)) {
// Get the token's characters so we can make sure it's a valid token.
const char *StartChars = SM.getCharacterData(Loc);
std::string Text(StartChars, EndOffset - StartOffset);
if (!isValidIdentifier(Text)) {
return;
}
}
FileInfo *F = getFileInfo(Loc);
@ -1184,6 +1187,7 @@ public:
}
std::string Mangled = getMangledName(CurMangleContext, NamedCallee);
int Flags = 0;
Expr *CalleeExpr = E->getCallee()->IgnoreParenImpCasts();
@ -1191,6 +1195,7 @@ public:
// Just take the first token.
CXXOperatorCallExpr *Op = dyn_cast<CXXOperatorCallExpr>(E);
Loc = Op->getOperatorLoc();
Flags |= OperatorToken;
} else if (MemberExpr::classof(CalleeExpr)) {
MemberExpr *Member = dyn_cast<MemberExpr>(CalleeExpr);
Loc = Member->getMemberLoc();
@ -1208,7 +1213,7 @@ public:
}
visitIdentifier("use", "function", getQualifiedName(NamedCallee), Loc, Mangled,
getContext(Loc));
getContext(Loc), Flags);
return true;
}