[PATCH] D17998: [ELF] implement --warn-common/--no-warn-common

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 9 10:00:18 PST 2016


ruiu added inline comments.

================
Comment at: ELF/Config.h:77
@@ -76,2 +76,3 @@
   bool Verbose;
+  bool WarnCommon = false;
   bool ZExecStack;
----------------
Remove `= false`.

================
Comment at: ELF/Symbols.cpp:145-152
@@ -144,2 +144,10 @@
     return 1;
+
+  if (Config->WarnCommon) {
+    if (isCommon() != Other->isCommon())
+      warning("common " + this->getName() + " is overridden");
+    else if (isCommon())
+      warning("multiple common of " + this->getName());
+  }
+
   if (isCommon()) {
----------------
I wouldn't add new code to this function. Instead, please try to make this a new function or refactor this function to make it shorter.


http://reviews.llvm.org/D17998





More information about the llvm-commits mailing list