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

Oren Ben Simhon via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Feb 15 05:16:44 PST 2018


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


================
Comment at: lib/Sema/SemaDeclAttr.cpp:1990
 
-bool Sema::CheckNoReturnAttr(const AttributeList &Attrs) {
-  if (!checkAttributeNumArgs(*this, Attrs, 0)) {
-    Attrs.setInvalid();
+static void handleNoCfCheckAttr(Sema &S, Decl *D, const AttributeList &attr) {
+  if (S.CheckAttrTarget(attr) || S.CheckAttrNoArgs(attr))
----------------
aaron.ballman wrote:
> aaron.ballman wrote:
> > `attr` doesn't follow the proper naming conventions.
> Please don't name the parameter variable after a type -- that can confuse some editors.
I am following the same convention that other functions are using.


================
Comment at: test/Sema/attr-nocf_check.c:18-20
+  FuncPointerWithNoCfCheck fNoCfCheck = f; // no-warning
+  (*fNoCfCheck)();                       // no-warning
+  f = fNoCfCheck;                        // no-warning
----------------
aaron.ballman wrote:
> These are an error in GCC and I think we should match that behavior. https://godbolt.org/g/r3pf4X
I will create a warning however in LLVM we don't create an error upon incompatible pointer due to function attribute types.


Repository:
  rL LLVM

https://reviews.llvm.org/D41880





More information about the cfe-commits mailing list