Fix llvm api so it works with older LLVM version (#1964)

* aa

* fix

* fix

* fmt

* fmt
This commit is contained in:
Dongjia "toka" Zhang 2024-03-26 19:26:19 +01:00 committed by GitHub
parent 91778961da
commit cd12546748
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 13 additions and 3 deletions

View File

@ -93,7 +93,11 @@ class CtxPass : public ModulePass {
private: private:
bool isLLVMIntrinsicFn(StringRef &n) { bool isLLVMIntrinsicFn(StringRef &n) {
// Not interested in these LLVM's functions // Not interested in these LLVM's functions
#if LLVM_VERSION_MAJOR >= 18
if (n.starts_with("llvm.")) {
#else
if (n.startswith("llvm.")) { if (n.startswith("llvm.")) {
#endif
return true; return true;
} else { } else {
return false; return false;

View File

@ -101,9 +101,15 @@ class DumpCfgPass : public ModulePass {
private: private:
bool isLLVMIntrinsicFn(StringRef &n) { bool isLLVMIntrinsicFn(StringRef &n) {
// Not interested in these LLVM's functions // Not interested in these LLVM's functions
#if LLVM_VERSION_MAJOR >= 18
if (n.starts_with("llvm.")) {
#else
if (n.startswith("llvm.")) { if (n.startswith("llvm.")) {
#endif
}
return true; return true;
} else { }
else {
return false; return false;
} }
} }