Skip to content

Commit

Permalink
Support some splice, note that attributes_of(^^[[ is buggy from this …
Browse files Browse the repository at this point in the history
…commit on

Stash interim splice

Stash interim splice
  • Loading branch information
zebullon committed Oct 27, 2024
1 parent 83ff0f3 commit 59135b3
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions clang/lib/Parse/ParseDeclCXX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5059,10 +5059,14 @@ bool Parser::tryParseSpliceAttrSpecifier(ParsedAttributes &Attrs,
if (!Tok.is(tok::annot_splice)) {
return true;
}
Diag(Tok.getLocation(), diag::p3385_trace_execution_checkpoint)
<< "Found splice in attribute expression";
SourceLocation loc = (Tok.getLocation());
SourceRange range(loc);
ExprResult Result = getExprAnnotation(Tok);
ConsumeAnnotationToken();

// TODO should be an ActOnBlablabla()
// TODO export to ActOnBlablabla() is the `iDiOmAtIc WaY`
//
auto *SpliceExpr = cast<CXXSpliceSpecifierExpr>(Result.get());
Expr::EvalResult ER;
Expand All @@ -5073,16 +5077,21 @@ bool Parser::tryParseSpliceAttrSpecifier(ParsedAttributes &Attrs,
switch (ER.Val.getReflectionKind()) {
case ReflectionKind::Attribute: {
auto * attr = ER.Val.getReflectedAttribute();
Diag(Tok.getLocation(), diag::p3385_trace_execution_checkpoint)
<< attr->getAttrName();

Attrs.addNew(
const_cast<IdentifierInfo*>(attr->getAttrName()), // (C) Trust me bro
range,
nullptr, loc, nullptr, 0,
ParsedAttr::Form::CXX11());
break;
}
default:
Diag(Tok.getLocation(), diag::p3385_err_attribute_splicing_error)
<< "unsupported kind in attribute splicing";
}

// Finish with consuming close ']' ']'
// FIXME this shouldnt be here... but we early quit ParseCXX11AttributeSpecifierInternal
// Finish with consuming close ']' ']
SourceLocation CloseLoc = Tok.getLocation();
if (ExpectAndConsume(tok::r_square))
SkipUntil(tok::r_square);
Expand Down

0 comments on commit 59135b3

Please sign in to comment.