[clang] [clang] Allow -fbuiltin to override -ffreestanding (PR #222828)

Joseph Huber via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 11 07:10:56 PDT 2026


https://github.com/jhuber6 commented:

I would expect this to just treat `-ffreestanding` implicitly as `-fno-builtin`. This makes sure we have consistent overriding rules like the other flags, i.e.
```
-ffreestanding -fbuiltin // -fbuiltin overrides
```
```
 -fbuiltin -ffreestanding // -fno-builtin-overrides
```

I would assume the driver to just forward these flags and update this to properly take into account the presence of the positive flag via `getLastArg` or something.
```
 Opts.NoBuiltin = Args.hasArg(OPT_fno_builtin) || Opts.Freestanding;
```

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


More information about the cfe-commits mailing list