[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [clazy] src: Use enum instead of bool. We'll be adding more options
From:       Sergio Martins <null () kde ! org>
Date:       2017-05-01 0:50:59
Message-ID: E1d4zYJ-0003bE-Jz () code ! kde ! org
[Download RAW message or body]

Git commit 9f46841d6d9474d96526ba6aa1011ad1d10ce0fb by Sergio Martins.
Committed on 30/04/2017 at 23:20.
Pushed by smartins into branch 'master'.

Use enum instead of bool. We'll be adding more options

M  +4    -9    src/Clazy.cpp
M  +1    -1    src/Clazy.h

https://commits.kde.org/clazy/9f46841d6d9474d96526ba6aa1011ad1d10ce0fb

diff --git a/src/Clazy.cpp b/src/Clazy.cpp
index e7079a4..0ce3d00 100644
--- a/src/Clazy.cpp
+++ b/src/Clazy.cpp
@@ -150,18 +150,13 @@ ClazyASTAction::ClazyASTAction()
 
 std::unique_ptr<clang::ASTConsumer> \
ClazyASTAction::CreateASTConsumer(CompilerInstance &ci, llvm::StringRef)  {
-    ClazyContext::ClazyOptions options = ClazyContext::ClazyOption_None;
-
-    if (m_inplaceFixits)
-        options |= ClazyContext::ClazyOption_FixitsAreInplace;
-
     if (m_checkManager->fixitsEnabled())
-        options |= ClazyContext::ClazyOption_FixitsEnabled;
+        m_options |= ClazyContext::ClazyOption_FixitsEnabled;
 
     if (m_checkManager->allFixitsEnabled())
-        options |= ClazyContext::ClazyOption_AllFixitsEnabled;
+        m_options |= ClazyContext::ClazyOption_AllFixitsEnabled;
 
-    auto context = new ClazyContext(ci, options);
+    auto context = new ClazyContext(ci, m_options);
 
     auto astConsumer = new ClazyASTConsumer(context);
     CheckBase::List createdChecks = m_checkManager->createChecks(m_checks, context);
@@ -188,7 +183,7 @@ bool ClazyASTAction::ParseArgs(const CompilerInstance &, const \
std::vector<std::  
     if (parseArgument("no-inplace-fixits", args)) {
         // Unit-tests don't use inplace fixits
-        m_inplaceFixits = false;
+        m_options &= ~ClazyContext::ClazyOption_FixitsAreInplace;
     }
 
     if (parseArgument("enable-all-fixits", args)) {
diff --git a/src/Clazy.h b/src/Clazy.h
index 76eb2f9..48b49e5 100644
--- a/src/Clazy.h
+++ b/src/Clazy.h
@@ -61,7 +61,7 @@ protected:
 private:
     void printRequestedChecks();
     RegisteredCheck::List m_checks;
-    bool m_inplaceFixits = true;
+    ClazyContext::ClazyOptions m_options = \
ClazyContext::ClazyOption_FixitsAreInplace;  CheckManager *const m_checkManager;
 };
 


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic