[lld] 2618eaf - [lld-macho][nfc] Clean up some constructor declarations

Jez Ng via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 22 15:25:53 PDT 2021


Author: Jez Ng
Date: 2021-04-22T18:25:44-04:00
New Revision: 2618eaf614418c5d48c7fccc155106a3292a1431

URL: https://github.com/llvm/llvm-project/commit/2618eaf614418c5d48c7fccc155106a3292a1431
DIFF: https://github.com/llvm/llvm-project/commit/2618eaf614418c5d48c7fccc155106a3292a1431.diff

LOG: [lld-macho][nfc] Clean up some constructor declarations

Remove unnecessary default ctor + add `explicit` to others

Added: 
    

Modified: 
    lld/MachO/SyntheticSections.cpp
    lld/MachO/Writer.cpp

Removed: 
    


################################################################################
diff  --git a/lld/MachO/SyntheticSections.cpp b/lld/MachO/SyntheticSections.cpp
index 1734b12faf29..51922d95adf2 100644
--- a/lld/MachO/SyntheticSections.cpp
+++ b/lld/MachO/SyntheticSections.cpp
@@ -1050,8 +1050,8 @@ BitcodeBundleSection::BitcodeBundleSection()
 
 class ErrorCodeWrapper {
 public:
-  ErrorCodeWrapper(std::error_code ec) : errorCode(ec.value()) {}
-  ErrorCodeWrapper(int ec) : errorCode(ec) {}
+  explicit ErrorCodeWrapper(std::error_code ec) : errorCode(ec.value()) {}
+  explicit ErrorCodeWrapper(int ec) : errorCode(ec) {}
   operator int() const { return errorCode; }
 
 private:

diff  --git a/lld/MachO/Writer.cpp b/lld/MachO/Writer.cpp
index 1c745758effc..1298baadd7cb 100644
--- a/lld/MachO/Writer.cpp
+++ b/lld/MachO/Writer.cpp
@@ -337,7 +337,7 @@ class LCLoadDylinker : public LoadCommand {
 
 class LCRPath : public LoadCommand {
 public:
-  LCRPath(StringRef path) : path(path) {}
+  explicit LCRPath(StringRef path) : path(path) {}
 
   uint32_t getSize() const override {
     return alignTo(sizeof(rpath_command) + path.size() + 1, target->wordSize);
@@ -473,8 +473,6 @@ class LCUuid : public LoadCommand {
 
 template <class LP> class LCEncryptionInfo : public LoadCommand {
 public:
-  LCEncryptionInfo() {}
-
   uint32_t getSize() const override {
     return sizeof(typename LP::encryption_info_command);
   }


        


More information about the llvm-commits mailing list