[Sema] Fix a null pointer reference crash.

Differential Revision: https://reviews.llvm.org/D110315
This commit is contained in:
Haojian Wu 2021-09-23 11:01:37 +02:00
parent 828422747d
commit 3778c1cd6e
2 changed files with 4 additions and 1 deletions

View File

@ -14493,7 +14493,7 @@ Decl *Sema::ActOnFinishFunctionBody(Decl *dcl, Stmt *Body,
FunctionScopeInfo *FSI = getCurFunction();
FunctionDecl *FD = dcl ? dcl->getAsFunction() : nullptr;
if (FSI->UsesFPIntrin && !FD->hasAttr<StrictFPAttr>())
if (FSI->UsesFPIntrin && FD && !FD->hasAttr<StrictFPAttr>())
FD->addAttr(StrictFPAttr::CreateImplicit(Context));
sema::AnalysisBasedWarnings::Policy WP = AnalysisWarnings.getDefaultPolicy();

View File

@ -0,0 +1,3 @@
// RUN: %clang_cc1 -fsyntax-only -frounding-math -verify %s
template <class b> b::a() {} // expected-error {{nested name specifier}}