diff options
Diffstat (limited to 'build/cxx/rule.cxx')
-rw-r--r-- | build/cxx/rule.cxx | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/build/cxx/rule.cxx b/build/cxx/rule.cxx index c9d451d..ebb95b9 100644 --- a/build/cxx/rule.cxx +++ b/build/cxx/rule.cxx @@ -888,7 +888,6 @@ namespace build // results in easier to read diagnostics. // path relt (relative (t.path ())); - vector<path> relo; scope& rs (*t.root_scope ()); // Shouldn't have matched if nullptr. vector<const char*> args; @@ -919,6 +918,12 @@ namespace build append_options (args, t, "cxx.loptions"); } + // Reserve enough space so that we don't reallocate. Reallocating + // means pointers to elements may no longer be valid. + // + vector<path> relo; + relo.reserve (t.prerequisite_targets.size ()); + for (target* pt: t.prerequisite_targets) { path_target* ppt; |