Commit Graph

1027 Commits

Author SHA1 Message Date
Stephen Kelly ca140c2e89 cmMakefile: Create a unified raii for macro scopes. 2015-06-04 22:08:23 +02:00
Stephen Kelly d5dc4169ac cmMakefile: Create a unified raii for function scopes. 2015-06-04 22:08:23 +02:00
Brad King 0886880e3b Merge topic 'cmMakefile-Configure'
7657e8b1 cmMakefile: Introduce a local cmMakefile variable.
4e8f242d cmMakefile: Store unconfigured cmMakefiles.
d65e0123 cmMakefile: Implement ConfigureSubDirectory in terms of cmMakefile.
f059ed16 cmMakefile: Move Configure responsibility from cmLocalGenerator.
a653611d cmake: Replace CurrentLocalGenerator concept with CurrentMakefile.
69a038a9 cmMakefile: Refactor directories specified with the subdirs command.
08637970 cmLocalGenerator: ComputeObjectMaxPath just before generating.
27e11c6f Merge Configure state with GeneratingBuildSystem state.
363caa2f cmLocalGenerator: De-virtualize Configure().
2015-06-04 09:13:35 -04:00
Brad King 5a1c8806bf Merge topic 'rename-cmState-API'
cf1233a0 cmState: Rename GetParent method.
942df88b cmState: Rename CreateSnapshot method.
da28f115 cmState: Add CreateBaseSnapshot method.
2015-06-04 09:13:31 -04:00
Brad King b49aef6b10 Merge topic 'minor-cleanups'
eb7b6f6d cmVariableWatchCommand: Simplify error reporting.
499ebb65 cmListFileBacktrace: Internalize the step of making paths relative.
80b433b0 cmGlobalGenerator: Don't use else after a return.
52919ac8 cmMakefile: Make cmListFileBacktrace default constructible.
b68f2ea8 cmMakefile: Add API for elseif to create backtrace.
17e13f0a cmMakefile: Simplify CMP0000 handling.
2015-06-04 09:13:27 -04:00
Stephen Kelly 7657e8b1df cmMakefile: Introduce a local cmMakefile variable. 2015-06-04 09:06:42 -04:00
Stephen Kelly 4e8f242d17 cmMakefile: Store unconfigured cmMakefiles.
Not cmLocalGenerators.
2015-06-04 09:06:42 -04:00
Stephen Kelly d65e01235d cmMakefile: Implement ConfigureSubDirectory in terms of cmMakefile. 2015-06-04 09:06:42 -04:00
Stephen Kelly f059ed165b cmMakefile: Move Configure responsibility from cmLocalGenerator.
The generator should only have a function at generate time.
2015-06-04 09:06:41 -04:00
Stephen Kelly 69a038a9e9 cmMakefile: Refactor directories specified with the subdirs command.
Store the directories on the cmMakefile as explicitly not-configured-yet.
2015-06-04 09:06:41 -04:00
Stephen Kelly 27e11c6fea Merge Configure state with GeneratingBuildSystem state. 2015-06-04 09:06:40 -04:00
Brad King c85367f408 VS: Compute project GUIDs deterministically
Compute deterministic GUIDs that are unique to the build tree by
hashing the path to the build tree with the GUID logical name.
Avoid storing them in the cache, but honor any found there.
This will allow project GUIDs to be reproduced in a fresh build
tree so long as its path is the same as the original, which may
be useful for incremental builds.
2015-06-04 08:40:08 -04:00
Stephen Kelly cf1233a0ea cmState: Rename GetParent method.
Leave the namespace open for other Parent types.
2015-06-03 01:15:03 +02:00
Stephen Kelly 942df88bf8 cmState: Rename CreateSnapshot method.
Leave the namespace open for other snapshot types.
2015-06-03 01:14:34 +02:00
Stephen Kelly b68f2ea8ae cmMakefile: Add API for elseif to create backtrace. 2015-06-03 01:03:58 +02:00
Stephen Kelly 17e13f0a2d cmMakefile: Simplify CMP0000 handling. 2015-06-03 01:03:57 +02:00
Brad King c12fc3573b Merge topic 'inject-state-snapshot'
3b880a07 cmLocalGenerator: Require a valid cmState::Snapshot in the ctor.
e12afe76 cmState: Host some state from the cmGlobalGenerator.
c7b79aa1 cmGlobalGenerator: Require a cmake instance in ctor.
01e1cd5c cmState: Move snapshot creation to the cmake instance.
2015-05-27 09:23:01 -04:00
Stephen Kelly 3b880a0741 cmLocalGenerator: Require a valid cmState::Snapshot in the ctor.
Refactor the local generator creation API to accept a
cmState::Snapshot.  Adjust MakeLocalGenerator to use the 'current'
snapshot in cases where there is no parent.  Create the snapshot
for subdirectories in cmMakefile::AddSubdirectory.

