summaryrefslogtreecommitdiff
path: root/lib/Tooling/JSONCompilationDatabase.cpp
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2014-07-06 17:43:24 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2014-07-06 17:43:24 +0000
commit860df574e7a0a3f1c4fa1a2eb8280c20e7f02027 (patch)
treef97d1b48f6127f8ccc873b6d81bd7b1e550f9a2c /lib/Tooling/JSONCompilationDatabase.cpp
parentbdb203a06d6972522eb56cf583421a20ebda4228 (diff)
downloadclang-860df574e7a0a3f1c4fa1a2eb8280c20e7f02027.tar.gz
Update for llvm api change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@212408 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Tooling/JSONCompilationDatabase.cpp')
-rw-r--r--lib/Tooling/JSONCompilationDatabase.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/lib/Tooling/JSONCompilationDatabase.cpp b/lib/Tooling/JSONCompilationDatabase.cpp
index 94fdb5f9a9..8b8bd29385 100644
--- a/lib/Tooling/JSONCompilationDatabase.cpp
+++ b/lib/Tooling/JSONCompilationDatabase.cpp
@@ -144,15 +144,14 @@ volatile int JSONAnchorSource = 0;
JSONCompilationDatabase *
JSONCompilationDatabase::loadFromFile(StringRef FilePath,
std::string &ErrorMessage) {
- std::unique_ptr<llvm::MemoryBuffer> DatabaseBuffer;
- std::error_code Result =
- llvm::MemoryBuffer::getFile(FilePath, DatabaseBuffer);
- if (Result) {
+ llvm::ErrorOr<std::unique_ptr<llvm::MemoryBuffer>> DatabaseBuffer =
+ llvm::MemoryBuffer::getFile(FilePath);
+ if (std::error_code Result = DatabaseBuffer.getError()) {
ErrorMessage = "Error while opening JSON database: " + Result.message();
return nullptr;
}
std::unique_ptr<JSONCompilationDatabase> Database(
- new JSONCompilationDatabase(DatabaseBuffer.release()));
+ new JSONCompilationDatabase(DatabaseBuffer->release()));
if (!Database->parse(ErrorMessage))
return nullptr;
return Database.release();