summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Holtermann <sebholt@xwmw.org>2019-04-02 16:53:34 (GMT)
committerSebastian Holtermann <sebholt@xwmw.org>2019-04-02 18:11:50 (GMT)
commit5431395d68a44d42149fb93692636f4138ddf6ed (patch)
treef858e3027430a48044a1e5f36b21437537565d79
parent78eccc7836e068652ea772ec65614bc446f23b14 (diff)
downloadCMake-5431395d68a44d42149fb93692636f4138ddf6ed.zip
CMake-5431395d68a44d42149fb93692636f4138ddf6ed.tar.gz
CMake-5431395d68a44d42149fb93692636f4138ddf6ed.tar.bz2
Autogen: Add cmQtAutogenGlobalInitializer::Keywords class
The new `cmQtAutogenGlobalInitializer::Keywords` class instance is bound to the lifetime of the `cmQtAutogenGlobalInitializer` instance. Global static const strings would be allocated at program start and deallocated at program end. Keeping keyword strings alive only in the context where they're needed helps to reduce the memory footprint.
-rw-r--r--Source/cmQtAutoGenGlobalInitializer.cxx7
-rw-r--r--Source/cmQtAutoGenGlobalInitializer.h15
2 files changed, 22 insertions, 0 deletions
diff --git a/Source/cmQtAutoGenGlobalInitializer.cxx b/Source/cmQtAutoGenGlobalInitializer.cxx
index 7bd0e52..994cfc8 100644
--- a/Source/cmQtAutoGenGlobalInitializer.cxx
+++ b/Source/cmQtAutoGenGlobalInitializer.cxx
@@ -20,6 +20,13 @@
#include <memory>
#include <utility>
+cmQtAutoGenGlobalInitializer::Keywords::Keywords()
+ : AUTOMOC("AUTOMOC")
+ , AUTOUIC("AUTOUIC")
+ , AUTORCC("AUTORCC")
+{
+}
+
cmQtAutoGenGlobalInitializer::cmQtAutoGenGlobalInitializer(
std::vector<cmLocalGenerator*> const& localGenerators)
{
diff --git a/Source/cmQtAutoGenGlobalInitializer.h b/Source/cmQtAutoGenGlobalInitializer.h
index 74184a0..6cddf16 100644
--- a/Source/cmQtAutoGenGlobalInitializer.h
+++ b/Source/cmQtAutoGenGlobalInitializer.h
@@ -18,10 +18,24 @@ class cmQtAutoGenInitializer;
class cmQtAutoGenGlobalInitializer
{
public:
+ /// @brief Collection of QtAutogen related keywords
+ class Keywords
+ {
+ public:
+ Keywords();
+
+ std::string AUTOMOC;
+ std::string AUTOUIC;
+ std::string AUTORCC;
+ };
+
+public:
cmQtAutoGenGlobalInitializer(
std::vector<cmLocalGenerator*> const& localGenerators);
~cmQtAutoGenGlobalInitializer();
+ Keywords const* kw() const { return Keywords_.get(); };
+
bool generate();
private:
@@ -48,6 +62,7 @@ private:
std::map<cmLocalGenerator*, std::string> GlobalAutoGenTargets_;
std::map<cmLocalGenerator*, std::string> GlobalAutoRccTargets_;
std::unordered_map<std::string, std::string> ExecutableTestOutputs_;
+ std::unique_ptr<Keywords> Keywords_;
};
#endif