Prevent some FileLocation copies (in LinkerScript and PchFile classes)

svn path=/trunk/; revision=32593
This commit is contained in:
Hervé Poussineau 2008-03-07 08:16:26 +00:00
parent 57640e2c83
commit 6e49f8efc8
7 changed files with 24 additions and 17 deletions

View file

@ -301,7 +301,7 @@ AutomaticDependency::GetModuleFiles ( const Module& module,
if ( module.pch != NULL )
{
const FileLocation& pch = module.pch->file;
const FileLocation& pch = *module.pch->file;
File *file = new File ( pch.directory, pch.relative_path, pch.name , false, "", true );
files.push_back ( file );
}

View file

@ -399,7 +399,7 @@ CBBackend::_generate_cbproj ( const Module& module )
if ( module.pch != NULL )
{
string pch_path = Path::RelativeFromDirectory (
module.pch->file.name,
module.pch->file->name,
module.output->relative_path );
header_files.push_back ( pch_path );

View file

@ -1236,8 +1236,8 @@ MingwModuleHandler::GetPrecompiledHeaderFilename () const
if ( !module.pch || !use_pch )
return NULL;
return new FileLocation ( IntermediateDirectory,
module.pch->file.relative_path,
ReplaceExtension ( module.pch->file.name, "_" + module.name + ".gch" ) );
module.pch->file->relative_path,
ReplaceExtension ( module.pch->file->name, "_" + module.name + ".gch" ) );
}
Rule arRule1 ( "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext).a: $($(module_name)_OBJS) | $(INTERMEDIATE)$(SEP)$(source_dir)\n",
@ -1649,7 +1649,7 @@ MingwModuleHandler::GenerateLinkerCommand (
string linkerScriptArgument;
if ( module.linkerScript != NULL )
linkerScriptArgument = ssprintf ( " -Wl,-T,%s", backend->GetFullName ( module.linkerScript->file ).c_str () );
linkerScriptArgument = ssprintf ( " -Wl,-T,%s", backend->GetFullName ( *module.linkerScript->file ).c_str () );
else
linkerScriptArgument = "";
@ -1807,7 +1807,7 @@ MingwModuleHandler::GenerateObjectFileTargets ()
string cc = ( module.host == HostTrue ? "${host_gcc}" : "${gcc}" );
string cppc = ( module.host == HostTrue ? "${host_gpp}" : "${gpp}" );
const FileLocation& baseHeaderFile = module.pch->file;
const FileLocation& baseHeaderFile = *module.pch->file;
CLEAN_FILE ( *pchFilename );
string dependencies = backend->GetFullName ( baseHeaderFile );
/* WIDL generated headers may be used */

View file

@ -427,7 +427,7 @@ MSVCBackend::_generate_vcproj ( const Module& module )
{
fprintf ( OUT, "\t\t\t\tUsePrecompiledHeader=\"2\"\r\n" );
string pch_path = Path::RelativeFromDirectory (
module.pch->file.name,
module.pch->file->name,
module.output->relative_path );
string::size_type pos = pch_path.find_last_of ("/");
if ( pos != string::npos )

View file

@ -22,13 +22,14 @@
LinkerScript::LinkerScript ( const XMLElement& node_,
const Module& module_,
const FileLocation& file_ )
const FileLocation *file_ )
: node(node_), module(module_), file(file_)
{
}
LinkerScript::~LinkerScript ()
{
delete file;
}
void

View file

@ -779,14 +779,14 @@ Module::ProcessXMLSubElement ( const XMLElement& e,
if ( pos == string::npos )
{
linkerScript = new LinkerScript (
e, *this, FileLocation ( SourceDirectory, relative_path, e.value, &e ) );
e, *this, new FileLocation ( SourceDirectory, relative_path, e.value, &e ) );
}
else
{
string dir = e.value.substr ( 0, pos );
string name = e.value.substr ( pos + 1);
linkerScript = new LinkerScript (
e, *this, FileLocation ( SourceDirectory, relative_path + sSep + dir, name, &e ) );
e, *this, new FileLocation ( SourceDirectory, relative_path + sSep + dir, name, &e ) );
}
subs_invalid = true;
}
@ -824,14 +824,14 @@ Module::ProcessXMLSubElement ( const XMLElement& e,
if ( pos == string::npos )
{
pch = new PchFile (
e, *this, FileLocation ( SourceDirectory, relative_path, e.value, &e ) );
e, *this, new FileLocation ( SourceDirectory, relative_path, e.value, &e ) );
}
else
{
string dir = e.value.substr ( 0, pos );
string name = e.value.substr ( pos + 1);
pch = new PchFile (
e, *this, FileLocation ( SourceDirectory, relative_path + sSep + dir, name, &e ) );
e, *this, new FileLocation ( SourceDirectory, relative_path + sSep + dir, name, &e ) );
}
subs_invalid = true;
}
@ -1704,11 +1704,16 @@ Property::ProcessXML()
PchFile::PchFile (
const XMLElement& node_,
const Module& module_,
const FileLocation& file_ )
const FileLocation *file_ )
: node(node_), module(module_), file(file_)
{
}
PchFile::~PchFile()
{
delete file;
}
void
PchFile::ProcessXML()
{

View file

@ -639,11 +639,11 @@ class LinkerScript
public:
const XMLElement& node;
const Module& module;
FileLocation file;
const FileLocation *file;
LinkerScript ( const XMLElement& node,
const Module& module,
const FileLocation& file );
const FileLocation *file );
~LinkerScript ();
void ProcessXML();
};
@ -843,12 +843,13 @@ class PchFile
public:
const XMLElement& node;
const Module& module;
FileLocation file;
const FileLocation *file;
PchFile (
const XMLElement& node,
const Module& module,
const FileLocation& file );
const FileLocation *file );
~PchFile();
void ProcessXML();
};