This means that snapshots are now created at the point of extending the tree,
as appropriate, and independently of the cmLocalGenerator and cmMakefile they
represent the state for.
2015-05-27 09:18:32 -04:00
Stephen Kelly f5b0a0fba4 cmMakefile: Don't pop the directory listfile off the stack.
Simplify the IssueMessage implementation.
2015-05-25 09:49:59 +02:00
Stephen Kelly e40fcb598d cmMakefile: Simplify convert condition.
The CallStack is checked above.
2015-05-25 09:21:56 +02:00
Stephen Kelly 8b4b9631f5 cmake: Add IssueMessage overload taking a single cmListFileContext.
Port appropriate clients to use it.
2015-05-22 01:21:35 +02:00
Brad King 3e3a09d1d3 Merge topic 'clean-up-CMAKE_COMMAND'
6fbd4cae Use cmSystemTools::GetCMakeCommand() to get path to cmake internally
2015-05-21 09:03:52 -04:00
Brad King 6fbd4cae0d Use cmSystemTools::GetCMakeCommand() to get path to cmake internally
This is much simpler than finding a way to lookup "CMAKE_COMMAND"
everywhere.
2015-05-20 11:20:42 -04:00
Stephen Kelly b9f9915516 cmMakefile: Remove VarUsageStack.
Store usage information in the cmDefintions value instead.  We already
pay for the memory as padding in the Def struct, so we might as well
use it.
2015-05-19 22:36:53 +02:00
Stephen Kelly 2b09d9f346 cmMakefile: Remove VarInitStack.
In cmMakefile::PushScope, a copy of the closure of keys initialized
in the parent scope is made.  In PopScope, essentially the same copy
is inserted back into the parent.  That means a lot of duplication
of strings and a lot of string comparisons.  None of it is needed,
because the cmDefinitions keys already provide a canonical
representation of what is initialized.

The removal of the separate container also makes the variable handling
code more easy to reason about in general.

Before this patch, configuring llvm uses 200 KiB for the VarInitStack.
Overall peak memory consumption goes from 35.5 MiB to 35.1 MiB.
2015-05-19 22:36:53 +02:00
Stephen Kelly 528d68021c cmMakefile: Use more suitable method name to log var usage. 2015-05-19 22:36:52 +02:00
Stephen Kelly f58c3774d1 cmMakefile: Mark definitions explicitly erased, even at top level.
Presumably the intention here is to attempt to optimize memory by not
storing what is not needed.  However, all keys need to be tracked
anyway to implement initialization tracking, and this special case
gets in the way of simplifying the implementation of that.

