[clang] [analyzer] Delay the checker constructions after parsing (PR #127409)

Balazs Benics via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 17 06:34:39 PST 2025


================
@@ -40,17 +40,28 @@ enum class OpenVariant {
   OpenAt
 };
 
+static CachedMacroValue getCreateFlagValue(const ASTContext &Ctx,
+                                           const Preprocessor &PP) {
+  CachedMacroValue MacroVal("O_CREAT", PP);
+  if (MacroVal.hasValue())
+    return MacroVal;
+
+  // If we failed, fall-back to known values.
+  if (Ctx.getTargetInfo().getTriple().getVendor() == llvm::Triple::Apple)
+    return CachedMacroValue{0x0200};
+  return MacroVal;
+}
+
----------------
steakhal wrote:

I'd refrain from generalizing right away. If we see this pattern appear again, we can think about concrete steps reducing the code duplication. So far I don't think it's the time.

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


More information about the cfe-commits mailing list