Skip to content

Commit ad89f32

Browse files
committed
Revert change in ext_vector_type bool element access error path, and use a more explicit StringRef constructor
1 parent 1bcf418 commit ad89f32

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

clang/lib/Sema/SemaExprMember.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -435,9 +435,10 @@ CheckExtVectorComponent(Sema &S, QualType baseType, ExprValueKind &VK,
435435
// We didn't get to the end of the string. This means the component names
436436
// didn't come from the same set *or* we encountered an illegal name.
437437
size_t Offset = compStr - CompName->getNameStart() + 1;
438+
char Fmt[3] = {'\'', *compStr, '\''};
438439
S.Diag(OpLoc.getLocWithOffset(Offset),
439440
diag::err_ext_vector_component_name_illegal)
440-
<< StringRef({'\'', *compStr, '\''}) << SourceRange(CompLoc);
441+
<< StringRef(Fmt, 3) << SourceRange(CompLoc);
441442
return QualType();
442443
}
443444

@@ -1657,10 +1658,8 @@ static ExprResult LookupMemberExpr(Sema &S, LookupResult &R,
16571658
// We disallow element access for ext_vector_type bool. There is no way to
16581659
// materialize a reference to a vector element as a pointer (each element is
16591660
// one bit in the vector).
1660-
assert(MemberName.isIdentifier() &&
1661-
"Ext vector component name not an identifier!");
16621661
S.Diag(R.getNameLoc(), diag::err_ext_vector_component_name_illegal)
1663-
<< MemberName.getAsIdentifierInfo()->getName()
1662+
<< MemberName
16641663
<< (BaseExpr.get() ? BaseExpr.get()->getSourceRange() : SourceRange());
16651664
return ExprError();
16661665
}

0 commit comments

Comments
 (0)