Skip to content

Commit 833e078

Browse files
committed
[Misc] update llvm version to 13
1 parent c4413c3 commit 833e078

File tree

3 files changed

+18
-4
lines changed

3 files changed

+18
-4
lines changed

include/soll/AST/Decl.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,7 @@ class Decl {
2929
friend class ASTReader;
3030

3131
protected:
32-
Decl(SourceRange L,
33-
llvm::StringRef Name = llvm::StringRef::withNullAsEmpty(nullptr),
32+
Decl(SourceRange L, llvm::StringRef Name = llvm::StringRef(""),
3433
Visibility vis = Visibility::Default)
3534
: Location(L), Name(Name.str()), Vis(vis), UniqueName(Name.str()) {}
3635

lib/Frontend/ASTConsumers/ASTPrinter.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@
22
#include "soll/AST/AST.h"
33
#include "soll/AST/ASTConsumer.h"
44
#include "soll/Frontend/ASTConsumers.h"
5+
#if LLVM_VERSION_MAJOR >= 13
6+
#include <llvm/ADT/StringExtras.h>
7+
#endif
58
#include <llvm/ADT/Twine.h>
69
#include <llvm/Support/raw_ostream.h>
7-
810
namespace {
911

1012
std::string ToString(soll::UnaryOperatorKind op) {
@@ -136,7 +138,11 @@ std::string ToString(soll::TypePtr type) {
136138
return llvm::Twine(ToString(at->getElementType()) + "[" +
137139
(at->isDynamicSized()
138140
? ""
141+
#if LLVM_VERSION_MAJOR >= 13
142+
: toString(at->getLength(), 10, false)) +
143+
#else
139144
: at->getLength().toString(10, false)) +
145+
#endif
140146
"]")
141147
.str();
142148
}
@@ -495,7 +501,11 @@ void ASTPrinter::visit(NumberLiteralType &literal) {
495501
const bool Signed =
496502
dynamic_cast<IntegerType *>(literal.getType().get())->isSigned();
497503
os() << indent() << "NumberLiteral "
504+
#if LLVM_VERSION_MAJOR >= 13
505+
<< toString(literal.getValue(), 10, Signed) << "\n";
506+
#else
498507
<< literal.getValue().toString(10, Signed) << "\n";
508+
#endif
499509
ConstStmtVisitor::visit(literal);
500510
unindent();
501511
}

lib/Frontend/CompilerInstance.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,12 @@ std::unique_ptr<llvm::raw_pwrite_stream> CompilerInstance::createOutputFile(
278278
OSFile = OutFile;
279279
OS.reset(new llvm::raw_fd_ostream(
280280
OSFile, Error,
281-
(Binary ? llvm::sys::fs::F_None : llvm::sys::fs::F_Text)));
281+
#if LLVM_VERSION_MAJOR >= 13
282+
(Binary ? llvm::sys::fs::OF_None : llvm::sys::fs::OF_Text)
283+
#else
284+
(Binary ? llvm::sys::fs::F_None : llvm::sys::fs::F_Text)
285+
#endif
286+
));
282287
if (Error)
283288
return nullptr;
284289
}

0 commit comments

Comments
 (0)