diff options
Diffstat (limited to 'include/clang/Driver/Multilib.h')
-rw-r--r-- | include/clang/Driver/Multilib.h | 54 |
1 files changed, 31 insertions, 23 deletions
diff --git a/include/clang/Driver/Multilib.h b/include/clang/Driver/Multilib.h index 36d2493b1afca..132d981854fcb 100644 --- a/include/clang/Driver/Multilib.h +++ b/include/clang/Driver/Multilib.h @@ -1,4 +1,4 @@ -//===--- Multilib.h ---------------------------------------------*- C++ -*-===// +//===- Multilib.h -----------------------------------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // @@ -11,10 +11,14 @@ #define LLVM_CLANG_DRIVER_MULTILIB_H #include "clang/Basic/LLVM.h" +#include "llvm/ADT/ArrayRef.h" #include "llvm/ADT/STLExtras.h" -#include "llvm/Option/Option.h" +#include "llvm/ADT/StringRef.h" +#include "llvm/Support/Compiler.h" +#include <cassert> #include <functional> #include <string> +#include <utility> #include <vector> namespace clang { @@ -24,7 +28,7 @@ namespace driver { /// by a command line flag class Multilib { public: - typedef std::vector<std::string> flags_list; + using flags_list = std::vector<std::string>; private: std::string GCCSuffix; @@ -33,40 +37,43 @@ private: flags_list Flags; public: - Multilib(StringRef GCCSuffix = "", StringRef OSSuffix = "", - StringRef IncludeSuffix = ""); + Multilib(StringRef GCCSuffix = {}, StringRef OSSuffix = {}, + StringRef IncludeSuffix = {}); - /// \brief Get the detected GCC installation path suffix for the multi-arch + /// Get the detected GCC installation path suffix for the multi-arch /// target variant. Always starts with a '/', unless empty const std::string &gccSuffix() const { assert(GCCSuffix.empty() || (StringRef(GCCSuffix).front() == '/' && GCCSuffix.size() > 1)); return GCCSuffix; } + /// Set the GCC installation path suffix. Multilib &gccSuffix(StringRef S); - /// \brief Get the detected os path suffix for the multi-arch + /// Get the detected os path suffix for the multi-arch /// target variant. Always starts with a '/', unless empty const std::string &osSuffix() const { assert(OSSuffix.empty() || (StringRef(OSSuffix).front() == '/' && OSSuffix.size() > 1)); return OSSuffix; } + /// Set the os path suffix. Multilib &osSuffix(StringRef S); - /// \brief Get the include directory suffix. Always starts with a '/', unless + /// Get the include directory suffix. Always starts with a '/', unless /// empty const std::string &includeSuffix() const { assert(IncludeSuffix.empty() || (StringRef(IncludeSuffix).front() == '/' && IncludeSuffix.size() > 1)); return IncludeSuffix; } + /// Set the include directory suffix Multilib &includeSuffix(StringRef S); - /// \brief Get the flags that indicate or contraindicate this multilib's use + /// Get the flags that indicate or contraindicate this multilib's use /// All elements begin with either '+' or '-' const flags_list &flags() const { return Flags; } flags_list &flags() { return Flags; } @@ -85,7 +92,7 @@ public: } LLVM_DUMP_METHOD void dump() const; - /// \brief print summary of the Multilib + /// print summary of the Multilib void print(raw_ostream &OS) const; /// Check whether any of the 'against' flags contradict the 'for' flags. @@ -102,14 +109,12 @@ raw_ostream &operator<<(raw_ostream &OS, const Multilib &M); class MultilibSet { public: - typedef std::vector<Multilib> multilib_list; - typedef multilib_list::iterator iterator; - typedef multilib_list::const_iterator const_iterator; - - typedef std::function<std::vector<std::string>(const Multilib &M)> - IncludeDirsFunc; - - typedef llvm::function_ref<bool(const Multilib &)> FilterCallback; + using multilib_list = std::vector<Multilib>; + using iterator = multilib_list::iterator; + using const_iterator = multilib_list::const_iterator; + using IncludeDirsFunc = + std::function<std::vector<std::string>(const Multilib &M)>; + using FilterCallback = llvm::function_ref<bool(const Multilib &)>; private: multilib_list Multilibs; @@ -117,7 +122,7 @@ private: IncludeDirsFunc FilePathsCallback; public: - MultilibSet() {} + MultilibSet() = default; /// Add an optional Multilib segment MultilibSet &Maybe(const Multilib &M); @@ -135,6 +140,7 @@ public: /// Filter out some subset of the Multilibs using a user defined callback MultilibSet &FilterOut(FilterCallback F); + /// Filter out those Multilibs whose gccSuffix matches the given expression MultilibSet &FilterOut(const char *Regex); @@ -144,7 +150,7 @@ public: /// Union this set of multilibs with another void combineWith(const MultilibSet &MS); - /// Remove all of thie multilibs from the set + /// Remove all of the multilibs from the set void clear() { Multilibs.clear(); } iterator begin() { return Multilibs.begin(); } @@ -165,12 +171,14 @@ public: IncludeCallback = std::move(F); return *this; } + const IncludeDirsFunc &includeDirsCallback() const { return IncludeCallback; } MultilibSet &setFilePathsCallback(IncludeDirsFunc F) { FilePathsCallback = std::move(F); return *this; } + const IncludeDirsFunc &filePathsCallback() const { return FilePathsCallback; } private: @@ -182,8 +190,8 @@ private: }; raw_ostream &operator<<(raw_ostream &OS, const MultilibSet &MS); -} -} -#endif +} // namespace driver +} // namespace clang +#endif // LLVM_CLANG_DRIVER_MULTILIB_H |