buildASTFromCodeWithArgs() was creating a memory buffer referencing a
stack-allocated string. This diff changes the implementation to copy the code
string into the memory buffer so that said buffer owns the memory.
Details
Details
Diff Detail
Diff Detail
- Repository
- rL LLVM
Event Timeline
Comment Actions
Change buildAST functions to take a StringRef instead of a Twine.
In practice, code is almost never constructed on the fly using a Twine, so StringRef is simpler and avoids needing a copy when constructing the MemBuffer.
include/clang/Tooling/Tooling.h | ||
---|---|---|
208 ↗ | (On Diff #178507) | While we're here, can we change FileName and ToolName to StringRef too? |
Comment Actions
Alex, would you mind submitting this since I don't yet have submit privileges? I'll request them shortly, but I'd rather this go one in the meantime.