[PATCH] D29023: [Stack Protection] Add diagnostic information for why stack protection was applied to a function

Adam Nemet via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 27 14:37:50 PST 2017


anemet accepted this revision.
anemet added a comment.

LGTM with these changes.



================
Comment at: lib/CodeGen/StackProtector.cpp:238
+  auto ReasonStub =
+      Twine("stack protection applied to function " + F->getName() + " due to ")
+          .str();
----------------
Start with upper case.


================
Comment at: lib/CodeGen/StackProtector.cpp:240
+          .str();
+  StringRef RemarkName = "StackProtectorReason";
+
----------------
You want different remark names for these.  That helps calculating statistics on them without parsing the text.


================
Comment at: lib/IR/DiagnosticInfo.cpp:239
+// reference.
+static const BasicBlock &FirstFunctionBlock(const Function *Func) {
+  assert(!Func->empty() && "Function does not have a body");
----------------
Convention is to start function names with a verb, i.e. getFirstFunctionBlock.


================
Comment at: test/CodeGen/X86/stack-protector-remarks.ll:3
+; CHECK-NOT: nossp
+; CHECK-NOT: alloca_fixed_small_nossp
+; CHECK: function attribute_ssp
----------------
This should be two lines down.  (CHECK-NOTs are matches only within the partition set by the neighboring CHECKs.)


https://reviews.llvm.org/D29023





More information about the llvm-commits mailing list