[PATCH] D41880: Adding nocf_check attribute for cf-protection fine tuning

Oren Ben Simhon via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 27 02:20:05 PST 2018


oren_ben_simhon marked 3 inline comments as done.
oren_ben_simhon added inline comments.


================
Comment at: lib/Sema/SemaDeclAttr.cpp:1979-1980
+static void handleNoCfCheckAttr(Sema &S, Decl *D, const AttributeList &Attrs) {
+  if (!S.getLangOpts().CFProtectionBranch)
+    S.Diag(Attrs.getLoc(), diag::warn_nocf_check_attribute_ignored);
+  else
----------------
aaron.ballman wrote:
> oren_ben_simhon wrote:
> > aaron.ballman wrote:
> > > Can you use the `LangOpts` field to specify this in Attr.td? Then you can go back to the simple handler.
> > When using LangOpts field in Attr.td, the diagnostic warning will not be descriptive as i use here (use -fcf-protection flag...).
> That's true, and this code is fine for now. However, it does suggest that the declarative handler could be improved to support this sort of thing -- the same issue is present with *all* attributes gated on a language option.
I agree. I believe such a change is out of the scope of the review.


Repository:
  rL LLVM

https://reviews.llvm.org/D41880





More information about the llvm-commits mailing list