Commit b1ec5dea authored by Daniel Pfeifer's avatar Daniel Pfeifer
Browse files

Pass large types by const&, small types by value

parent 3216c217
......@@ -205,8 +205,7 @@ bool cmCacheManager::ReadPropertyEntry(std::string const& entryKey,
return false;
}
void cmCacheManager::WritePropertyEntries(std::ostream& os,
CacheIterator const& i)
void cmCacheManager::WritePropertyEntries(std::ostream& os, CacheIterator i)
{
for (const char** p = this->PersistentProperties; *p; ++p) {
if (const char* value = i.GetProperty(*p)) {
......
......@@ -228,7 +228,7 @@ private:
static const char* PersistentProperties[];
bool ReadPropertyEntry(std::string const& key, CacheEntry& e);
void WritePropertyEntries(std::ostream& os, CacheIterator const& i);
void WritePropertyEntries(std::ostream& os, CacheIterator i);
CacheEntryMap Cache;
// Only cmake and cmState should be able to add cache values
......
......@@ -333,7 +333,7 @@ int cmComputeLinkDepends::AddLinkEntry(cmLinkItem const& item)
return index;
}
void cmComputeLinkDepends::FollowLinkEntry(BFSEntry const& qe)
void cmComputeLinkDepends::FollowLinkEntry(BFSEntry qe)
{
// Get this entry representation.
int depender_index = qe.Index;
......
......@@ -93,7 +93,7 @@ private:
const char* LibDepends;
};
std::queue<BFSEntry> BFSQueue;
void FollowLinkEntry(BFSEntry const&);
void FollowLinkEntry(BFSEntry qe);
// Shared libraries that are included only because they are
// dependencies of other shared libraries, not because they are part
......
......@@ -10,8 +10,7 @@ class cmDynamicLoaderCache
{
public:
~cmDynamicLoaderCache();
void CacheFile(const char* path,
const cmsys::DynamicLoader::LibraryHandle& /*p*/);
void CacheFile(const char* path, cmsys::DynamicLoader::LibraryHandle /*p*/);
bool GetCacheFile(const char* path,
cmsys::DynamicLoader::LibraryHandle& /*p*/);
bool FlushCache(const char* path);
......@@ -29,8 +28,8 @@ cmDynamicLoaderCache::~cmDynamicLoaderCache()
{
}
void cmDynamicLoaderCache::CacheFile(
const char* path, const cmsys::DynamicLoader::LibraryHandle& p)
void cmDynamicLoaderCache::CacheFile(const char* path,
cmsys::DynamicLoader::LibraryHandle p)
{
cmsys::DynamicLoader::LibraryHandle h;
if (this->GetCacheFile(path, h)) {
......
......@@ -53,17 +53,17 @@ template <size_t s>
struct cmELFByteSwapSize
{
};
void cmELFByteSwap(char* /*unused*/, cmELFByteSwapSize<1> const& /*unused*/)
void cmELFByteSwap(char* /*unused*/, cmELFByteSwapSize<1> /*unused*/)
{
}
void cmELFByteSwap(char* data, cmELFByteSwapSize<2> const& /*unused*/)
void cmELFByteSwap(char* data, cmELFByteSwapSize<2> /*unused*/)
{
char one_byte;
one_byte = data[0];
data[0] = data[1];
data[1] = one_byte;
}
void cmELFByteSwap(char* data, cmELFByteSwapSize<4> const& /*unused*/)
void cmELFByteSwap(char* data, cmELFByteSwapSize<4> /*unused*/)
{
char one_byte;
one_byte = data[0];
......@@ -73,7 +73,7 @@ void cmELFByteSwap(char* data, cmELFByteSwapSize<4> const& /*unused*/)
data[1] = data[2];
data[2] = one_byte;
}
void cmELFByteSwap(char* data, cmELFByteSwapSize<8> const& /*unused*/)
void cmELFByteSwap(char* data, cmELFByteSwapSize<8> /*unused*/)
{
char one_byte;
one_byte = data[0];
......
......@@ -1121,9 +1121,9 @@ protected:
bool InstallSymlink(const char* fromFile, const char* toFile);
bool InstallFile(const char* fromFile, const char* toFile,
MatchProperties const& match_properties);
MatchProperties match_properties);
bool InstallDirectory(const char* source, const char* destination,
MatchProperties const& match_properties);
MatchProperties match_properties);
virtual bool Install(const char* fromFile, const char* toFile);
virtual std::string const& ToName(std::string const& fromName)
{
......@@ -1542,7 +1542,7 @@ bool cmFileCopier::InstallSymlink(const char* fromFile, const char* toFile)
}
bool cmFileCopier::InstallFile(const char* fromFile, const char* toFile,
MatchProperties const& match_properties)
MatchProperties match_properties)
{
// Determine whether we will copy the file.
bool copy = true;
......@@ -1596,7 +1596,7 @@ bool cmFileCopier::InstallFile(const char* fromFile, const char* toFile,
bool cmFileCopier::InstallDirectory(const char* source,
const char* destination,
MatchProperties const& match_properties)
MatchProperties match_properties)
{
// Inform the user about this directory installation.
this->ReportCopy(destination, TypeDir,
......
......@@ -212,7 +212,8 @@ std::string cmFindProgramCommand::FindAppBundle()
return "";
}
std::string cmFindProgramCommand::GetBundleExecutable(std::string bundlePath)
std::string cmFindProgramCommand::GetBundleExecutable(
std::string const& bundlePath)
{
std::string executable;
(void)bundlePath;
......
......@@ -43,7 +43,7 @@ private:
std::string FindNormalProgramDirsPerName();
std::string FindNormalProgramNamesPerDir();
std::string FindAppBundle();
std::string GetBundleExecutable(std::string bundlePath);
std::string GetBundleExecutable(std::string const& bundlePath);
};
#endif
......@@ -76,7 +76,7 @@ public:
cmLinkImplItem cmGeneratorTarget::TargetPropertyEntry::NoLinkImplItem;
void CreatePropertyGeneratorExpressions(
cmStringRange const& entries, cmBacktraceRange const& backtraces,
cmStringRange entries, cmBacktraceRange backtraces,
std::vector<cmGeneratorTarget::TargetPropertyEntry*>& items,
bool evaluateForBuildsystem = false)
{
......
......@@ -1482,13 +1482,13 @@ cmGlobalGenerator::CreateQtAutoGeneratorsTargets()
}
cmLinkLineComputer* cmGlobalGenerator::CreateLinkLineComputer(
cmOutputConverter* outputConverter, cmStateDirectory stateDir) const
cmOutputConverter* outputConverter, cmStateDirectory const& stateDir) const
{
return new cmLinkLineComputer(outputConverter, stateDir);
}
cmLinkLineComputer* cmGlobalGenerator::CreateMSVC60LinkLineComputer(
cmOutputConverter* outputConverter, cmStateDirectory stateDir) const
cmOutputConverter* outputConverter, cmStateDirectory const& stateDir) const
{
return new cmMSVC60LinkLineComputer(outputConverter, stateDir);
}
......
......@@ -105,10 +105,12 @@ public:
virtual void Generate();
virtual cmLinkLineComputer* CreateLinkLineComputer(
cmOutputConverter* outputConverter, cmStateDirectory stateDir) const;
cmOutputConverter* outputConverter,
cmStateDirectory const& stateDir) const;
cmLinkLineComputer* CreateMSVC60LinkLineComputer(
cmOutputConverter* outputConverter, cmStateDirectory stateDir) const;
cmOutputConverter* outputConverter,
cmStateDirectory const& stateDir) const;
/**
* Set/Get and Clear the enabled languages.
......
......@@ -77,7 +77,8 @@ void cmGlobalNinjaGenerator::WriteComment(std::ostream& os,
}
cmLinkLineComputer* cmGlobalNinjaGenerator::CreateLinkLineComputer(
cmOutputConverter* outputConverter, cmStateDirectory /* stateDir */) const
cmOutputConverter* outputConverter,
cmStateDirectory const& /* stateDir */) const
{
return new cmNinjaLinkLineComputer(
outputConverter,
......
......@@ -78,7 +78,7 @@ public:
cmLinkLineComputer* CreateLinkLineComputer(
cmOutputConverter* outputConverter,
cmStateDirectory stateDir) const CM_OVERRIDE;
cmStateDirectory const& stateDir) const CM_OVERRIDE;
/**
* Write the given @a comment to the output stream @a os. It
......
......@@ -27,7 +27,7 @@ void cmInstallGenerator::AddInstallRule(
std::vector<std::string> const& files, bool optional /* = false */,
const char* permissions_file /* = 0 */,
const char* permissions_dir /* = 0 */, const char* rename /* = 0 */,
const char* literal_args /* = 0 */, Indent const& indent)
const char* literal_args /* = 0 */, Indent indent)
{
// Use the FILE command to install the file.
std::string stype;
......
......@@ -43,7 +43,7 @@ public:
std::vector<std::string> const& files, bool optional = false,
const char* permissions_file = CM_NULLPTR,
const char* permissions_dir = CM_NULLPTR, const char* rename = CM_NULLPTR,
const char* literal_args = CM_NULLPTR, Indent const& indent = Indent());
const char* literal_args = CM_NULLPTR, Indent indent = Indent());
/** Get the install destination as it should appear in the
installation script. */
......
......@@ -13,7 +13,7 @@
#include "cmStateTypes.h"
cmLinkLineComputer::cmLinkLineComputer(cmOutputConverter* outputConverter,
cmStateDirectory stateDir)
cmStateDirectory const& stateDir)
: StateDir(stateDir)
, OutputConverter(outputConverter)
, ForResponse(false)
......
......@@ -20,7 +20,7 @@ class cmLinkLineComputer
public:
cmLinkLineComputer(cmOutputConverter* outputConverter,
cmStateDirectory stateDir);
cmStateDirectory const& stateDir);
virtual ~cmLinkLineComputer();
void SetUseWatcomQuote(bool useWatcomQuote);
......
......@@ -10,13 +10,12 @@
#include "cmComputeLinkInformation.h"
#include "cmGeneratorTarget.h"
#include "cmGlobalNinjaGenerator.h"
#include "cmStateDirectory.h"
#include "cmStateTypes.h"
class cmOutputConverter;
cmLinkLineDeviceComputer::cmLinkLineDeviceComputer(
cmOutputConverter* outputConverter, cmStateDirectory stateDir)
cmOutputConverter* outputConverter, cmStateDirectory const& stateDir)
: cmLinkLineComputer(outputConverter, stateDir)
{
}
......@@ -89,7 +88,7 @@ std::string cmLinkLineDeviceComputer::GetLinkerLanguage(cmGeneratorTarget*,
}
cmNinjaLinkLineDeviceComputer::cmNinjaLinkLineDeviceComputer(
cmOutputConverter* outputConverter, cmStateDirectory stateDir,
cmOutputConverter* outputConverter, cmStateDirectory const& stateDir,
cmGlobalNinjaGenerator const* gg)
: cmLinkLineDeviceComputer(outputConverter, stateDir)
, GG(gg)
......
......@@ -22,7 +22,7 @@ class cmLinkLineDeviceComputer : public cmLinkLineComputer
public:
cmLinkLineDeviceComputer(cmOutputConverter* outputConverter,
cmStateDirectory stateDir);
cmStateDirectory const& stateDir);
~cmLinkLineDeviceComputer() CM_OVERRIDE;
std::string ComputeLinkLibraries(cmComputeLinkInformation& cli,
......@@ -39,7 +39,7 @@ class cmNinjaLinkLineDeviceComputer : public cmLinkLineDeviceComputer
public:
cmNinjaLinkLineDeviceComputer(cmOutputConverter* outputConverter,
cmStateDirectory stateDir,
cmStateDirectory const& stateDir,
cmGlobalNinjaGenerator const* gg);
std::string ConvertToLinkReference(std::string const& input) const
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment