[PATCH] D56734: [MSan] Apply the ctor creation scheme of TSan

Chandler Carruth via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 15 19:12:11 PST 2019


chandlerc accepted this revision.
chandlerc added a comment.
This revision is now accepted and ready to land.

LGTM with some minor cleanups!



================
Comment at: llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp:925
+            /*InitArgTypes=*/{},
+            /*InitArgs=*/{}, [&](Function *Ctor, Function *) {
+              if (ClWithComdat) {
----------------
Add a comment at the start of the lambda to remind the reader that this is used when we are the first to try and get the sanitizer ctor/init function to set it up?


================
Comment at: llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp:931
+                appendToGlobalCtors(M, Ctor, 0, Ctor);
+
+              } else {
----------------
Strange vertical whitespace here... 


================
Comment at: llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp:932-934
+              } else {
+                appendToGlobalCtors(M, Ctor, 0);
+              }
----------------
Instead of this pattern, I'd suggest early exit:

```
if (!ClWithComdat) {
  appendToGlobalCtors(M, cTor, 0);
  return;
}
...
```


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D56734/new/

https://reviews.llvm.org/D56734





More information about the llvm-commits mailing list