Move definitions to the correct file.
Make YAML files own MemoryBuffer.

YAML files have references such as StringRef to the underlying
MemoryBuffer, so we shouldn't deallocate the buffer.