This doesn't change any observable effects because values set
to 0 are considered not to exist by the cmDefinitions API.
2015-05-19 22:36:52 +02:00
Stephen Kelly ea7b962be2 cmMakefile: Raise variable in scope explicitly when needed.
The Get method implicitly pulls a copy of all variables into a local scope. This
is not necessary.
2015-05-19 22:36:51 +02:00
Stephen Kelly c8cb66880c cmMakefile: Use early return to reduce nested code. 2015-05-19 22:36:51 +02:00
Stephen Kelly bdd1aa91ae cmMakefile: Don't use else after return. 2015-05-19 22:36:51 +02:00
Stephen Kelly c42f0e2b3e cmMakefile: Remove redundant conditions.
This container is never empty.
2015-05-19 22:36:51 +02:00
Stephen Kelly bb1e8c3adf cmMakefile: Remove Print() debugging facilities.
They don't print things that are important in the modern implementation.
2015-05-19 22:36:50 +02:00
Stephen Kelly 1363bff83a cmMakefile: Remove duplicate variable initialization. 2015-05-19 22:36:50 +02:00
Stephen Kelly 5b7ff35c4d cmMakefile: Don't expect the VarStack iterator to support size(). 2015-05-19 22:36:50 +02:00
Stephen Kelly 390bc3244f cmMakefile: Remove redundant condition.
As this is called in the constructor, the definition will never be already
set.
2015-05-19 22:36:49 +02:00
Stephen Kelly 8ab1cce704 cmMakefile: Rename method to something more appropriate.
Allow the name to be used for something more-suitable.
2015-05-19 22:36:49 +02:00
Stephen Kelly 2dd5d42f52 cmMakefile: Make the public ReadListFile method take one param.
Make the existing method a private overload. All external callers
invoke the method with only one argument.
2015-05-19 22:36:49 +02:00
Stephen Kelly f3e6a336f2 cmMakefile: Remove CurrentListFile member.
It is never read externally.  The CollapseFullPath removed in this commit
is a repeat of a similar call inside ReadListFile.
2015-05-19 22:36:48 +02:00
Stephen Kelly 6b9e647239 cmMakefile: Port CurrentListFile clients to GetDefinition.
There is no need to store this as a member variable.
2015-05-19 22:36:48 +02:00
Brad King 0cbc69b9ea Merge topic 'minor-cleanups'
61d52e6e cmListFileBacktrace: Hide the context-stack implementation detail.
a271f7f1 cmTarget: Simplify CMP0023 message loop.
f4300cd4 cmTarget: Simplify output computation.
65a42849 cmTarget: Store context in stack only if different.
9645cba3 cmListFileContext: Implement EqualityComparable.
52a8d19c cmTarget: Store only cmListFileContext for CMP0023 handling.
59ba1215 cmTarget: Remove needless iteration.
18f810a8 cmListFileContext: Sort by line before file.
e96b5d14 cmListFileContext: Implement LessThanComparable.
7eb0dfa0 cmMakefile: Use std::set::insert API to simplify CMP0054 handling.
f9785e0c cmMakefile: Simplify CMP0054 handling.
e17b5e42 cmMakefile: Add access to the top-level execution context.
1ec1bf9f if(): Test the effect of cmMakefileCall use in elseif() handling.
9b4aefad cmMakefile: Replace deques with vectors.
2015-05-19 11:09:36 -04:00
Brad King 93acb504c0 Merge topic 'clean-up-makefile-generators'
036372c4 Remove obsolete overrides of CreateLocalGenerator.
684e5cef cmGlobalGenerator: Host the MakeSilentFlag.
2047144f cmLocalGenerator: Remove unused IgnoreLibPrefix.
333c1fa8 cmGlobalUnixMakefileGenerator3: Host the UnixCD.
a97df5e1 cmGlobalUnixMakefileGenerator3: Host the PassMakeflags.
14f171c3 Remove method calls just repeating the default.
cf7f03e5 cmGlobalUnixMakefileGenerator3: Host the DefineWindowsNULL.
e9b134b9 cmGlobalUnixMakefileGenerator3: Host the include directive.
24613d8b cmLocalGenerator: Remove unused method.
b659d161 cmGlobalGenerator: Add NVI wrapper to create local generator.
2015-05-19 11:09:31 -04:00
Brad King 2d1d8af9b1 Merge topic 'clean-up-cmDefinitions'
f170985e cmDefinitions: Make the ClosureKeys method static.
98c5c903 cmDefinitions: Centralize knowledge of iterator type.
7872201b cmDefinitions: Remove internal MakeClosure method.
2015-05-19 11:09:28 -04:00
Brad King aa68f2e4c9 Merge topic 'fix-function-missing-endforeach'
3a656065 Fix assertion failure on unmatched foreach in function (#15572)
2015-05-19 11:09:21 -04:00
Stephen Kelly 61d52e6e77 cmListFileBacktrace: Hide the context-stack implementation detail.
The backtrace will soon not be implemented in terms of a stack of
cmListFileContext objects.  Keep the cmListFileContext in the API
for convenience for now.
2015-05-18 23:56:00 +02:00
Stephen Kelly e96b5d14f9 cmListFileContext: Implement LessThanComparable.
Move wrapping existing code from cmMakefile, and simplify the
implementation there.
2015-05-18 23:55:43 +02:00
Stephen Kelly 7eb0dfa062 cmMakefile: Use std::set::insert API to simplify CMP0054 handling. 2015-05-18 23:55:43 +02:00
Stephen Kelly f9785e0cb6 cmMakefile: Simplify CMP0054 handling. 2015-05-18 23:55:43 +02:00
Stephen Kelly e17b5e4262 cmMakefile: Add access to the top-level execution context.
This is cheaper than getting the whole backtrace, and the cmListFileBacktrace
will not always be composed of cmListFileContext objects.
2015-05-18 23:55:41 +02:00
Stephen Kelly 9b4aefad41 cmMakefile: Replace deques with vectors. 2015-05-18 21:25:48 +02:00
Brad King 3a65606591 Fix assertion failure on unmatched foreach in function (#15572)
The lexical scope counting added by commit v3.2.0-rc1~332^2~1 (Track
nested loop levels in CMake language with a stack of counters,
2014-11-18) forgot to account for scopes popped by error messages about
unclosed scopes.  Teach the error handler to pop the lexical scope it
reports as unclosed.  Re-order the lexical scope RAII object to be
inside the variable scope RAII object scope so that the lexical scope
is fully closed before we check assertions about variable scopes.

Extend the RunCMake.Syntax test with a case covering this.
2015-05-18 11:13:05 -04:00