This patch implements __attribute__((target("branch-protection=..."))) in a manner, compatible with the analogous GCC feature:
Details
Diff Detail
Event Timeline
You should also update AttrDocs.td for the new feature.
clang/include/clang/Basic/DiagnosticSemaKinds.td | ||
---|---|---|
2595 | Invalid -> invalid should perhaps have '%0' to show what part is invalid? | |
clang/lib/CodeGen/TargetInfo.cpp | ||
5062–5063 | Don't do hasAttr<> followed by getAttr<>, you should do: if (const auto *TA = FD->getAttr<TargetAttr>()) | |
5071 | auto * |
I think this also needs a check to make sure the selected architecture supports PAC/BTI. Gcc gives an unknown target attribute or pragma error if this is used for a non-AArch64 target.
Moved parsing out of Attr.td to TargetInfo, following the example (good or bad) of validateOutputConstraint or validateGlobalregisterVariable ;)
Now issue a warning if attribute is not supported by target, like for other unsupported target options.
clang/lib/Basic/Targets/AArch64.cpp | ||
---|---|---|
106 | This completely duplicates the ParseAArch64BranchProtection function in the driver, could we share one implementation between the command line option and attribute? |
Invalid -> invalid
should perhaps have '%0' to show what part is invalid?