Change-Id: Ic78afd0cd765fdb4cf1b7ecfb6bba22653ce6d29
Details
Diff Detail
- Repository
- rL LLVM
- Build Status
Buildable 15681 Build 15681: arc lint + arc unit
Event Timeline
One nit. LGTM otherwise.
lib/TableGen/Record.cpp | ||
---|---|---|
1839 | You are constructing a std::string only to use it to build another Twine. Why not just use Twine here? |
lib/TableGen/Record.cpp | ||
---|---|---|
1839 | Because of Twine lifetime limitations. Twine works by chaining together temporary node objects to represent the string concatenations. So changing Type to type Twine can't work, because the temporary node objects would be destroyed again immediately, before they are passed to PrintFatalError. (The compiler actually prevents attempts to do this, since Twine::operator= is deleted.) I think it would work to "inline" Type in the argument to PrintFatalError, guarding it with a ternary ?: operator, but that seemed uglier to me. |
lib/TableGen/Record.cpp | ||
---|---|---|
1839 | Thank you for the explanation. Reading ADT/Twine.h was enlightening. Now std::string makes sense to me. |
You are constructing a std::string only to use it to build another Twine. Why not just use Twine here?