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

WÁNG Xuěruì via cfe-commits cfe-commits at lists.llvm.org
Mon Dec 4 23:33:46 PST 2023


================
@@ -3369,6 +3369,33 @@ static void handleSectionAttr(Sema &S, Decl *D, const ParsedAttr &AL) {
   }
 }
 
+static void handleCodeModelAttr(Sema &S, Decl *D, const ParsedAttr &AL) {
+  StringRef CM;
+  StringRef Str;
+  SourceLocation LiteralLoc;
+  bool Ok = false;
+  // Check that it is a string.
+  if (!S.checkStringLiteralArgumentAttr(AL, 0, Str, &LiteralLoc))
+    return;
+
+  CM = Str;
+  if (S.getASTContext().getTargetInfo().getTriple().isLoongArch()) {
+    Ok = CM == "normal" || CM == "medium" || CM == "extreme";
+    CM = llvm::StringSwitch<StringRef>(CM)
+             .Case("normal", "small")
+             .Case("extreme", "large")
+             .Default(CM);
+  }
+
+  // Check that the value.
----------------
xen0n wrote:

incomplete sentence?

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


More information about the cfe-commits mailing list