diff options
author | Kitware Robot <kwrobot@kitware.com> | 2016-05-16 14:34:04 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2016-05-16 20:05:19 (GMT) |
commit | d9fd2f5402eeaa345691313658e02b51038f570b (patch) | |
tree | dca71b9a7e267f4c6300da3eb770415381726785 /Source/cmGlobalNinjaGenerator.h | |
parent | 82df6deaafb36cbbfd450202bb20b320f637751a (diff) | |
download | CMake-d9fd2f5402eeaa345691313658e02b51038f570b.zip CMake-d9fd2f5402eeaa345691313658e02b51038f570b.tar.gz CMake-d9fd2f5402eeaa345691313658e02b51038f570b.tar.bz2 |
Revise C++ coding style using clang-format
Run the `Utilities/Scripts/clang-format.bash` script to update
all our C++ code to a new style defined by `.clang-format`.
Use `clang-format` version 3.8.
* If you reached this commit for a line in `git blame`, re-run the blame
operation starting at the parent of this commit to see older history
for the content.
* See the parent commit for instructions to rebase a change across this
style transition commit.
Diffstat (limited to 'Source/cmGlobalNinjaGenerator.h')
-rw-r--r-- | Source/cmGlobalNinjaGenerator.h | 192 |
1 files changed, 92 insertions, 100 deletions
diff --git a/Source/cmGlobalNinjaGenerator.h b/Source/cmGlobalNinjaGenerator.h index 56e2bdb..881104f 100644 --- a/Source/cmGlobalNinjaGenerator.h +++ b/Source/cmGlobalNinjaGenerator.h @@ -63,10 +63,10 @@ public: static void WriteDivider(std::ostream& os); static std::string EncodeRuleName(std::string const& name); - static std::string EncodeIdent(const std::string &ident, std::ostream &vars); - static std::string EncodeLiteral(const std::string &lit); - std::string EncodePath(const std::string &path); - static std::string EncodeDepfileSpace(const std::string &path); + static std::string EncodeIdent(const std::string& ident, std::ostream& vars); + static std::string EncodeLiteral(const std::string& lit); + std::string EncodePath(const std::string& path); + static std::string EncodeDepfileSpace(const std::string& path); /** * Write the given @a comment to the output stream @a os. It @@ -86,23 +86,19 @@ public: * It also writes the variables bound to this build statement. * @warning no escaping of any kind is done here. */ - void WriteBuild(std::ostream& os, - const std::string& comment, - const std::string& rule, - const cmNinjaDeps& outputs, + void WriteBuild(std::ostream& os, const std::string& comment, + const std::string& rule, const cmNinjaDeps& outputs, const cmNinjaDeps& explicitDeps, const cmNinjaDeps& implicitDeps, const cmNinjaDeps& orderOnlyDeps, const cmNinjaVars& variables, const std::string& rspfile = std::string(), - int cmdLineLimit = 0, - bool* usedResponseFile = 0); + int cmdLineLimit = 0, bool* usedResponseFile = 0); /** * Helper to write a build statement with the special 'phony' rule. */ - void WritePhonyBuild(std::ostream& os, - const std::string& comment, + void WritePhonyBuild(std::ostream& os, const std::string& comment, const cmNinjaDeps& outputs, const cmNinjaDeps& explicitDeps, const cmNinjaDeps& implicitDeps = cmNinjaDeps(), @@ -111,10 +107,8 @@ public: void WriteCustomCommandBuild(const std::string& command, const std::string& description, - const std::string& comment, - bool uses_terminal, - bool restat, - const cmNinjaDeps& outputs, + const std::string& comment, bool uses_terminal, + bool restat, const cmNinjaDeps& outputs, const cmNinjaDeps& deps = cmNinjaDeps(), const cmNinjaDeps& orderOnly = cmNinjaDeps()); void WriteMacOSXContentBuild(const std::string& input, @@ -126,43 +120,35 @@ public: * It also writes the variables bound to this rule statement. * @warning no escaping of any kind is done here. */ - static void WriteRule(std::ostream& os, - const std::string& name, + static void WriteRule(std::ostream& os, const std::string& name, const std::string& command, const std::string& description, - const std::string& comment, - const std::string& depfile, - const std::string& deptype, - const std::string& rspfile, + const std::string& comment, const std::string& depfile, + const std::string& deptype, const std::string& rspfile, const std::string& rspcontent, - const std::string& restat, - bool generator); + const std::string& restat, bool generator); /** * Write a variable named @a name to @a os with value @a value and an * optional @a comment. An @a indent level can be specified. * @warning no escaping of any kind is done here. */ - static void WriteVariable(std::ostream& os, - const std::string& name, + static void WriteVariable(std::ostream& os, const std::string& name, const std::string& value, - const std::string& comment = "", - int indent = 0); + const std::string& comment = "", int indent = 0); /** * Write an include statement including @a filename with an optional * @a comment to the @a os stream. */ - static void WriteInclude(std::ostream& os, - const std::string& filename, + static void WriteInclude(std::ostream& os, const std::string& filename, const std::string& comment = ""); /** * Write a default target statement specifying @a targets as * the default targets. */ - static void WriteDefault(std::ostream& os, - const cmNinjaDeps& targets, + static void WriteDefault(std::ostream& os, const cmNinjaDeps& targets, const std::string& comment = ""); bool IsGCCOnWindows() const { return UsingGCCOnWindows; } @@ -170,125 +156,130 @@ public: public: cmGlobalNinjaGenerator(cmake* cm); - static cmGlobalGeneratorFactory* NewFactory() { - return new cmGlobalGeneratorSimpleFactory<cmGlobalNinjaGenerator>(); } + static cmGlobalGeneratorFactory* NewFactory() + { + return new cmGlobalGeneratorSimpleFactory<cmGlobalNinjaGenerator>(); + } - virtual ~cmGlobalNinjaGenerator() { } + virtual ~cmGlobalNinjaGenerator() {} virtual cmLocalGenerator* CreateLocalGenerator(cmMakefile* mf); - virtual std::string GetName() const { - return cmGlobalNinjaGenerator::GetActualName(); } + virtual std::string GetName() const + { + return cmGlobalNinjaGenerator::GetActualName(); + } static std::string GetActualName() { return "Ninja"; } static void GetDocumentation(cmDocumentationEntry& entry); - virtual void EnableLanguage(std::vector<std::string>const& languages, - cmMakefile* mf, - bool optional); + virtual void EnableLanguage(std::vector<std::string> const& languages, + cmMakefile* mf, bool optional); virtual void GenerateBuildCommand( - std::vector<std::string>& makeCommand, - const std::string& makeProgram, - const std::string& projectName, - const std::string& projectDir, - const std::string& targetName, - const std::string& config, - bool fast, bool verbose, - std::vector<std::string> const& makeOptions = std::vector<std::string>() - ); + std::vector<std::string>& makeCommand, const std::string& makeProgram, + const std::string& projectName, const std::string& projectDir, + const std::string& targetName, const std::string& config, bool fast, + bool verbose, + std::vector<std::string> const& makeOptions = std::vector<std::string>()); // Setup target names - virtual const char* GetAllTargetName() const { return "all"; } - virtual const char* GetInstallTargetName() const { return "install"; } - virtual const char* GetInstallLocalTargetName() const { + virtual const char* GetAllTargetName() const { return "all"; } + virtual const char* GetInstallTargetName() const { return "install"; } + virtual const char* GetInstallLocalTargetName() const + { return "install/local"; } - virtual const char* GetInstallStripTargetName() const { + virtual const char* GetInstallStripTargetName() const + { return "install/strip"; } - virtual const char* GetTestTargetName() const { return "test"; } - virtual const char* GetPackageTargetName() const { return "package"; } - virtual const char* GetPackageSourceTargetName() const { + virtual const char* GetTestTargetName() const { return "test"; } + virtual const char* GetPackageTargetName() const { return "package"; } + virtual const char* GetPackageSourceTargetName() const + { return "package_source"; } - virtual const char* GetEditCacheTargetName() const { - return "edit_cache"; - } - virtual const char* GetRebuildCacheTargetName() const { + virtual const char* GetEditCacheTargetName() const { return "edit_cache"; } + virtual const char* GetRebuildCacheTargetName() const + { return "rebuild_cache"; } - virtual const char* GetCleanTargetName() const { return "clean"; } - + virtual const char* GetCleanTargetName() const { return "clean"; } - cmGeneratedFileStream* GetBuildFileStream() const { - return this->BuildFileStream; } + cmGeneratedFileStream* GetBuildFileStream() const + { + return this->BuildFileStream; + } - cmGeneratedFileStream* GetRulesFileStream() const { - return this->RulesFileStream; } + cmGeneratedFileStream* GetRulesFileStream() const + { + return this->RulesFileStream; + } std::string ConvertToNinjaPath(const std::string& path); std::string ConvertToNinjaFolderRule(const std::string& path); - - struct MapToNinjaPathImpl { + struct MapToNinjaPathImpl + { cmGlobalNinjaGenerator* GG; - MapToNinjaPathImpl(cmGlobalNinjaGenerator* gg): GG(gg) {} - std::string operator()(std::string const& path) { + MapToNinjaPathImpl(cmGlobalNinjaGenerator* gg) + : GG(gg) + { + } + std::string operator()(std::string const& path) + { return this->GG->ConvertToNinjaPath(path); } }; - MapToNinjaPathImpl MapToNinjaPath() { - return MapToNinjaPathImpl(this); - } + MapToNinjaPathImpl MapToNinjaPath() { return MapToNinjaPathImpl(this); } - void AddCXXCompileCommand(const std::string &commandLine, - const std::string &sourceFile); + void AddCXXCompileCommand(const std::string& commandLine, + const std::string& sourceFile); /** * Add a rule to the generated build system. * Call WriteRule() behind the scene but perform some check before like: * - Do not add twice the same rule. */ - void AddRule(const std::string& name, - const std::string& command, - const std::string& description, - const std::string& comment, - const std::string& depfile, - const std::string& deptype, - const std::string& rspfile, - const std::string& rspcontent, - const std::string& restat, - bool generator); + void AddRule(const std::string& name, const std::string& command, + const std::string& description, const std::string& comment, + const std::string& depfile, const std::string& deptype, + const std::string& rspfile, const std::string& rspcontent, + const std::string& restat, bool generator); bool HasRule(const std::string& name); void AddCustomCommandRule(); void AddMacOSXContentRule(); - bool HasCustomCommandOutput(const std::string &output) { + bool HasCustomCommandOutput(const std::string& output) + { return this->CustomCommandOutputs.find(output) != - this->CustomCommandOutputs.end(); + this->CustomCommandOutputs.end(); } /// Called when we have seen the given custom command. Returns true /// if we has seen it before. - bool SeenCustomCommand(cmCustomCommand const *cc) { + bool SeenCustomCommand(cmCustomCommand const* cc) + { return !this->CustomCommands.insert(cc).second; } /// Called when we have seen the given custom command output. - void SeenCustomCommandOutput(const std::string &output) { + void SeenCustomCommandOutput(const std::string& output) + { this->CustomCommandOutputs.insert(output); // We don't need the assumed dependencies anymore, because we have // an output. this->AssumedSourceDependencies.erase(output); } - void AddAssumedSourceDependencies(const std::string &source, - const cmNinjaDeps &deps) { - std::set<std::string> &ASD = this->AssumedSourceDependencies[source]; + void AddAssumedSourceDependencies(const std::string& source, + const cmNinjaDeps& deps) + { + std::set<std::string>& ASD = this->AssumedSourceDependencies[source]; // Because we may see the same source file multiple times (same source // specified in multiple targets), compute the union of any assumed // dependencies. @@ -302,14 +293,17 @@ public: void AddDependencyToAll(cmGeneratorTarget* target); void AddDependencyToAll(const std::string& input); - const std::vector<cmLocalGenerator*>& GetLocalGenerators() const { - return LocalGenerators; } + const std::vector<cmLocalGenerator*>& GetLocalGenerators() const + { + return LocalGenerators; + } - bool IsExcluded(cmLocalGenerator* root, cmGeneratorTarget* target) { - return cmGlobalGenerator::IsExcluded(root, target); } + bool IsExcluded(cmLocalGenerator* root, cmGeneratorTarget* target) + { + return cmGlobalGenerator::IsExcluded(root, target); + } - int GetRuleCmdLength(const std::string& name) { - return RuleCmdLength[name]; } + int GetRuleCmdLength(const std::string& name) { return RuleCmdLength[name]; } void AddTargetAlias(const std::string& alias, cmGeneratorTarget* target); @@ -321,12 +315,10 @@ public: bool SupportsConsolePool() const; protected: - virtual void Generate(); virtual bool CheckALLOW_DUPLICATE_CUSTOM_TARGETS() const { return true; } - private: virtual std::string GetEditCacheCommand() const; virtual void FindMakeProgram(cmMakefile* mf); |