Add SourceView which doesn't own source text as base class of Source (#65309)

Summary:
This would save the cost copying text from stack to heap in some cases (like
parsing function schema during loading phase of libtorch.so)

Pull Request resolved: https://github.com/pytorch/pytorch/pull/65309

Reviewed By: swolchok

Differential Revision: D31060315

Pulled By: gmagogsfm

fbshipit-source-id: 0caf7a688b40df52bb4388c5191d1a42351d6f1a
This commit is contained in:
gmagogsfm
2021-10-18 23:15:25 -07:00
committed by Facebook GitHub Bot
parent bff64e84cd
commit 147f7559b1
21 changed files with 174 additions and 90 deletions

View File

@ -5,7 +5,7 @@
namespace torch {
namespace jit {
const auto testSource = R"JIT(
constexpr c10::string_view testSource = R"JIT(
class FooTest:
def __init__(self, x):
self.x = x