[llvm] 6c39687 - [Support] Use default member initialization (NFC)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Sun Jun 12 18:46:31 PDT 2022


Author: Kazu Hirata
Date: 2022-06-12T18:46:25-07:00
New Revision: 6c39687567faee49b7bccdcaaaa35db0d397c19d

URL: https://github.com/llvm/llvm-project/commit/6c39687567faee49b7bccdcaaaa35db0d397c19d
DIFF: https://github.com/llvm/llvm-project/commit/6c39687567faee49b7bccdcaaaa35db0d397c19d.diff

LOG: [Support] Use default member initialization (NFC)

Identified with modernize-use-default-member-init.

Added: 
    

Modified: 
    llvm/lib/Support/CommandLine.cpp
    llvm/lib/Support/DynamicLibrary.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Support/CommandLine.cpp b/llvm/lib/Support/CommandLine.cpp
index 742e245c87815..eb6c04d987b31 100644
--- a/llvm/lib/Support/CommandLine.cpp
+++ b/llvm/lib/Support/CommandLine.cpp
@@ -166,7 +166,7 @@ class CommandLineParser {
   // This collects the 
diff erent subcommands that have been registered.
   SmallPtrSet<SubCommand *, 4> RegisteredSubCommands;
 
-  CommandLineParser() : ActiveSubCommand(nullptr) {
+  CommandLineParser() {
     registerSubCommand(&*TopLevelSubCommand);
     registerSubCommand(&*AllSubCommands);
   }
@@ -418,7 +418,7 @@ class CommandLineParser {
   }
 
 private:
-  SubCommand *ActiveSubCommand;
+  SubCommand *ActiveSubCommand = nullptr;
 
   Option *LookupOption(SubCommand &Sub, StringRef &Arg, StringRef &Value);
   Option *LookupLongOption(SubCommand &Sub, StringRef &Arg, StringRef &Value,

diff  --git a/llvm/lib/Support/DynamicLibrary.cpp b/llvm/lib/Support/DynamicLibrary.cpp
index d82a4a8cd1263..7b9d7abe7545d 100644
--- a/llvm/lib/Support/DynamicLibrary.cpp
+++ b/llvm/lib/Support/DynamicLibrary.cpp
@@ -26,14 +26,14 @@ using namespace llvm::sys;
 class DynamicLibrary::HandleSet {
   typedef std::vector<void *> HandleList;
   HandleList Handles;
-  void *Process;
+  void *Process = nullptr;
 
 public:
   static void *DLOpen(const char *Filename, std::string *Err);
   static void DLClose(void *Handle);
   static void *DLSym(void *Handle, const char *Symbol);
 
-  HandleSet() : Process(nullptr) {}
+  HandleSet() = default;
   ~HandleSet();
 
   HandleList::iterator Find(void *Handle) { return find(Handles, Handle); }


        


More information about the llvm-commits mailing list