[clang] [clang] Add per-global code model attribute (PR #72078)
Erich Keane via cfe-commits
cfe-commits at lists.llvm.org
Thu Jan 4 06:49:56 PST 2024
================
@@ -3369,6 +3369,36 @@ 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)
----------------
erichkeane wrote:
You should be able to do away with this entire function. We have target specific checks for our attributes, and you can use the `Enum` type instead for these values.
That makes all of this a simple 'handleSimpleAttribute' instead.
https://github.com/llvm/llvm-project/pull/72078
More information about the cfe-commits
mailing list