mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 22:02:55 +01:00
Switch SourceBuffer to diagnostics. (#3197)
This updates SourceBuffer to diagnostics. Some additional edits to diagnostics were necessary due to issues moving arguments around, which seems to stem from a compile error with clang 14 (fixed in later versions). --------- Co-authored-by: Richard Smith <richard@metafoo.co.uk>
This commit is contained in:
co-authored by
Richard Smith
parent
71e9fb7511
commit
bc63e6ae0a
@@ -11,6 +11,7 @@
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include "llvm/Support/MemoryBuffer.h"
|
||||
#include "llvm/Support/VirtualFileSystem.h"
|
||||
#include "toolchain/diagnostics/diagnostic_emitter.h"
|
||||
|
||||
namespace Carbon {
|
||||
|
||||
@@ -35,10 +36,9 @@ class SourceBuffer {
|
||||
public:
|
||||
// Opens the requested file. Returns a SourceBuffer on success. Prints an
|
||||
// error and returns nullopt on failure.
|
||||
// TODO: Switch to using diagnostics.
|
||||
static auto CreateFromFile(llvm::vfs::FileSystem& fs,
|
||||
llvm::raw_ostream& error_stream,
|
||||
llvm::StringRef filename)
|
||||
llvm::StringRef filename,
|
||||
DiagnosticConsumer& consumer)
|
||||
-> std::optional<SourceBuffer>;
|
||||
|
||||
// Use one of the factory functions above to create a source buffer.
|
||||
|
||||
Reference in New Issue
Block a user