From dd13c56d8c8c29415ada723defc0875b3492cc9e Mon Sep 17 00:00:00 2001 From: yangdian Date: Tue, 21 Feb 2023 15:56:28 +0800 Subject: [PATCH] [BSC] bugfix for nullptr problem --- clang/lib/CodeGen/CodeGenModule.cpp | 2 +- clang/lib/Parse/ParseDecl.cpp | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index 310b3b92939d..0bc0f1ed72e6 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -1154,7 +1154,7 @@ static std::string getMangledNameImpl(const CodeGenModule &CGM, GlobalDecl GD, IdentifierInfo *II = ND->getIdentifier(); assert(II && "Attempt to mangle unnamed decl."); const auto *FD = dyn_cast(ND); - const auto *MD = dyn_cast(FD); + const auto *MD = dyn_cast(ND); if (FD && FD->getType()->castAs()->getCallConv() == CC_X86RegCall) { diff --git a/clang/lib/Parse/ParseDecl.cpp b/clang/lib/Parse/ParseDecl.cpp index 7f4931f5731b..20b40259a8c8 100644 --- a/clang/lib/Parse/ParseDecl.cpp +++ b/clang/lib/Parse/ParseDecl.cpp @@ -2043,14 +2043,15 @@ Parser::DeclGroupPtrTy Parser::ParseDeclGroup(ParsingDeclSpec &DS, SmallVector DeclsInGroup; Decl *FirstDecl = ParseDeclarationAfterDeclaratorAndAttributes( D, ParsedTemplateInfo(), FRI); - if (auto FD = dyn_cast(FirstDecl)) { - FD->setHasThisParam(D.hasThisParam); - } + if (LateParsedAttrs.size() > 0) ParseLexedAttributeList(LateParsedAttrs, FirstDecl, true, false); D.complete(FirstDecl); - if (FirstDecl) + if (FirstDecl) { + if (auto FD = dyn_cast(FirstDecl)) + FD->setHasThisParam(D.hasThisParam); DeclsInGroup.push_back(FirstDecl); + } bool ExpectSemi = Context != DeclaratorContext::ForInit; -- Gitee