forked from OSchip/llvm-project
[OpenMP] Ensure the DefaultMapperId has a location
A user reported an assertion (below) but without a reproducer. I failed to create a test myself but from the assertion one can derive the problem. I set the DefaultMapperId location now to make sure this doesn't cause trouble. ``` clang-13: .../DeclTemplate.h:1940: void clang::ClassTemplateSpecializationDecl::setPointOfInstantiation(clang::SourceLocation): Assertion `Loc.isValid() && "point of instantiation must be valid!"' failed. ``` Reviewed By: JonChesterfield Differential Revision: https://reviews.llvm.org/D100621
This commit is contained in:
parent
5d8d994dfb
commit
3f14596700
|
@ -5578,9 +5578,6 @@ processImplicitMapsWithDefaultMappers(Sema &S, DSAStackTy *Stack,
|
||||||
if (S.getLangOpts().OpenMP < 50)
|
if (S.getLangOpts().OpenMP < 50)
|
||||||
return;
|
return;
|
||||||
SmallVector<OMPClause *, 4> ImplicitMaps;
|
SmallVector<OMPClause *, 4> ImplicitMaps;
|
||||||
DeclarationNameInfo DefaultMapperId;
|
|
||||||
DefaultMapperId.setName(S.Context.DeclarationNames.getIdentifier(
|
|
||||||
&S.Context.Idents.get("default")));
|
|
||||||
for (int Cnt = 0, EndCnt = Clauses.size(); Cnt < EndCnt; ++Cnt) {
|
for (int Cnt = 0, EndCnt = Clauses.size(); Cnt < EndCnt; ++Cnt) {
|
||||||
auto *C = dyn_cast<OMPMapClause>(Clauses[Cnt]);
|
auto *C = dyn_cast<OMPMapClause>(Clauses[Cnt]);
|
||||||
if (!C)
|
if (!C)
|
||||||
|
@ -5636,6 +5633,10 @@ processImplicitMapsWithDefaultMappers(Sema &S, DSAStackTy *Stack,
|
||||||
if (It == Visited.end()) {
|
if (It == Visited.end()) {
|
||||||
// Try to find the associated user-defined mapper.
|
// Try to find the associated user-defined mapper.
|
||||||
CXXScopeSpec MapperIdScopeSpec;
|
CXXScopeSpec MapperIdScopeSpec;
|
||||||
|
DeclarationNameInfo DefaultMapperId;
|
||||||
|
DefaultMapperId.setName(S.Context.DeclarationNames.getIdentifier(
|
||||||
|
&S.Context.Idents.get("default")));
|
||||||
|
DefaultMapperId.setLoc(E->getExprLoc());
|
||||||
ExprResult ER = buildUserDefinedMapperRef(
|
ExprResult ER = buildUserDefinedMapperRef(
|
||||||
S, Stack->getCurScope(), MapperIdScopeSpec, DefaultMapperId,
|
S, Stack->getCurScope(), MapperIdScopeSpec, DefaultMapperId,
|
||||||
BaseType, /*UnresolvedMapper=*/nullptr);
|
BaseType, /*UnresolvedMapper=*/nullptr);
|
||||||
|
|
Loading…
Reference in New Issue