From feb1945fee429064f47c4edff45667c036ef01a6 Mon Sep 17 00:00:00 2001 From: Mike Stump Date: Tue, 15 Dec 2009 03:11:10 +0000 Subject: This patch should fix PR2461. It allows clang to apply the noreturn attribute to function pointers. It also fixes Sema to check function pointers for the noreturn attribute when checking for fallthrough. Patch by Chip Davis, with a slight fix to pass the testsuite. llvm-svn: 91408 --- clang/lib/Sema/SemaDecl.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'clang/lib/Sema/SemaDecl.cpp') diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp index 64305b443ec..14d2377784d 100644 --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/lib/Sema/SemaDecl.cpp @@ -1265,11 +1265,10 @@ Sema::ControlFlowKind Sema::CheckFallThrough(Stmt *Root) { NoReturnEdge = true; HasFakeEdge = true; } else if (DeclRefExpr *DRE = dyn_cast(CEE)) { - if (FunctionDecl *FD = dyn_cast(DRE->getDecl())) { - if (FD->hasAttr()) { - NoReturnEdge = true; - HasFakeEdge = true; - } + ValueDecl *VD = DRE->getDecl(); + if (VD->hasAttr()) { + NoReturnEdge = true; + HasFakeEdge = true; } } } -- cgit v1.2.3