From c0d9c3a2ef763eb09f0a70b8ad86250598549487 Mon Sep 17 00:00:00 2001 From: Yang Chen Date: Fri, 28 Sep 2018 00:39:22 -0700 Subject: [PATCH] building with LLVM 7.0 cope with some API changes for LLVM 7.0 --- clang_delta/ExpressionDetector.cpp | 20 +++++++++++--------- clang_delta/RemoveUnusedEnumMember.cpp | 8 ++++---- clang_delta/TransformationManager.cpp | 2 +- 3 files changed, 16 insertions(+), 14 deletions(-) diff --git a/clang_delta/ExpressionDetector.cpp b/clang_delta/ExpressionDetector.cpp index aa87873..dd77068 100644 --- a/clang_delta/ExpressionDetector.cpp +++ b/clang_delta/ExpressionDetector.cpp @@ -64,7 +64,8 @@ public: StringRef FileName, bool IsAngled, CharSourceRange FilenameRange, const FileEntry *File, StringRef SearchPath, StringRef RelativePath, - const Module *Imported) override; + const Module *Imported, + SrcMgr::CharacteristicKind FileType) override; private: SourceManager &SrcManager; @@ -77,14 +78,15 @@ private: }; void IncludesPPCallbacks::InclusionDirective(SourceLocation HashLoc, - const Token &/*IncludeTok*/, - StringRef FileName, - bool /*IsAngled*/, - CharSourceRange /*FilenameRange*/, - const FileEntry * /*File*/, - StringRef /*SearchPath*/, - StringRef /*RelativePath*/, - const Module * /*Imported*/) + const Token &/*IncludeTok*/, + StringRef FileName, + bool /*IsAngled*/, + CharSourceRange /*FilenameRange*/, + const FileEntry * /*File*/, + StringRef /*SearchPath*/, + StringRef /*RelativePath*/, + const Module * /*Imported*/, + SrcMgr::CharacteristicKind /*FileType*/) { if (!SrcManager.isInMainFile(HashLoc)) return; diff --git a/clang_delta/RemoveUnusedEnumMember.cpp b/clang_delta/RemoveUnusedEnumMember.cpp index 8bf8673..469db3f 100644 --- a/clang_delta/RemoveUnusedEnumMember.cpp +++ b/clang_delta/RemoveUnusedEnumMember.cpp @@ -99,15 +99,15 @@ void RemoveUnusedEnumMember::removeEnumConstantDecl() { SourceLocation StartLoc = (*TheEnumIterator)->getLocStart(); if (StartLoc.isMacroID()) { - std::pair Locs = + CharSourceRange CSRange = SrcManager->getExpansionRange(StartLoc); - StartLoc = Locs.first; + StartLoc = CSRange.getBegin(); } SourceLocation EndLoc = (*TheEnumIterator)->getLocEnd(); if (EndLoc.isMacroID()) { - std::pair Locs = + CharSourceRange CSRange = SrcManager->getExpansionRange(EndLoc); - EndLoc = Locs.second; + EndLoc = CSRange.getEnd(); } SourceLocation CommaLoc = Lexer::findLocationAfterToken( EndLoc, tok::comma, *SrcManager, Context->getLangOpts(), diff --git a/clang_delta/TransformationManager.cpp b/clang_delta/TransformationManager.cpp index 89e9d72..1e56b90 100644 --- a/clang_delta/TransformationManager.cpp +++ b/clang_delta/TransformationManager.cpp @@ -223,7 +223,7 @@ llvm::raw_ostream *TransformationManager::getOutStream() std::error_code EC; llvm::raw_fd_ostream *Out = new llvm::raw_fd_ostream( - OutputFileName, EC, llvm::sys::fs::F_RW); + OutputFileName, EC, llvm::sys::fs::FA_Read | llvm::sys::fs::FA_Write); assert(!EC && "Cannot open output file!"); return Out; } -- 2.19.0