summaryrefslogtreecommitdiff
blob: a005eebff2e2b7f523cbfcbaf3ed3662a89d888f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
From c0d9c3a2ef763eb09f0a70b8ad86250598549487 Mon Sep 17 00:00:00 2001
From: Yang Chen <chenyang@cs.utah.edu>
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<SourceLocation, SourceLocation> Locs =
+    CharSourceRange CSRange =
       SrcManager->getExpansionRange(StartLoc);
-    StartLoc = Locs.first;
+    StartLoc = CSRange.getBegin();
   }
   SourceLocation EndLoc = (*TheEnumIterator)->getLocEnd();
   if (EndLoc.isMacroID()) {
-    std::pair<SourceLocation, SourceLocation> 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