aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSergio Martins <smartins@kde.org>2017-09-24 16:32:27 +0100
committerSergio Martins <iamsergio@gmail.com>2017-09-24 16:39:00 +0100
commitd357c41e5123cba648bd353d99bdf3d4f5ae6640 (patch)
tree15816072780907d70248e47c7cf3c2dbcbb96e1d /src
parentb52638f18b1011cabdcefabb050e15e564277ef1 (diff)
Added -qt-developer option
When building Qt it will hounor Qt guidelines. Used for performance reasons, so it doesn't run stuff that doesn't apply to user code
Diffstat (limited to 'src')
-rw-r--r--src/Clazy.cpp3
-rw-r--r--src/ClazyContext.h7
-rw-r--r--src/ClazyStandaloneMain.cpp6
3 files changed, 15 insertions, 1 deletions
diff --git a/src/Clazy.cpp b/src/Clazy.cpp
index b1cbed11..8014d81b 100644
--- a/src/Clazy.cpp
+++ b/src/Clazy.cpp
@@ -197,6 +197,9 @@ bool ClazyASTAction::ParseArgs(const CompilerInstance &ci, const std::vector<std
if (parseArgument("only-qt", args))
m_options |= ClazyContext::ClazyOption_OnlyQt;
+ if (parseArgument("qt-developer", args))
+ m_options |= ClazyContext::ClazyOption_QtDeveloper;
+
m_context = new ClazyContext(ci, m_options);
// This argument is for debugging purposes
diff --git a/src/ClazyContext.h b/src/ClazyContext.h
index 2f4276f8..5a41d322 100644
--- a/src/ClazyContext.h
+++ b/src/ClazyContext.h
@@ -55,7 +55,8 @@ public:
ClazyOption_NoFixitsAutoWrite = 2, // If enabled then fixits are reported, but not applied
ClazyOption_AllFixitsEnabled = 4,
ClazyOption_Qt4Compat = 8,
- ClazyOption_OnlyQt = 16 // Ignore non-Qt files. This is done by bailing out if QT_CORE_LIB is not set.
+ ClazyOption_OnlyQt = 16, // Ignore non-Qt files. This is done by bailing out if QT_CORE_LIB is not set.
+ ClazyOption_QtDeveloper = 32 // For running clazy on Qt itself, optional, but honours specific guidelines
};
typedef int ClazyOptions;
@@ -82,6 +83,10 @@ public:
return allFixitsEnabled || !requestedFixitName.empty();
}
+ bool isQtDeveloper() const
+ {
+ return options & ClazyOption_QtDeveloper;
+ }
bool isOptionSet(const std::string &optionName) const
{
diff --git a/src/ClazyStandaloneMain.cpp b/src/ClazyStandaloneMain.cpp
index aa4450af..5270b234 100644
--- a/src/ClazyStandaloneMain.cpp
+++ b/src/ClazyStandaloneMain.cpp
@@ -50,6 +50,9 @@ static cl::opt<bool> s_qt4Compat("qt4-compat", cl::desc("Turns off checks not co
static cl::opt<bool> s_onlyQt("only-qt", cl::desc("Won't emit warnings for non-Qt files, or in other words, if -DQT_CORE_LIB is missing."),
cl::init(false), cl::cat(s_clazyCategory));
+static cl::opt<bool> s_qtDeveloper("qt-developer", cl::desc("For running clazy on Qt itself, optional, but honours specific guidelines"),
+ cl::init(false), cl::cat(s_clazyCategory));
+
static cl::extrahelp s_commonHelp(CommonOptionsParser::HelpMessage);
class ClazyToolActionFactory : public clang::tooling::FrontendActionFactory
@@ -70,6 +73,9 @@ public:
if (s_qt4Compat.getValue())
options |= ClazyContext::ClazyOption_Qt4Compat;
+ if (s_qtDeveloper.getValue())
+ options |= ClazyContext::ClazyOption_QtDeveloper;
+
if (s_onlyQt.getValue())
options |= ClazyContext::ClazyOption_OnlyQt;