summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/AST/DeclPrinter.cpp2
-rw-r--r--clang/lib/Sema/SemaDecl.cpp4
2 files changed, 5 insertions, 1 deletions
diff --git a/clang/lib/AST/DeclPrinter.cpp b/clang/lib/AST/DeclPrinter.cpp
index 589cdeca8af..e5bf59f8f93 100644
--- a/clang/lib/AST/DeclPrinter.cpp
+++ b/clang/lib/AST/DeclPrinter.cpp
@@ -335,6 +335,8 @@ void DeclPrinter::VisitFunctionDecl(FunctionDecl *D) {
}
Proto += ")";
+ if (D->hasAttr<NoReturnAttr>())
+ Proto += " __attribute((noreturn))";
if (CXXConstructorDecl *CDecl = dyn_cast<CXXConstructorDecl>(D)) {
if (CDecl->getNumBaseOrMemberInitializers() > 0) {
Proto += " : ";
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index bf2d3ccec26..d168a907a09 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -3705,7 +3705,9 @@ void Sema::AddKnownFunctionAttributes(FunctionDecl *FD) {
if (!FD->getAttr<FormatAttr>())
FD->addAttr(::new (Context) FormatAttr("printf", 2,
Name->isStr("vasprintf") ? 0 : 3));
- }
+ } else if (Name->isStr("longjmp") &&
+ !FD->hasAttr<NoReturnAttr>())
+ FD->addAttr(::new (Context) NoReturnAttr());
}
TypedefDecl *Sema::ParseTypedefDecl(Scope *S, Declarator &D, QualType T) {
OpenPOWER on IntegriCloud