[clang] [Clang] add wraps and no_wraps attributes (PR #115094)
Justin Stitt via cfe-commits
cfe-commits at lists.llvm.org
Fri Nov 8 15:34:13 PST 2024
================
@@ -6536,6 +6536,30 @@ static void HandleBTFTypeTagAttribute(QualType &Type, const ParsedAttr &Attr,
::new (Ctx) BTFTypeTagAttr(Ctx, Attr, BTFTypeTag), Type);
}
+static void handleWrapsAttr(QualType &Type, const ParsedAttr &Attr,
+ TypeProcessingState &State, bool NoWraps = false) {
+ Sema &S = State.getSema();
+ ASTContext &Ctx = S.Context;
+
+ // wraps and no_wraps are most useful and consistent when used with C. Other
+ // languages have better alternatives within their type systems.
+ if (S.LangOpts.CPlusPlus || S.LangOpts.ObjC)
----------------
JustinStitt wrote:
I'm relying on the default diagnostic provided from the LangOpt `COnly` in the table gen. The message is the following:
```
test.cc:2:28: warning: 'wraps' attribute ignored [-Wignored-attributes]
2 | typedef int __attribute__((wraps)) wrapping_int;
| ^
1 warning generated.
```
https://github.com/llvm/llvm-project/pull/115094
More information about the cfe-commits
mailing list