clang-tidy: Enable clang-analyzer-deadcode.DeadStores check
This checks for values stored to variables that are never
read afterwards.
The change is made to avoid flagging this error when a unique_ptr
is used rather make it a stack variable. The clang-tidy don't like
the unused unique_ptr specifically rather than the unused class
instance.
Change-Id: I1c5a6b4032de75b7c8586467425f6fdacace5f31
Signed-off-by: Pavithra Barithaya <pavithrabarithaya07@gmail.com>
diff --git a/.clang-tidy b/.clang-tidy
index ff2531a..116e43b 100644
--- a/.clang-tidy
+++ b/.clang-tidy
@@ -120,6 +120,7 @@
clang-analyzer-cplusplus.SelfAssignment,
clang-analyzer-cplusplus.SmartPtrModeling,
clang-analyzer-cplusplus.VirtualCallModeling,
+clang-analyzer-deadcode.DeadStores,
clang-analyzer-fuchsia.HandleChecker,
clang-analyzer-nullability.NullPassedToNonnull,
clang-analyzer-nullability.NullReturnedFromNonnull,
diff --git a/host_condition_gpio/host_condition_main.cpp b/host_condition_gpio/host_condition_main.cpp
index 38a444a..ad23a87 100644
--- a/host_condition_gpio/host_condition_main.cpp
+++ b/host_condition_gpio/host_condition_main.cpp
@@ -29,8 +29,7 @@
sdbusplus::server::manager_t objManager(bus, objGroupName.c_str());
// For now, we only support checking Host0 status
- auto host = std::make_unique<phosphor::condition::Host>(
- bus, objPathInst.c_str(), hostId);
+ phosphor::condition::Host host(bus, objPathInst.c_str(), hostId);
bus.request_name(busName.c_str());