[clang] [clang][X86] Support __attribute__((model("small"/"large"))) (PR #124834)
Pranav Kant via cfe-commits
cfe-commits at lists.llvm.org
Tue Jan 28 14:34:45 PST 2025
================
@@ -2949,6 +2950,13 @@ static void handleSectionAttr(Sema &S, Decl *D, const ParsedAttr &AL) {
}
}
+static bool isValidCodeModelAttr(Sema &S, StringRef Str) {
+ bool IsX8664Target =
+ S.Context.getTargetInfo().getTriple().getArch() == llvm::Triple::x86_64;
+ bool IsX8664Spelling = Str == "small" || Str == "large";
+ return IsX8664Target == IsX8664Spelling;
+}
----------------
pranavk wrote:
This is correct but slightly harder to read, I feel. I think just simple if/else wrapping which attributes are valid would be easier to read.
https://github.com/llvm/llvm-project/pull/124834
More information about the cfe-commits
mailing list