Skip to content

Instantly share code, notes, and snippets.

@rumblefrog
Created November 26, 2019 07:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rumblefrog/ae7fb0898dd90c424a918dad841346af to your computer and use it in GitHub Desktop.
Save rumblefrog/ae7fb0898dd90c424a918dad841346af to your computer and use it in GitHub Desktop.
RefPtr<SourceFile>
SourceManager::createFromBuffer(ReportingContext& cc, UniquePtr<char[]> buffer, uint32_t length)
{
const char* path = "fish-glub-glub";
Atom* atom = strings_.add(path);
AtomMap<RefPtr<SourceFile>>::Insert p = file_cache_.findForAdd(atom);
if (p.found())
return p->value;
RefPtr<SourceFile> file = new SourceFile(buffer.take(), length, path);
file_cache_.add(p, atom, file);
return file;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment