diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2011-10-12 19:51:18 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2011-10-12 19:51:18 +0000 |
commit | 6700415542121e2cb7d867728046ffa21e402019 (patch) | |
tree | c45b4afdda68460a0ca4054cd8180fe78c605ab2 /lib/Sema/SemaDecl.cpp | |
parent | d768150ef57f617c8d9fef48f3c92e8f21698024 (diff) |
Add returns_twice to functions that are known to return twice. This implements
the same behavior of gcc by keeping the attribute out of the function type.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141803 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaDecl.cpp')
-rw-r--r-- | lib/Sema/SemaDecl.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp index d19023d045..8e2ff5ca88 100644 --- a/lib/Sema/SemaDecl.cpp +++ b/lib/Sema/SemaDecl.cpp @@ -7263,6 +7263,9 @@ void Sema::AddKnownFunctionAttributes(FunctionDecl *FD) { FD->addAttr(::new (Context) ConstAttr(FD->getLocation(), Context)); } + if (Context.BuiltinInfo.isReturnsTwice(BuiltinID) && + !FD->getAttr<ReturnsTwiceAttr>()) + FD->addAttr(::new (Context) ReturnsTwiceAttr(FD->getLocation(), Context)); if (Context.BuiltinInfo.isNoThrow(BuiltinID) && !FD->getAttr<NoThrowAttr>()) FD->addAttr(::new (Context) NoThrowAttr(FD->getLocation(), Context)); if (Context.BuiltinInfo.isConst(BuiltinID) && !FD->getAttr<ConstAttr>()) |