+ /// @brief Determine if the function cannot return.
+ bool doesNotReturn() const {
+ return getFnAttributes().hasAttribute(Attributes::NoReturn);
+ }
+ void setDoesNotReturn() {
+ addFnAttr(Attributes::NoReturn);
+ }
+
+ /// @brief Determine if the function cannot unwind.
+ bool doesNotThrow() const {
+ return getFnAttributes().hasAttribute(Attributes::NoUnwind);
+ }
+ void setDoesNotThrow() {
+ addFnAttr(Attributes::NoUnwind);
+ }
+
+ /// @brief True if the ABI mandates (or the user requested) that this
+ /// function be in a unwind table.
+ bool hasUWTable() const {
+ return getFnAttributes().hasAttribute(Attributes::UWTable);
+ }
+ void setHasUWTable() {
+ addFnAttr(Attributes::UWTable);
+ }
+
+ /// @brief True if this function needs an unwind table.
+ bool needsUnwindTableEntry() const {
+ return hasUWTable() || !doesNotThrow();
+ }
+
+ /// @brief Determine if the function returns a structure through first
+ /// pointer argument.
+ bool hasStructRetAttr() const {
+ return getParamAttributes(1).hasAttribute(Attributes::StructRet);
+ }
+
+ /// @brief Determine if the parameter does not alias other parameters.
+ /// @param n The parameter to check. 1 is the first parameter, 0 is the return
+ bool doesNotAlias(unsigned n) const {
+ return getParamAttributes(n).hasAttribute(Attributes::NoAlias);
+ }
+ void setDoesNotAlias(unsigned n) {
+ addAttribute(n, Attributes::get(getContext(), Attributes::NoAlias));