forked from OSchip/llvm-project
[AST] Add NestedNameSpecifierLoc accessors to node introspection
Differential Revision: https://reviews.llvm.org/D100712
This commit is contained in:
parent
034c73d42e
commit
21ce124e1e
|
@ -21,6 +21,7 @@ struct ClassData {
|
|||
std::vector<std::string> TemplateParms;
|
||||
std::vector<std::string> TypeSourceInfos;
|
||||
std::vector<std::string> TypeLocs;
|
||||
std::vector<std::string> NestedNameLocs;
|
||||
// TODO: Extend this with locations available via typelocs etc.
|
||||
};
|
||||
|
||||
|
|
|
@ -83,6 +83,8 @@ llvm::json::Object toJSON(ClassData const &Obj) {
|
|||
JsonObj["typeSourceInfos"] = Obj.TypeSourceInfos;
|
||||
if (!Obj.TypeLocs.empty())
|
||||
JsonObj["typeLocs"] = Obj.TypeLocs;
|
||||
if (!Obj.NestedNameLocs.empty())
|
||||
JsonObj["nestedNameLocs"] = Obj.NestedNameLocs;
|
||||
return JsonObj;
|
||||
}
|
||||
|
||||
|
@ -218,6 +220,8 @@ void ASTSrcLocProcessor::run(const MatchFinder::MatchResult &Result) {
|
|||
CD.TypeSourceInfos =
|
||||
CaptureMethods("class clang::TypeSourceInfo *", ASTClass, Result);
|
||||
CD.TypeLocs = CaptureMethods("class clang::TypeLoc", ASTClass, Result);
|
||||
CD.NestedNameLocs =
|
||||
CaptureMethods("class clang::NestedNameSpecifierLoc", ASTClass, Result);
|
||||
|
||||
if (const auto *DerivedFrom =
|
||||
Result.Nodes.getNodeAs<clang::CXXRecordDecl>("derivedFrom")) {
|
||||
|
|
|
@ -119,7 +119,8 @@ static void GetLocations{0}(SharedLocationCall const& Prefix,
|
|||
|
||||
self.implementationContent += '\n'
|
||||
|
||||
if 'typeLocs' in ClassData or 'typeSourceInfos' in ClassData:
|
||||
if 'typeLocs' in ClassData or 'typeSourceInfos' in ClassData \
|
||||
or 'nestedNameLocs' in ClassData:
|
||||
if CreateLocalRecursionGuard:
|
||||
self.implementationContent += \
|
||||
'std::vector<clang::TypeLoc> TypeLocRecursionGuard;\n'
|
||||
|
@ -153,6 +154,17 @@ static void GetLocations{0}(SharedLocationCall const& Prefix,
|
|||
|
||||
self.implementationContent += '\n'
|
||||
|
||||
if 'nestedNameLocs' in ClassData:
|
||||
for NN in ClassData['nestedNameLocs']:
|
||||
self.implementationContent += \
|
||||
"""
|
||||
if (Object.{0}())
|
||||
GetLocationsImpl(
|
||||
llvm::makeIntrusiveRefCnt<LocationCall>(Prefix, "{0}"),
|
||||
Object.{0}(), Locs, Rngs, TypeLocRecursionGuard);
|
||||
""".format(NN)
|
||||
|
||||
|
||||
self.implementationContent += '}\n'
|
||||
|
||||
def GenerateFiles(self, OutputFile):
|
||||
|
|
|
@ -210,15 +210,37 @@ ns1::ns2::Foo<A, B> ns1::ns2::Bar<T, U>::Nested::method(int i, bool b) const
|
|||
llvm::sort(ExpectedLocations);
|
||||
|
||||
// clang-format off
|
||||
EXPECT_EQ(
|
||||
llvm::makeArrayRef(ExpectedLocations),
|
||||
(ArrayRef<std::pair<std::string, SourceLocation>>{
|
||||
std::vector<std::pair<std::string, SourceLocation>> ActualLocations{
|
||||
STRING_LOCATION_STDPAIR(MethodDecl, getBeginLoc()),
|
||||
STRING_LOCATION_STDPAIR(MethodDecl, getBodyRBrace()),
|
||||
STRING_LOCATION_STDPAIR(MethodDecl, getEndLoc()),
|
||||
STRING_LOCATION_STDPAIR(MethodDecl, getInnerLocStart()),
|
||||
STRING_LOCATION_STDPAIR(MethodDecl, getLocation()),
|
||||
STRING_LOCATION_STDPAIR(MethodDecl, getOuterLocStart()),
|
||||
STRING_LOCATION_STDPAIR(MethodDecl, getQualifierLoc().getBeginLoc()),
|
||||
STRING_LOCATION_STDPAIR(MethodDecl, getQualifierLoc().getEndLoc()),
|
||||
STRING_LOCATION_STDPAIR(MethodDecl, getQualifierLoc().getLocalBeginLoc()),
|
||||
STRING_LOCATION_STDPAIR(MethodDecl, getQualifierLoc().getLocalEndLoc()),
|
||||
STRING_LOCATION_STDPAIR(MethodDecl, getQualifierLoc().getPrefix().getBeginLoc()),
|
||||
STRING_LOCATION_STDPAIR(MethodDecl, getQualifierLoc().getPrefix().getEndLoc()),
|
||||
STRING_LOCATION_STDPAIR(MethodDecl, getQualifierLoc().getPrefix().getLocalBeginLoc()),
|
||||
STRING_LOCATION_STDPAIR(MethodDecl, getQualifierLoc().getPrefix().getLocalEndLoc()),
|
||||
STRING_LOCATION_STDPAIR(MethodDecl, getQualifierLoc().getPrefix().getPrefix().getBeginLoc()),
|
||||
STRING_LOCATION_STDPAIR(MethodDecl, getQualifierLoc().getPrefix().getPrefix().getEndLoc()),
|
||||
STRING_LOCATION_STDPAIR(MethodDecl, getQualifierLoc().getPrefix().getPrefix().getLocalBeginLoc()),
|
||||
STRING_LOCATION_STDPAIR(MethodDecl, getQualifierLoc().getPrefix().getPrefix().getLocalEndLoc()),
|
||||
STRING_LOCATION_STDPAIR(MethodDecl, getQualifierLoc().getPrefix().getPrefix().getPrefix().getBeginLoc()),
|
||||
STRING_LOCATION_STDPAIR(MethodDecl, getQualifierLoc().getPrefix().getPrefix().getPrefix().getEndLoc()),
|
||||
STRING_LOCATION_STDPAIR(MethodDecl, getQualifierLoc().getPrefix().getPrefix().getPrefix().getLocalBeginLoc()),
|
||||
STRING_LOCATION_STDPAIR(MethodDecl, getQualifierLoc().getPrefix().getPrefix().getPrefix().getLocalEndLoc()),
|
||||
STRING_LOCATION_STDPAIR(MethodDecl, getQualifierLoc().getPrefix().getTypeLoc().getAs<clang::TemplateSpecializationTypeLoc>().getLAngleLoc()),
|
||||
STRING_LOCATION_STDPAIR(MethodDecl, getQualifierLoc().getPrefix().getTypeLoc().getAs<clang::TemplateSpecializationTypeLoc>().getRAngleLoc()),
|
||||
STRING_LOCATION_STDPAIR(MethodDecl, getQualifierLoc().getPrefix().getTypeLoc().getAs<clang::TemplateSpecializationTypeLoc>().getTemplateNameLoc()),
|
||||
STRING_LOCATION_STDPAIR(MethodDecl, getQualifierLoc().getPrefix().getTypeLoc().getBeginLoc()),
|
||||
STRING_LOCATION_STDPAIR(MethodDecl, getQualifierLoc().getPrefix().getTypeLoc().getEndLoc()),
|
||||
STRING_LOCATION_STDPAIR(MethodDecl, getQualifierLoc().getTypeLoc().getAs<clang::TypeSpecTypeLoc>().getNameLoc()),
|
||||
STRING_LOCATION_STDPAIR(MethodDecl, getQualifierLoc().getTypeLoc().getBeginLoc()),
|
||||
STRING_LOCATION_STDPAIR(MethodDecl, getQualifierLoc().getTypeLoc().getEndLoc()),
|
||||
STRING_LOCATION_STDPAIR(MethodDecl, getTypeSourceInfo()->getTypeLoc().getAs<clang::FunctionTypeLoc>().getLParenLoc()),
|
||||
STRING_LOCATION_STDPAIR(MethodDecl, getTypeSourceInfo()->getTypeLoc().getAs<clang::FunctionTypeLoc>().getLocalRangeBegin()),
|
||||
STRING_LOCATION_STDPAIR(MethodDecl, getTypeSourceInfo()->getTypeLoc().getAs<clang::FunctionTypeLoc>().getLocalRangeEnd()),
|
||||
|
@ -228,6 +250,14 @@ STRING_LOCATION_STDPAIR(MethodDecl, getTypeSourceInfo()->getTypeLoc().getAs<clan
|
|||
STRING_LOCATION_STDPAIR(MethodDecl, getTypeSourceInfo()->getTypeLoc().getAs<clang::FunctionTypeLoc>().getReturnLoc().getAs<clang::ElaboratedTypeLoc>().getNamedTypeLoc().getAs<clang::TemplateSpecializationTypeLoc>().getTemplateNameLoc()),
|
||||
STRING_LOCATION_STDPAIR(MethodDecl, getTypeSourceInfo()->getTypeLoc().getAs<clang::FunctionTypeLoc>().getReturnLoc().getAs<clang::ElaboratedTypeLoc>().getNamedTypeLoc().getBeginLoc()),
|
||||
STRING_LOCATION_STDPAIR(MethodDecl, getTypeSourceInfo()->getTypeLoc().getAs<clang::FunctionTypeLoc>().getReturnLoc().getAs<clang::ElaboratedTypeLoc>().getNamedTypeLoc().getEndLoc()),
|
||||
STRING_LOCATION_STDPAIR(MethodDecl, getTypeSourceInfo()->getTypeLoc().getAs<clang::FunctionTypeLoc>().getReturnLoc().getAs<clang::ElaboratedTypeLoc>().getQualifierLoc().getBeginLoc()),
|
||||
STRING_LOCATION_STDPAIR(MethodDecl, getTypeSourceInfo()->getTypeLoc().getAs<clang::FunctionTypeLoc>().getReturnLoc().getAs<clang::ElaboratedTypeLoc>().getQualifierLoc().getEndLoc()),
|
||||
STRING_LOCATION_STDPAIR(MethodDecl, getTypeSourceInfo()->getTypeLoc().getAs<clang::FunctionTypeLoc>().getReturnLoc().getAs<clang::ElaboratedTypeLoc>().getQualifierLoc().getLocalBeginLoc()),
|
||||
STRING_LOCATION_STDPAIR(MethodDecl, getTypeSourceInfo()->getTypeLoc().getAs<clang::FunctionTypeLoc>().getReturnLoc().getAs<clang::ElaboratedTypeLoc>().getQualifierLoc().getLocalEndLoc()),
|
||||
STRING_LOCATION_STDPAIR(MethodDecl, getTypeSourceInfo()->getTypeLoc().getAs<clang::FunctionTypeLoc>().getReturnLoc().getAs<clang::ElaboratedTypeLoc>().getQualifierLoc().getPrefix().getBeginLoc()),
|
||||
STRING_LOCATION_STDPAIR(MethodDecl, getTypeSourceInfo()->getTypeLoc().getAs<clang::FunctionTypeLoc>().getReturnLoc().getAs<clang::ElaboratedTypeLoc>().getQualifierLoc().getPrefix().getEndLoc()),
|
||||
STRING_LOCATION_STDPAIR(MethodDecl, getTypeSourceInfo()->getTypeLoc().getAs<clang::FunctionTypeLoc>().getReturnLoc().getAs<clang::ElaboratedTypeLoc>().getQualifierLoc().getPrefix().getLocalBeginLoc()),
|
||||
STRING_LOCATION_STDPAIR(MethodDecl, getTypeSourceInfo()->getTypeLoc().getAs<clang::FunctionTypeLoc>().getReturnLoc().getAs<clang::ElaboratedTypeLoc>().getQualifierLoc().getPrefix().getLocalEndLoc()),
|
||||
STRING_LOCATION_STDPAIR(MethodDecl, getTypeSourceInfo()->getTypeLoc().getAs<clang::FunctionTypeLoc>().getReturnLoc().getBeginLoc()),
|
||||
STRING_LOCATION_STDPAIR(MethodDecl, getTypeSourceInfo()->getTypeLoc().getAs<clang::FunctionTypeLoc>().getReturnLoc().getEndLoc()),
|
||||
STRING_LOCATION_STDPAIR(MethodDecl, getTypeSourceInfo()->getTypeLoc().getAs<clang::FunctionTypeLoc>().getReturnLoc().getNextTypeLoc().getAs<clang::TemplateSpecializationTypeLoc>().getLAngleLoc()),
|
||||
|
@ -242,6 +272,14 @@ STRING_LOCATION_STDPAIR(MethodDecl, getTypeSourceInfo()->getTypeLoc().getNextTyp
|
|||
STRING_LOCATION_STDPAIR(MethodDecl, getTypeSourceInfo()->getTypeLoc().getNextTypeLoc().getAs<clang::ElaboratedTypeLoc>().getNamedTypeLoc().getAs<clang::TemplateSpecializationTypeLoc>().getTemplateNameLoc()),
|
||||
STRING_LOCATION_STDPAIR(MethodDecl, getTypeSourceInfo()->getTypeLoc().getNextTypeLoc().getAs<clang::ElaboratedTypeLoc>().getNamedTypeLoc().getBeginLoc()),
|
||||
STRING_LOCATION_STDPAIR(MethodDecl, getTypeSourceInfo()->getTypeLoc().getNextTypeLoc().getAs<clang::ElaboratedTypeLoc>().getNamedTypeLoc().getEndLoc()),
|
||||
STRING_LOCATION_STDPAIR(MethodDecl, getTypeSourceInfo()->getTypeLoc().getNextTypeLoc().getAs<clang::ElaboratedTypeLoc>().getQualifierLoc().getBeginLoc()),
|
||||
STRING_LOCATION_STDPAIR(MethodDecl, getTypeSourceInfo()->getTypeLoc().getNextTypeLoc().getAs<clang::ElaboratedTypeLoc>().getQualifierLoc().getEndLoc()),
|
||||
STRING_LOCATION_STDPAIR(MethodDecl, getTypeSourceInfo()->getTypeLoc().getNextTypeLoc().getAs<clang::ElaboratedTypeLoc>().getQualifierLoc().getLocalBeginLoc()),
|
||||
STRING_LOCATION_STDPAIR(MethodDecl, getTypeSourceInfo()->getTypeLoc().getNextTypeLoc().getAs<clang::ElaboratedTypeLoc>().getQualifierLoc().getLocalEndLoc()),
|
||||
STRING_LOCATION_STDPAIR(MethodDecl, getTypeSourceInfo()->getTypeLoc().getNextTypeLoc().getAs<clang::ElaboratedTypeLoc>().getQualifierLoc().getPrefix().getBeginLoc()),
|
||||
STRING_LOCATION_STDPAIR(MethodDecl, getTypeSourceInfo()->getTypeLoc().getNextTypeLoc().getAs<clang::ElaboratedTypeLoc>().getQualifierLoc().getPrefix().getEndLoc()),
|
||||
STRING_LOCATION_STDPAIR(MethodDecl, getTypeSourceInfo()->getTypeLoc().getNextTypeLoc().getAs<clang::ElaboratedTypeLoc>().getQualifierLoc().getPrefix().getLocalBeginLoc()),
|
||||
STRING_LOCATION_STDPAIR(MethodDecl, getTypeSourceInfo()->getTypeLoc().getNextTypeLoc().getAs<clang::ElaboratedTypeLoc>().getQualifierLoc().getPrefix().getLocalEndLoc()),
|
||||
STRING_LOCATION_STDPAIR(MethodDecl, getTypeSourceInfo()->getTypeLoc().getNextTypeLoc().getBeginLoc()),
|
||||
STRING_LOCATION_STDPAIR(MethodDecl, getTypeSourceInfo()->getTypeLoc().getNextTypeLoc().getEndLoc()),
|
||||
STRING_LOCATION_STDPAIR(MethodDecl, getTypeSourceInfo()->getTypeLoc().getNextTypeLoc().getNextTypeLoc().getAs<clang::TemplateSpecializationTypeLoc>().getLAngleLoc()),
|
||||
|
@ -251,9 +289,11 @@ STRING_LOCATION_STDPAIR(MethodDecl, getTypeSourceInfo()->getTypeLoc().getNextTyp
|
|||
STRING_LOCATION_STDPAIR(MethodDecl, getTypeSourceInfo()->getTypeLoc().getNextTypeLoc().getNextTypeLoc().getEndLoc()),
|
||||
STRING_LOCATION_STDPAIR(MethodDecl, getTypeSpecEndLoc()),
|
||||
STRING_LOCATION_STDPAIR(MethodDecl, getTypeSpecStartLoc())
|
||||
}));
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
EXPECT_EQ(ExpectedLocations, ActualLocations);
|
||||
|
||||
auto ExpectedRanges = FormatExpected<SourceRange>(Result.RangeAccessors);
|
||||
|
||||
llvm::sort(ExpectedRanges, [](const auto &LHS, const auto &RHS) {
|
||||
|
@ -266,12 +306,28 @@ STRING_LOCATION_STDPAIR(MethodDecl, getTypeSpecStartLoc())
|
|||
(ArrayRef<std::pair<std::string, SourceRange>>{
|
||||
STRING_LOCATION_STDPAIR(MethodDecl, getExceptionSpecSourceRange()),
|
||||
STRING_LOCATION_STDPAIR(MethodDecl, getParametersSourceRange()),
|
||||
STRING_LOCATION_STDPAIR(MethodDecl, getQualifierLoc().getLocalSourceRange()),
|
||||
STRING_LOCATION_STDPAIR(MethodDecl, getQualifierLoc().getPrefix().getLocalSourceRange()),
|
||||
STRING_LOCATION_STDPAIR(MethodDecl, getQualifierLoc().getPrefix().getPrefix().getLocalSourceRange()),
|
||||
STRING_LOCATION_STDPAIR(MethodDecl, getQualifierLoc().getPrefix().getPrefix().getPrefix().getLocalSourceRange()),
|
||||
STRING_LOCATION_STDPAIR(MethodDecl, getQualifierLoc().getPrefix().getPrefix().getPrefix().getSourceRange()),
|
||||
STRING_LOCATION_STDPAIR(MethodDecl, getQualifierLoc().getPrefix().getPrefix().getSourceRange()),
|
||||
STRING_LOCATION_STDPAIR(MethodDecl, getQualifierLoc().getPrefix().getSourceRange()),
|
||||
STRING_LOCATION_STDPAIR(MethodDecl, getQualifierLoc().getPrefix().getTypeLoc().getLocalSourceRange()),
|
||||
STRING_LOCATION_STDPAIR(MethodDecl, getQualifierLoc().getPrefix().getTypeLoc().getSourceRange()),
|
||||
STRING_LOCATION_STDPAIR(MethodDecl, getQualifierLoc().getSourceRange()),
|
||||
STRING_LOCATION_STDPAIR(MethodDecl, getQualifierLoc().getTypeLoc().getLocalSourceRange()),
|
||||
STRING_LOCATION_STDPAIR(MethodDecl, getQualifierLoc().getTypeLoc().getSourceRange()),
|
||||
STRING_LOCATION_STDPAIR(MethodDecl, getReturnTypeSourceRange()),
|
||||
STRING_LOCATION_STDPAIR(MethodDecl, getSourceRange()),
|
||||
STRING_LOCATION_STDPAIR(MethodDecl, getTypeSourceInfo()->getTypeLoc().getAs<clang::FunctionTypeLoc>().getExceptionSpecRange()),
|
||||
STRING_LOCATION_STDPAIR(MethodDecl, getTypeSourceInfo()->getTypeLoc().getAs<clang::FunctionTypeLoc>().getParensRange()),
|
||||
STRING_LOCATION_STDPAIR(MethodDecl, getTypeSourceInfo()->getTypeLoc().getAs<clang::FunctionTypeLoc>().getReturnLoc().getAs<clang::ElaboratedTypeLoc>().getNamedTypeLoc().getLocalSourceRange()),
|
||||
STRING_LOCATION_STDPAIR(MethodDecl, getTypeSourceInfo()->getTypeLoc().getAs<clang::FunctionTypeLoc>().getReturnLoc().getAs<clang::ElaboratedTypeLoc>().getNamedTypeLoc().getSourceRange()),
|
||||
STRING_LOCATION_STDPAIR(MethodDecl, getTypeSourceInfo()->getTypeLoc().getAs<clang::FunctionTypeLoc>().getReturnLoc().getAs<clang::ElaboratedTypeLoc>().getQualifierLoc().getLocalSourceRange()),
|
||||
STRING_LOCATION_STDPAIR(MethodDecl, getTypeSourceInfo()->getTypeLoc().getAs<clang::FunctionTypeLoc>().getReturnLoc().getAs<clang::ElaboratedTypeLoc>().getQualifierLoc().getPrefix().getLocalSourceRange()),
|
||||
STRING_LOCATION_STDPAIR(MethodDecl, getTypeSourceInfo()->getTypeLoc().getAs<clang::FunctionTypeLoc>().getReturnLoc().getAs<clang::ElaboratedTypeLoc>().getQualifierLoc().getPrefix().getSourceRange()),
|
||||
STRING_LOCATION_STDPAIR(MethodDecl, getTypeSourceInfo()->getTypeLoc().getAs<clang::FunctionTypeLoc>().getReturnLoc().getAs<clang::ElaboratedTypeLoc>().getQualifierLoc().getSourceRange()),
|
||||
STRING_LOCATION_STDPAIR(MethodDecl, getTypeSourceInfo()->getTypeLoc().getAs<clang::FunctionTypeLoc>().getReturnLoc().getLocalSourceRange()),
|
||||
STRING_LOCATION_STDPAIR(MethodDecl, getTypeSourceInfo()->getTypeLoc().getAs<clang::FunctionTypeLoc>().getReturnLoc().getNextTypeLoc().getLocalSourceRange()),
|
||||
STRING_LOCATION_STDPAIR(MethodDecl, getTypeSourceInfo()->getTypeLoc().getAs<clang::FunctionTypeLoc>().getReturnLoc().getNextTypeLoc().getSourceRange()),
|
||||
|
@ -279,6 +335,10 @@ STRING_LOCATION_STDPAIR(MethodDecl, getTypeSourceInfo()->getTypeLoc().getAs<clan
|
|||
STRING_LOCATION_STDPAIR(MethodDecl, getTypeSourceInfo()->getTypeLoc().getLocalSourceRange()),
|
||||
STRING_LOCATION_STDPAIR(MethodDecl, getTypeSourceInfo()->getTypeLoc().getNextTypeLoc().getAs<clang::ElaboratedTypeLoc>().getNamedTypeLoc().getLocalSourceRange()),
|
||||
STRING_LOCATION_STDPAIR(MethodDecl, getTypeSourceInfo()->getTypeLoc().getNextTypeLoc().getAs<clang::ElaboratedTypeLoc>().getNamedTypeLoc().getSourceRange()),
|
||||
STRING_LOCATION_STDPAIR(MethodDecl, getTypeSourceInfo()->getTypeLoc().getNextTypeLoc().getAs<clang::ElaboratedTypeLoc>().getQualifierLoc().getLocalSourceRange()),
|
||||
STRING_LOCATION_STDPAIR(MethodDecl, getTypeSourceInfo()->getTypeLoc().getNextTypeLoc().getAs<clang::ElaboratedTypeLoc>().getQualifierLoc().getPrefix().getLocalSourceRange()),
|
||||
STRING_LOCATION_STDPAIR(MethodDecl, getTypeSourceInfo()->getTypeLoc().getNextTypeLoc().getAs<clang::ElaboratedTypeLoc>().getQualifierLoc().getPrefix().getSourceRange()),
|
||||
STRING_LOCATION_STDPAIR(MethodDecl, getTypeSourceInfo()->getTypeLoc().getNextTypeLoc().getAs<clang::ElaboratedTypeLoc>().getQualifierLoc().getSourceRange()),
|
||||
STRING_LOCATION_STDPAIR(MethodDecl, getTypeSourceInfo()->getTypeLoc().getNextTypeLoc().getLocalSourceRange()),
|
||||
STRING_LOCATION_STDPAIR(MethodDecl, getTypeSourceInfo()->getTypeLoc().getNextTypeLoc().getNextTypeLoc().getLocalSourceRange()),
|
||||
STRING_LOCATION_STDPAIR(MethodDecl, getTypeSourceInfo()->getTypeLoc().getNextTypeLoc().getNextTypeLoc().getSourceRange()),
|
||||
|
@ -317,23 +377,31 @@ void ns::A::foo() {}
|
|||
auto ExpectedLocations =
|
||||
FormatExpected<SourceLocation>(Result.LocationAccessors);
|
||||
|
||||
EXPECT_THAT(
|
||||
ExpectedLocations,
|
||||
UnorderedElementsAre(
|
||||
STRING_LOCATION_PAIR(NNS, getBeginLoc()),
|
||||
STRING_LOCATION_PAIR(NNS, getEndLoc()),
|
||||
STRING_LOCATION_PAIR(NNS, getLocalBeginLoc()),
|
||||
STRING_LOCATION_PAIR(NNS, getLocalEndLoc()),
|
||||
STRING_LOCATION_PAIR(
|
||||
llvm::sort(ExpectedLocations);
|
||||
|
||||
EXPECT_EQ(
|
||||
llvm::makeArrayRef(ExpectedLocations),
|
||||
(ArrayRef<std::pair<std::string, SourceLocation>>{
|
||||
STRING_LOCATION_STDPAIR(NNS, getBeginLoc()),
|
||||
STRING_LOCATION_STDPAIR(NNS, getEndLoc()),
|
||||
STRING_LOCATION_STDPAIR(NNS, getLocalBeginLoc()),
|
||||
STRING_LOCATION_STDPAIR(NNS, getLocalEndLoc()),
|
||||
STRING_LOCATION_STDPAIR(NNS, getPrefix().getBeginLoc()),
|
||||
STRING_LOCATION_STDPAIR(NNS, getPrefix().getEndLoc()),
|
||||
STRING_LOCATION_STDPAIR(NNS, getPrefix().getLocalBeginLoc()),
|
||||
STRING_LOCATION_STDPAIR(NNS, getPrefix().getLocalEndLoc()),
|
||||
STRING_LOCATION_STDPAIR(
|
||||
NNS, getTypeLoc().getAs<clang::TypeSpecTypeLoc>().getNameLoc()),
|
||||
STRING_LOCATION_PAIR(NNS, getTypeLoc().getBeginLoc()),
|
||||
STRING_LOCATION_PAIR(NNS, getTypeLoc().getEndLoc())));
|
||||
STRING_LOCATION_STDPAIR(NNS, getTypeLoc().getBeginLoc()),
|
||||
STRING_LOCATION_STDPAIR(NNS, getTypeLoc().getEndLoc())}));
|
||||
|
||||
auto ExpectedRanges = FormatExpected<SourceRange>(Result.RangeAccessors);
|
||||
|
||||
EXPECT_THAT(
|
||||
ExpectedRanges,
|
||||
UnorderedElementsAre(
|
||||
STRING_LOCATION_PAIR(NNS, getPrefix().getLocalSourceRange()),
|
||||
STRING_LOCATION_PAIR(NNS, getPrefix().getSourceRange()),
|
||||
STRING_LOCATION_PAIR(NNS, getLocalSourceRange()),
|
||||
STRING_LOCATION_PAIR(NNS, getSourceRange()),
|
||||
STRING_LOCATION_PAIR(NNS, getTypeLoc().getSourceRange()),
|
||||
|
|
Loading…
Reference in New Issue