Rolf Eike Beer
94de927cab
VS10Generator: avoid many string allocations
2020-03-24 17:50:42 +01:00
Rolf Eike Beer
8ca2504a4d
use string_views to avoid memory allocations
2020-03-24 17:50:37 +01:00
Rolf Eike Beer
761f1adcae
check for a valid URL scheme before starting to do any splitting
2020-03-23 22:41:44 +01:00
Rolf Eike Beer
ef778d77e0
replace std::string::substr() with operations that do not allocate memory
...
Modify the original string instead of creating a new copy with substr() when it
is not used for anything else afterwards.
2020-03-23 22:41:44 +01:00
Rolf Eike Beer
77616f4681
pass cm::string_view to cmVisualStudioSlnParser::ParseTag()
2020-03-23 22:41:43 +01:00
Rolf Eike Beer
ada6a3226f
use cm::string_view for language extension lookups
...
Once the list of extensions is build the set is just a copy of the vector and
not modified anymore. Use a string_view for the members of the set, which saves
a small amount of memory. It also makes possible to use string_views as lookup
keys, so the callers do not need to create copies for the extensions anymore.
2020-03-23 22:41:43 +01:00
Rolf Eike Beer
48adc29721
replace "std::string::find(x) == 0" with cmHasPrefix()
2020-03-23 22:41:43 +01:00
Rolf Eike Beer
bfb69f9543
replace "substr(0, xx) ==" with cmHasPrefix()
2020-03-23 20:19:26 +01:00
Rolf Eike Beer
7df84ffe58
allow cmCTest::CleanString() to skip input characters
...
This entirely avoids that one needs to call std::string::substr() for the
input.
2020-03-23 20:19:26 +01:00
Rolf Eike Beer
d6a4e9fbc8
CTest: avoid repeated string compares
...
Only one key can match per iteration, avoid any further compares when one match
was already found. While at it entirely avoid that the key and value strings are
copied.
2020-03-23 20:18:02 +01:00
Rolf Eike Beer
d1e6ee6fe3
Mumps coverage: directly pass std::string as argument
2020-03-23 19:47:47 +01:00
Rolf Eike Beer
dc21177461
remove pointless return value from cmCTestTestHandler::CleanTestOutput()
2020-03-23 19:47:47 +01:00
Rolf Eike Beer
36bfb80338
PyCoverage: avoid repeated string splitting, especially for uncovered lines
2020-03-23 19:47:47 +01:00
Rolf Eike Beer
0415fa3be7
use std::string::rfind() instead of open coding it
...
While at it avoid creating a new string.
2020-03-23 19:47:47 +01:00
Rolf Eike Beer
871bf0cc88
CPackWIXGenerator: use cmStrCat for more parts
2020-03-23 19:47:46 +01:00
Rolf Eike Beer
d6cf89c0d4
remove needless check for std::string::substr()
...
Passing npos is legal and means "rest of the string".
2020-03-23 19:47:46 +01:00
Rolf Eike Beer
a42d2b099a
cmcldeps: replace inefficient std::string::substr usage
2020-03-23 19:47:46 +01:00
Rolf Eike Beer
59d572bb4a
replace private startsWith() implementation with cmHasPrefix()
2020-03-23 19:47:46 +01:00
Brad King
a4abf61520
Merge topic 'cmake-gui-open-check'
...
ecc0086bfc cmake-gui: Fix use-after-free in Open-possible check
Acked-by: Kitware Robot <kwrobot@kitware.com >
Merge-request: !4508
2020-03-23 09:27:44 -04:00
Kitware Robot
8638c49f2a
CMake Nightly Date Stamp
2020-03-23 00:01:05 -04:00
Kitware Robot
7099db5dd4
CMake Nightly Date Stamp
2020-03-22 00:01:11 -04:00
Kitware Robot
8bef78bb73
CMake Nightly Date Stamp
2020-03-21 00:01:12 -04:00
Francisco Facioni
ecc0086bfc
cmake-gui: Fix use-after-free in Open-possible check
...
Fix `QCMake::checkOpenPossible` to copy `toLocal8Bit().data()` before
its lifetime expires.
2020-03-20 08:38:31 -04:00
Brad King
e3185e3d1b
CMake 3.17.0
2020-03-20 06:26:14 -04:00
Brad King
119d1dadce
Merge topic 'export-repeat' into release-3.17
...
8affe9aa33 export: Fix use-after-free on multiple calls overwriting same FILE
Acked-by: Kitware Robot <kwrobot@kitware.com >
Merge-request: !4494
2020-03-20 06:17:00 -04:00
Brad King
94139ac58e
Merge topic 'export-repeat'
...
8affe9aa33 export: Fix use-after-free on multiple calls overwriting same FILE
Acked-by: Kitware Robot <kwrobot@kitware.com >
Merge-request: !4494
2020-03-20 06:17:00 -04:00
Kitware Robot
9bbea2344b
CMake Nightly Date Stamp
2020-03-20 00:01:11 -04:00
Brad King
60db3af147
Merge topic 'cmprop-state'
...
bd89133543 cmState::GetCacheEntryValue: return cmProp
Acked-by: Kitware Robot <kwrobot@kitware.com >
Merge-request: !4493
2020-03-19 07:18:27 -04:00
Brad King
7bdf84d2d5
Merge topic 'target-improve'
...
b915fec56e cmTarget: minor code improvements
Acked-by: Kitware Robot <kwrobot@kitware.com >
Merge-request: !4483
2020-03-19 07:17:39 -04:00
Brad King
0586123ede
Merge topic 'trace-format-json-doc'
...
1994f950ff cmake: List valid values for --trace-format on the command line
e39766d84a Help: Fix documentation of --trace-format parameter
Acked-by: Kitware Robot <kwrobot@kitware.com >
Merge-request: !4500
2020-03-19 06:57:52 -04:00
Brad King
8affe9aa33
export: Fix use-after-free on multiple calls overwriting same FILE
...
CMake 3.16 and below allow multiple `export()` calls with the same output
file even without using `APPEND`. The implementation worked by accident
by leaking memory. Refactoring in commit 5444a8095d (cmGlobalGenerator:
modernize memrory managemenbt, 2019-12-29, v3.17.0-rc1~239^2) cleaned up
that memory leak and converted it to a use-after-free instead.
The problem is caused by using the `cmGlobalGenerator::BuildExportSets`
map to own `cmExportBuildFileGenerator` instances. It can own only
one instance per output FILE name at a time, so repeating use of the
same file now frees the old `cmExportBuildFileGenerator` instance
and leaves the pointer in the `cmMakefile::ExportBuildFileGenerators`
vector dangling. Move ownership of the instances into `cmMakefile`'s
vector since its entries are not replaced on a repeat output FILE.
In future work we should introduce a policy to error out on this case.
For now simply fix the use-after-free to restore CMake <= 3.16 behavior.
Fixes : #20469
2020-03-19 06:41:39 -04:00
Kitware Robot
d995be9ead
CMake Nightly Date Stamp
2020-03-19 00:01:09 -04:00
Kyle Edwards
1994f950ff
cmake: List valid values for --trace-format on the command line
2020-03-18 16:16:46 -04:00
Kitware Robot
5a8eec41fc
CMake Nightly Date Stamp
2020-03-18 00:01:11 -04:00
Vitaly Stakhovsky
bd89133543
cmState::GetCacheEntryValue: return cmProp
2020-03-17 12:09:20 -04:00
Vitaly Stakhovsky
b915fec56e
cmTarget: minor code improvements
2020-03-17 08:33:57 -04:00
Brad King
bee0100396
Merge topic 'file-archive'
...
c7e1198a23 file: Add ARCHIVE_{CREATE|EXTRACT} subcommands
Acked-by: Kitware Robot <kwrobot@kitware.com >
Merge-request: !4475
2020-03-17 08:06:57 -04:00
Brad King
97562a2023
Merge topic 'property-computer'
...
fad0ee5404 cmTargetPropertyComputer::GetProperty: return cmProp
Acked-by: Kitware Robot <kwrobot@kitware.com >
Merge-request: !4482
2020-03-17 08:06:18 -04:00
Brad King
d2e0b8bcfd
Merge topic 'prop_t'
...
60f57d0dcc cmPropertyMap: Introduce cmProp as return type for GetProperty() functions
Acked-by: Kitware Robot <kwrobot@kitware.com >
Merge-request: !4471
2020-03-17 08:05:29 -04:00
Brad King
2b720f6ab6
Merge topic 'mf_profiling_json'
...
897af4c266 cmMakefileProfilingData: Fix ambiguous conversion to Json::Value
Acked-by: Kitware Robot <kwrobot@kitware.com >
Merge-request: !4479
2020-03-17 08:04:46 -04:00
Kitware Robot
372f269952
CMake Nightly Date Stamp
2020-03-17 00:01:09 -04:00
Vitaly Stakhovsky
fad0ee5404
cmTargetPropertyComputer::GetProperty: return cmProp
2020-03-16 13:47:05 -04:00
Brad King
6f4b1ba96d
Merge topic 'define-property'
...
73d52a862b cmPropertyDefinition: Construct directly in defined state
Acked-by: Kitware Robot <kwrobot@kitware.com >
Merge-request: !4470
2020-03-16 11:40:59 -04:00
Brad King
e08af3e6b8
Merge topic 'remove_trailing_whitespace'
...
67a592583d Source: Remove trailing whitespace from export generation code
Acked-by: Kitware Robot <kwrobot@kitware.com >
Merge-request: !4474
2020-03-16 11:32:14 -04:00
Cristian Adam
c7e1198a23
file: Add ARCHIVE_{CREATE|EXTRACT} subcommands
...
Fixes : #20443
2020-03-16 14:33:27 +01:00
Raul Tambre
897af4c266
cmMakefileProfilingData: Fix ambiguous conversion to Json::Value
2020-03-16 14:46:11 +02:00
Kitware Robot
eb7e8d1529
CMake Nightly Date Stamp
2020-03-16 00:01:07 -04:00
Kitware Robot
a6d95f57cc
CMake Nightly Date Stamp
2020-03-15 00:01:27 -04:00
Kitware Robot
9f3e8853f8
CMake Nightly Date Stamp
2020-03-14 00:01:09 -04:00
Vitaly Stakhovsky
60f57d0dcc
cmPropertyMap: Introduce cmProp as return type for GetProperty() functions
...
Currently properties are usually stored internally as `std::string`.
However, family of GetProperty() functions return them as `const char *` using `c_str()`.
The proposed `cmProp`, typedef'ed as `const std::string *` will expose properties
more naturally.
2020-03-13 13:32:17 -04:00