lldb::ScriptLanguage ScriptInterpreter::StringToLanguage(const llvm::StringRef &language) { if (language.equals_lower(LanguageToString(eScriptLanguageNone))) return eScriptLanguageNone; else if (language.equals_lower(LanguageToString(eScriptLanguagePython))) return eScriptLanguagePython; else return eScriptLanguageUnknown; }
bool impl::ElfMatch_x86_amd64(llvm::StringRef arch_keyword, llvm::StringRef arch_machine, ElfClass cls) { return (arch_keyword.equals_lower("x86") && arch_machine.equals_lower("amd64") && (cls == ELFCLASSNONE || cls == ELFCLASS64)); }
LanguageType Language::GetLanguageTypeFromString(llvm::StringRef string) { for (const auto &L : language_names) { if (string.equals_lower(L.name)) return static_cast<LanguageType>(L.type); } return eLanguageTypeUnknown; }
void BinObject::AddDirectives(Directives& dirs, llvm::StringRef parser) { static const Directives::Init<BinObject> nasm_dirs[] = { {"section", &BinObject::DirSection, Directives::ARG_REQUIRED}, {"segment", &BinObject::DirSection, Directives::ARG_REQUIRED}, {"org", &BinObject::DirOrg, Directives::ARG_REQUIRED}, {"map", &BinObject::DirMap, Directives::ANY}, }; static const Directives::Init<BinObject> gas_dirs[] = { {".section", &BinObject::DirSection, Directives::ARG_REQUIRED}, }; if (parser.equals_lower("nasm")) dirs.AddArray(this, nasm_dirs); else if (parser.equals_lower("gas") || parser.equals_lower("gnu")) dirs.AddArray(this, gas_dirs); }
void XdfObject::AddDirectives(Directives& dirs, llvm::StringRef parser) { static const Directives::Init<XdfObject> nasm_dirs[] = { {"section", &XdfObject::DirSection, Directives::ARG_REQUIRED}, {"segment", &XdfObject::DirSection, Directives::ARG_REQUIRED}, }; if (parser.equals_lower("nasm")) dirs.AddArray(this, nasm_dirs); }
void Win64Object::AddDirectives(Directives& dirs, llvm::StringRef parser) { static const Directives::Init<Win64Object> gas_dirs[] = { {".export", &Win64Object::DirExport, Directives::ID_REQUIRED}, {".proc_frame", &Win64Object::DirProcFrame, Directives::ID_REQUIRED}, {".pushreg", &Win64Object::DirPushReg, Directives::ARG_REQUIRED}, {".setframe", &Win64Object::DirSetFrame, Directives::ARG_REQUIRED}, {".allocstack", &Win64Object::DirAllocStack, Directives::ARG_REQUIRED}, {".savereg", &Win64Object::DirSaveReg, Directives::ARG_REQUIRED}, {".savexmm128", &Win64Object::DirSaveXMM128, Directives::ARG_REQUIRED}, {".pushframe", &Win64Object::DirPushFrame, Directives::ANY}, {".endprolog", &Win64Object::DirEndProlog, Directives::ANY}, {".endproc_frame", &Win64Object::DirEndProcFrame, Directives::ANY}, }; static const Directives::Init<Win64Object> nasm_dirs[] = { {"export", &Win64Object::DirExport, Directives::ID_REQUIRED}, {"proc_frame", &Win64Object::DirProcFrame, Directives::ID_REQUIRED}, {"pushreg", &Win64Object::DirPushReg, Directives::ARG_REQUIRED}, {"setframe", &Win64Object::DirSetFrame, Directives::ARG_REQUIRED}, {"allocstack", &Win64Object::DirAllocStack, Directives::ARG_REQUIRED}, {"savereg", &Win64Object::DirSaveReg, Directives::ARG_REQUIRED}, {"savexmm128", &Win64Object::DirSaveXMM128, Directives::ARG_REQUIRED}, {"pushframe", &Win64Object::DirPushFrame, Directives::ANY}, {"endprolog", &Win64Object::DirEndProlog, Directives::ANY}, {"endproc_frame", &Win64Object::DirEndProcFrame, Directives::ANY}, }; if (parser.equals_lower("nasm")) dirs.AddArray(this, nasm_dirs); else if (parser.equals_lower("gas") || parser.equals_lower("gnu")) dirs.AddArray(this, gas_dirs); // Pull in coff directives (but not win32 directives) CoffObject::AddDirectives(dirs, parser); }
static bool IsMainFile(llvm::StringRef main, llvm::StringRef other) { if (main == other) return true; // If the files refer to the local file system, we can just ask the file // system if they're equivalent. But if the source isn't present on disk // then we still want to try. if (llvm::sys::fs::equivalent(main, other)) return true; llvm::SmallString<64> normalized(other); llvm::sys::path::native(normalized); return main.equals_lower(normalized); }