File tree Expand file tree Collapse file tree 3 files changed +25
-0
lines changed Expand file tree Collapse file tree 3 files changed +25
-0
lines changed Original file line number Diff line number Diff line change 33
33
#include < limits>
34
34
#include < typeinfo>
35
35
#include < iostream>
36
+ #if LLVM_VERSION_MAJOR >= 16
37
+ #include < optional>
38
+ #endif
36
39
37
40
#include " disasm.hpp"
38
41
#include " llvm_disasm.h"
39
42
40
43
#include < llvm/MC/MCDisassembler/MCDisassembler.h>
41
44
42
45
#include < llvm/ADT/ArrayRef.h>
46
+ #if LLVM_VERSION_MAJOR >= 17
47
+ #include < llvm/TargetParser/Triple.h>
48
+ #else
43
49
#include < llvm/ADT/Triple.h>
50
+ #endif
44
51
#include < llvm/ADT/Twine.h>
45
52
46
53
template <typename T>
@@ -467,7 +474,12 @@ class llvm_disassembler : public disassembler_interface {
467
474
} else if (p == is_true) {
468
475
return true ;
469
476
} else {
477
+ #if LLVM_VERSION_MAJOR >= 16
478
+ // MCInstrDesc needs to know its own address to access some implicit tables.
479
+ auto &d = ins_info->get (current.code );
480
+ #else
470
481
auto d = ins_info->get (current.code );
482
+ #endif
471
483
if (p == may_affect_control_flow) {
472
484
return d.mayAffectControlFlow (mcinst, *reg_info);
473
485
} else if (auto check = fun_of_pred (p)) {
@@ -655,7 +667,11 @@ struct create_llvm_disassembler : disasm_factory {
655
667
656
668
static void parse_environment_options (const char *prog_name, const char *env_var) {
657
669
#if LLVM_VERSION_MAJOR >= 12
670
+ #if LLVM_VERSION_MAJOR >= 16
671
+ std::optional<std::string> env_value = llvm::sys::Process::GetEnv (llvm::StringRef (env_var));
672
+ #else
658
673
llvm::Optional<std::string> env_value = llvm::sys::Process::GetEnv (llvm::StringRef (env_var));
674
+ #endif
659
675
if (!env_value)
660
676
return ;
661
677
Original file line number Diff line number Diff line change 5
5
#include < iomanip>
6
6
#include < iostream>
7
7
8
+ #if LLVM_VERSION_MAJOR >= 17
9
+ #include < llvm/TargetParser/Triple.h>
10
+ #else
8
11
#include < llvm/ADT/Triple.h>
12
+ #endif
9
13
10
14
#include " llvm_error_or.hpp"
11
15
Original file line number Diff line number Diff line change 1
1
#include < iostream>
2
2
3
+ #include < llvm/Config/llvm-config.h>
4
+ #if LLVM_VERSION_MAJOR >= 17
5
+ #include < llvm/TargetParser/Triple.h>
6
+ #else
3
7
#include < llvm/ADT/Triple.h>
8
+ #endif
4
9
5
10
#include " llvm_primitives.hpp"
6
11
You can’t perform that action at this time.
0 commit comments