Skip to content

Commit

Permalink
Support LLVM 16+
Browse files Browse the repository at this point in the history
  • Loading branch information
werat committed Apr 28, 2023
1 parent e87123a commit f259306
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 6 deletions.
10 changes: 8 additions & 2 deletions build_defs/llvm_project_local.BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,10 @@ cc_library(
"lib/LLVMRemarks.lib",
"lib/LLVMBitstreamReader.lib",
"lib/LLVMBinaryFormat.lib",
],
] + glob([
# For LLVM 16+, use glob because this file might not exist.
"lib/libLLVMTargetParser.lib",
]),
":linux_dynamic": [
":libllvm-so",
],
Expand All @@ -178,7 +181,10 @@ cc_library(
"lib/libLLVMRemarks.a",
"lib/libLLVMBitstreamReader.a",
"lib/libLLVMBinaryFormat.a",
],
] + glob([
# For LLVM 16+, use glob because this file might not exist.
"lib/libLLVMTargetParser.a",
]),
}),
hdrs = [":llvm-headers"],
includes = ["include"],
Expand Down
7 changes: 6 additions & 1 deletion lldb-eval/context.cc
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,16 @@
#include "lldb/API/SBTypeEnumMember.h"
#include "lldb/API/SBValue.h"
#include "lldb/API/SBValueList.h"
#include "llvm/ADT/Triple.h"
#include "llvm/ADT/Twine.h"
#include "llvm/Support/FormatAdapters.h"
#include "llvm/Support/FormatVariadic.h"

#if LLVM_VERSION_MAJOR < 16
#include "llvm/ADT/Triple.h"
#else
#include "llvm/TargetParser/Triple.h"
#endif

namespace {

lldb::SBValue CreateSBValue(lldb::SBTarget target, const void* bytes,
Expand Down
6 changes: 3 additions & 3 deletions lldb-eval/parser.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2358,9 +2358,9 @@ ExprResult Parser::ParseIntegerLiteral(clang::NumericLiteralParser& literal,

auto [type, is_unsigned] = PickIntegerType(*ctx_, literal, raw_value);

return std::make_unique<LiteralNode>(
token.getLocation(), ctx_->GetBasicType(type), raw_value,
/*is_literal_zero*/ raw_value.isNullValue());
return std::make_unique<LiteralNode>(token.getLocation(),
ctx_->GetBasicType(type), raw_value,
/*is_literal_zero*/ raw_value.isZero());
}

// Parse a builtin_func.
Expand Down

0 comments on commit f259306

Please sign in to comment.