summaryrefslogtreecommitdiffstats
path: root/Source/cmSourceFileLocation.cxx
diff options
context:
space:
mode:
authorBen Boeckel <ben.boeckel@kitware.com>2014-02-03 21:06:54 (GMT)
committerBen Boeckel <ben.boeckel@kitware.com>2014-04-29 01:43:26 (GMT)
commite8e1f3a19fd07ba64381094b98c66f7d07c1746e (patch)
treeb0ef7a87b91b80952bc9016c23ba1b09e83bee64 /Source/cmSourceFileLocation.cxx
parent5554910ec2573282a85e61736e96f48e5f550066 (diff)
downloadCMake-e8e1f3a19fd07ba64381094b98c66f7d07c1746e.zip
CMake-e8e1f3a19fd07ba64381094b98c66f7d07c1746e.tar.gz
CMake-e8e1f3a19fd07ba64381094b98c66f7d07c1746e.tar.bz2
cmSourceFileLocation: Simplify logic in Matches
Diffstat (limited to 'Source/cmSourceFileLocation.cxx')
-rw-r--r--Source/cmSourceFileLocation.cxx71
1 files changed, 35 insertions, 36 deletions
diff --git a/Source/cmSourceFileLocation.cxx b/Source/cmSourceFileLocation.cxx
index 9c0b2c5..7837738 100644
--- a/Source/cmSourceFileLocation.cxx
+++ b/Source/cmSourceFileLocation.cxx
@@ -211,36 +211,33 @@ cmSourceFileLocation
bool cmSourceFileLocation::Matches(cmSourceFileLocation const& loc)
{
assert(this->Makefile);
- if(this->AmbiguousExtension && loc.AmbiguousExtension)
+ if(this->AmbiguousExtension == loc.AmbiguousExtension)
{
- // Both extensions are ambiguous. Since only the old fixed set of
- // extensions will be tried, the names must match at this point to
- // be the same file.
+ // Both extensions are similarly ambiguous. Since only the old fixed set
+ // of extensions will be tried, the names must match at this point to be
+ // the same file.
if(this->Name != loc.Name)
{
return false;
}
}
- else if(this->AmbiguousExtension)
+ else
{
- // Only "this" extension is ambiguous.
- if(!loc.MatchesAmbiguousExtension(*this))
+ const cmSourceFileLocation* loc1;
+ const cmSourceFileLocation* loc2;
+ if(this->AmbiguousExtension)
{
- return false;
+ // Only "this" extension is ambiguous.
+ loc1 = &loc;
+ loc2 = this;
}
- }
- else if(loc.AmbiguousExtension)
- {
- // Only "loc" extension is ambiguous.
- if(!this->MatchesAmbiguousExtension(loc))
+ else
{
- return false;
+ // Only "loc" extension is ambiguous.
+ loc1 = this;
+ loc2 = &loc;
}
- }
- else
- {
- // Neither extension is ambiguous.
- if(this->Name != loc.Name)
+ if(!loc1->MatchesAmbiguousExtension(*loc2))
{
return false;
}
@@ -254,28 +251,30 @@ bool cmSourceFileLocation::Matches(cmSourceFileLocation const& loc)
return false;
}
}
- else if(this->AmbiguousDirectory && loc.AmbiguousDirectory &&
- this->Makefile == loc.Makefile)
+ else if(this->AmbiguousDirectory && loc.AmbiguousDirectory)
{
- // Both sides have directories relative to the same location.
- if(this->Directory != loc.Directory)
+ if (this->Makefile == loc.Makefile)
+ {
+ // Both sides have directories relative to the same location.
+ if(this->Directory != loc.Directory)
+ {
+ return false;
+ }
+ }
+ else
{
+ // Each side has a directory relative to a different location.
+ // This can occur when referencing a source file from a different
+ // directory. This is not yet allowed.
+ this->Makefile->IssueMessage(
+ cmake::INTERNAL_ERROR,
+ "Matches error: Each side has a directory relative to a different "
+ "location. This can occur when referencing a source file from a "
+ "different directory. This is not yet allowed."
+ );
return false;
}
}
- else if(this->AmbiguousDirectory && loc.AmbiguousDirectory)
- {
- // Each side has a directory relative to a different location.
- // This can occur when referencing a source file from a different
- // directory. This is not yet allowed.
- this->Makefile->IssueMessage(
- cmake::INTERNAL_ERROR,
- "Matches error: Each side has a directory relative to a different "
- "location. This can occur when referencing a source file from a "
- "different directory. This is not yet allowed."
- );
- return false;
- }
else if(this->AmbiguousDirectory)
{
// Compare possible directory combinations.