[clang] [clang] Add per-global code model attribute (PR #72078)

via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 13 19:22:37 PST 2023


================
@@ -3369,6 +3369,23 @@ static void handleSectionAttr(Sema &S, Decl *D, const ParsedAttr &AL) {
   }
 }
 
+static void handleCodeModelAttr(Sema &S, Decl *D, const ParsedAttr &AL) {
+  StringRef Model;
+  SourceLocation LiteralLoc;
+  // Check that it is a string.
+  if (!S.checkStringLiteralArgumentAttr(AL, 0, Model, &LiteralLoc))
----------------
heiher wrote:

Thank you. I can't reproduce it.

```
t.c:2:29: error: expected string literal as argument of 'model' attribute
    2 | static __attribute__((model(5))) int pcpu;
      |                             ^
1 error generated.
```

```
t.c:2:29: error: code_model must be "tiny", "small", "kernel", "medium" or "large"
    2 | static __attribute__((model("5"))) int pcpu;
      |                             ^
1 error generated.
```

https://github.com/llvm/llvm-project/pull/72078


More information about the cfe-commits mailing list