================ @@ -5311,6 +5313,90 @@ void Parser::ParseMicrosoftUuidAttributeArgs(ParsedAttributes &Attrs) { } } +void Parser::ParseMicrosoftRootSignatureAttributeArgs(ParsedAttributes &Attrs) { + assert(Tok.is(tok::identifier) && + "Expected an identifier to denote which MS attribute to consider"); + IdentifierInfo *RootSignatureIdent = Tok.getIdentifierInfo(); + assert(RootSignatureIdent->getName() == "RootSignature" && + "Expected RootSignature identifier for root signature attribute"); + + SourceLocation RootSignatureLoc = Tok.getLocation(); + ConsumeToken(); + + // Ignore the left paren location for now. + BalancedDelimiterTracker T(*this, tok::l_paren); + if (T.consumeOpen()) { + Diag(Tok, diag::err_expected) << tok::l_paren; + return; + } + + auto ProcessStringLiteral = [this]() -> std::optional<StringLiteral *> { + if (!isTokenStringLiteral()) + return std::nullopt; + + ExprResult StringResult = ParseUnevaluatedStringLiteralExpression(); + if (StringResult.isInvalid()) + return std::nullopt; + + if (auto Lit = dyn_cast<StringLiteral>(StringResult.get())) + return Lit; + + return std::nullopt; + }; + + auto StrLiteral = ProcessStringLiteral(); + if (!StrLiteral.has_value()) { + Diag(Tok, diag::err_expected_string_literal) + << /*in attributes...*/ 4 << RootSignatureIdent->getName(); + SkipUntil(tok::r_paren, StopAtSemi | StopBeforeMatch); + T.consumeClose(); + return; + } + + // Construct our identifier + StringRef Signature = StrLiteral.value()->getString(); ---------------- inbelic wrote:
I have created an issue to track this here: https://github.com/llvm/llvm-project/issues/142834. In the issue is the proposed solution and we can have the discussion there about correctness. https://github.com/llvm/llvm-project/pull/137690 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits