aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSergio Martins <smartins@kde.org>2019-05-05 14:16:16 +0100
committerSergio Martins <sergio.martins@kdab.com>2019-05-05 18:19:23 +0100
commitede2633b83b008677f838a49eec3ca24843ad87f (patch)
tree4b91541e64217792ed6db4a8a5adbaaf456db7f6
parent2555ccc9f942710aee6634536a7df1a5c28af945 (diff)
Add a CLAZY_EXPORT_FIXES env variable
Useful for the plugin, to not to have to change Qt mkspecs to pass compiler flags
-rw-r--r--README.md1
-rw-r--r--src/Clazy.cpp2
2 files changed, 2 insertions, 1 deletions
diff --git a/README.md b/README.md
index b275e20a..33506d38 100644
--- a/README.md
+++ b/README.md
@@ -363,6 +363,7 @@ If that doesn't work, run `clang -v` and check what's the InstalledDir. Move cla
Some checks support fixits, in which clazy will help re-write your source files whenever it can fix something.
Simply pass `-Xclang -plugin-arg-clazy -Xclang export-fixes` to clang, or `-export-fixes=somefile.yaml` for `clazy-standalone`.
+Alternatively, set the `CLAZY_EXPORT_FIXES` env variable (works only with the plugin, not with standalone).
Then run `clang-apply-replacements <folder_with_yaml_files>`, which will modify your code.
**WARNING**: Backup your code and make sure all changes done by clazy are correct.
diff --git a/src/Clazy.cpp b/src/Clazy.cpp
index b651d7be..9bbdce6d 100644
--- a/src/Clazy.cpp
+++ b/src/Clazy.cpp
@@ -242,7 +242,7 @@ bool ClazyASTAction::ParseArgs(const CompilerInstance &ci, const std::vector<std
return true;
}
- if (parseArgument("export-fixes", args))
+ if (parseArgument("export-fixes", args) || getenv("CLAZY_EXPORT_FIXES"))
m_options |= ClazyContext::ClazyOption_ExportFixes;
if (parseArgument("qt4-compat", args))