Skip to content
  • Alessandro Di Federico's avatar
    e6bc62f7
    Twine: use them only as `const Twine &` arguments · e6bc62f7
    Alessandro Di Federico authored
    `Twine`s are very cool but very subtle objects. You basically have to
    use them as `const Twine &` arguments only. In fact, a Twine keeps a
    reference to objects whose lifetime corresponds to the current
    statament. Therefore, a `Twine` can easily end up holding a reference to
    invalid objects.
    
    This commit fixes a bug in function isolation (which would show up only
    if optimizations are enabled) due to a misusage of
    `Twine`. Additionally, it reduces its usage to safe places in
    `statistics.h`. Finally, we added an assertion in `check-conventions.sh`
    to ensure that no variables of type `Twine` are ever declared.
    e6bc62f7
    Twine: use them only as `const Twine &` arguments
    Alessandro Di Federico authored
    `Twine`s are very cool but very subtle objects. You basically have to
    use them as `const Twine &` arguments only. In fact, a Twine keeps a
    reference to objects whose lifetime corresponds to the current
    statament. Therefore, a `Twine` can easily end up holding a reference to
    invalid objects.
    
    This commit fixes a bug in function isolation (which would show up only
    if optimizations are enabled) due to a misusage of
    `Twine`. Additionally, it reduces its usage to safe places in
    `statistics.h`. Finally, we added an assertion in `check-conventions.sh`
    to ensure that no variables of type `Twine` are ever declared.
Loading