From 562fe35ac08bda4f6ab564ee06cf357984fc6963 Mon Sep 17 00:00:00 2001 From: Dimitar Dobrev Date: Fri, 21 Nov 2014 19:22:05 +0200 Subject: [PATCH] Updated to LLVM/Clang revision 222533/222534. Signed-off-by: Dimitar Dobrev --- docs/GettingStarted.md | 4 ++-- src/CppParser/Parser.cpp | 14 ++++++++++---- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/docs/GettingStarted.md b/docs/GettingStarted.md index d240a352..7fd23a95 100644 --- a/docs/GettingStarted.md +++ b/docs/GettingStarted.md @@ -34,9 +34,9 @@ msbuild LLVM.sln /p:Configuration=RelWithDebInfo;Platform=Win32 /m Last revisions known to work: -LLVM `r219061` / Git mirror revision `dbc6d9b9d7f71b25c6ea4264659460f81908e7e2`. +LLVM `r222533` / Git mirror revision `bd357588a106dc7c828c57ad8048e82003d638de`. -Clang `r219062` / Git mirror revision `cec1839edae2ca8a0321dde1ccd47009076d8557`. +Clang `r222534` / Git mirror revision `b643cf9daa35f3540a4420d93d7cc6f48cffb735`. ### Compiling CppSharp on Windows/Visual Studio diff --git a/src/CppParser/Parser.cpp b/src/CppParser/Parser.cpp index 5e847425..ce727d7d 100644 --- a/src/CppParser/Parser.cpp +++ b/src/CppParser/Parser.cpp @@ -3198,7 +3198,7 @@ ParserResult* Parser::ParseLibrary(const std::string& File, ParserResult* res) C->createFileManager(); auto &FM = C->getFileManager(); - const clang::FileEntry* FileEntry = 0; + llvm::StringRef FileEntry; for (unsigned I = 0, E = Opts->LibraryDirs.size(); I != E; ++I) { @@ -3206,17 +3206,23 @@ ParserResult* Parser::ParseLibrary(const std::string& File, ParserResult* res) llvm::SmallString<256> Path(LibDir); llvm::sys::path::append(Path, File); - if ((FileEntry = FM.getFile(Path.str()))) + if (!(FileEntry = Path.str()).empty()) break; } - if (!FileEntry) + if (FileEntry.empty()) { res->Kind = ParserResultKind::FileNotFound; return res; } - std::unique_ptr FileBuf(FM.getBufferForFile(FileEntry)); + auto Buffer = FM.getBufferForFile(FileEntry); + if (Buffer.getError()) + { + res->Kind = ParserResultKind::Error; + return res; + } + std::unique_ptr FileBuf(std::move(Buffer.get())); auto BinaryOrErr = llvm::object::createBinary(FileBuf->getMemBufferRef(), &llvm::getGlobalContext()); if (BinaryOrErr.getError())