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

James Henderson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 27 03:10:19 PST 2017


jhenderson marked an inline comment as done.
jhenderson added inline comments.


================
Comment at: lib/CodeGen/StackProtector.cpp:239
+      "stack protection applied to function " + F->getName() + " due to ";
+  StringRef RemarkName = "stack-protector-reason";
+
----------------
anemet wrote:
> Convention for this is camel-case: StackProtectorReason.  I think it's documented in the comments. If not feel free to add it.
Done. Turns out it was commented in one place, but not in the place I used. I've added it to every instance.


================
Comment at: lib/CodeGen/StackProtector.cpp:245
+          OptimizationRemark(DEBUG_TYPE, RemarkName, F->getSubprogram(), &F->front())
+          << (ReasonStub + "a function attribute or command-line switch").str());
     NeedsProtector = true;
----------------
anemet wrote:
> You can just << these one by one:
> 
>  << ReasonStub << "a func... ";
Done. I originally used this because the operator<< is not overloaded for Twine arguments, so I assumed it would be better to concatenate them together first.


https://reviews.llvm.org/D29023





More information about the llvm-commits mailing list