mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-01-07 00:23:43 +00:00
3837f4273f
This patch is mechanically generated by clang-llvm-rename tool that I wrote using Clang Refactoring Engine just for creating this patch. You can see the source code of the tool at https://reviews.llvm.org/D64123. There's no manual post-processing; you can generate the same patch by re-running the tool against lld's code base. Here is the main discussion thread to change the LLVM coding style: https://lists.llvm.org/pipermail/llvm-dev/2019-February/130083.html In the discussion thread, I proposed we use lld as a testbed for variable naming scheme change, and this patch does that. I chose to rename variables so that they are in camelCase, just because that is a minimal change to make variables to start with a lowercase letter. Note to downstream patch maintainers: if you are maintaining a downstream lld repo, just rebasing ahead of this commit would cause massive merge conflicts because this patch essentially changes every line in the lld subdirectory. But there's a remedy. clang-llvm-rename tool is a batch tool, so you can rename variables in your downstream repo with the tool. Given that, here is how to rebase your repo to a commit after the mass renaming: 1. rebase to the commit just before the mass variable renaming, 2. apply the tool to your downstream repo to mass-rename variables locally, and 3. rebase again to the head. Most changes made by the tool should be identical for a downstream repo and for the head, so at the step 3, almost all changes should be merged and disappear. I'd expect that there would be some lines that you need to merge by hand, but that shouldn't be too many. Differential Revision: https://reviews.llvm.org/D64121 llvm-svn: 365595
78 lines
2.1 KiB
C++
78 lines
2.1 KiB
C++
//===- Driver.h -------------------------------------------------*- C++ -*-===//
|
|
//
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#ifndef LLD_ELF_DRIVER_H
|
|
#define LLD_ELF_DRIVER_H
|
|
|
|
#include "LTO.h"
|
|
#include "SymbolTable.h"
|
|
#include "lld/Common/LLVM.h"
|
|
#include "lld/Common/Reproduce.h"
|
|
#include "llvm/ADT/Optional.h"
|
|
#include "llvm/ADT/StringRef.h"
|
|
#include "llvm/ADT/StringSet.h"
|
|
#include "llvm/Option/ArgList.h"
|
|
#include "llvm/Support/raw_ostream.h"
|
|
|
|
namespace lld {
|
|
namespace elf {
|
|
|
|
extern class LinkerDriver *driver;
|
|
|
|
class LinkerDriver {
|
|
public:
|
|
void main(ArrayRef<const char *> args);
|
|
void addFile(StringRef path, bool withLOption);
|
|
void addLibrary(StringRef name);
|
|
|
|
private:
|
|
void createFiles(llvm::opt::InputArgList &args);
|
|
void inferMachineType();
|
|
template <class ELFT> void link(llvm::opt::InputArgList &args);
|
|
template <class ELFT> void compileBitcodeFiles();
|
|
|
|
// True if we are in --whole-archive and --no-whole-archive.
|
|
bool inWholeArchive = false;
|
|
|
|
// True if we are in --start-lib and --end-lib.
|
|
bool inLib = false;
|
|
|
|
// For LTO.
|
|
std::unique_ptr<BitcodeCompiler> lto;
|
|
|
|
std::vector<InputFile *> files;
|
|
};
|
|
|
|
// Parses command line options.
|
|
class ELFOptTable : public llvm::opt::OptTable {
|
|
public:
|
|
ELFOptTable();
|
|
llvm::opt::InputArgList parse(ArrayRef<const char *> argv);
|
|
};
|
|
|
|
// Create enum with OPT_xxx values for each option in Options.td
|
|
enum {
|
|
OPT_INVALID = 0,
|
|
#define OPTION(_1, _2, ID, _4, _5, _6, _7, _8, _9, _10, _11, _12) OPT_##ID,
|
|
#include "Options.inc"
|
|
#undef OPTION
|
|
};
|
|
|
|
void printHelp();
|
|
std::string createResponseFile(const llvm::opt::InputArgList &args);
|
|
|
|
llvm::Optional<std::string> findFromSearchPaths(StringRef path);
|
|
llvm::Optional<std::string> searchScript(StringRef path);
|
|
llvm::Optional<std::string> searchLibraryBaseName(StringRef path);
|
|
llvm::Optional<std::string> searchLibrary(StringRef path);
|
|
|
|
} // namespace elf
|
|
} // namespace lld
|
|
|
|
#endif
|