llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-clang Author: Naveen Seth Hanig (naveen-seth) <details> <summary>Changes</summary> This change moves InputTy and InputList outside of the Driver class to allow wider usage. InputTy and InputList are currently defined inside the Driver class, which prevents other headers from using them without including Driver.h (by foreward declaring). This change is required for #<!-- -->152770 and is part of an effort to break that PR into smaller pieces. --- Full diff: https://github.com/llvm/llvm-project/pull/182158.diff 3 Files Affected: - (modified) clang/include/clang/Driver/Driver.h (-6) - (modified) clang/include/clang/Driver/Types.h (+7) - (modified) clang/lib/Driver/Driver.cpp (+6-7) ``````````diff diff --git a/clang/include/clang/Driver/Driver.h b/clang/include/clang/Driver/Driver.h index f7c138027bdae..6ba4093be33a7 100644 --- a/clang/include/clang/Driver/Driver.h +++ b/clang/include/clang/Driver/Driver.h @@ -228,12 +228,6 @@ class Driver { /// The file to log CC_LOG_DIAGNOSTICS output to, if enabled. std::string CCLogDiagnosticsFilename; - /// An input type and its arguments. - using InputTy = std::pair<types::ID, const llvm::opt::Arg *>; - - /// A list of inputs and their types for the given arguments. - using InputList = SmallVector<InputTy, 16>; - /// Whether the driver should follow g++ like behavior. bool CCCIsCXX() const { return Mode == GXXMode; } diff --git a/clang/include/clang/Driver/Types.h b/clang/include/clang/Driver/Types.h index 121b58a6b477d..9dd89e1904a4f 100644 --- a/clang/include/clang/Driver/Types.h +++ b/clang/include/clang/Driver/Types.h @@ -128,6 +128,13 @@ namespace types { ID lookupHeaderTypeForSourceType(ID Id); } // end namespace types + +/// A list of inputs and their types for the given arguments. +using InputTy = std::pair<types::ID, const llvm::opt::Arg *>; + +/// A list of inputs and their types for the given arguments. +using InputList = llvm::SmallVector<InputTy, 16>; + } // end namespace driver } // end namespace clang diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp index d7d744d1770b6..c0b0ef6ad52b3 100644 --- a/clang/lib/Driver/Driver.cpp +++ b/clang/lib/Driver/Driver.cpp @@ -3226,14 +3226,14 @@ class OffloadingActionBuilder final { DerivedArgList &Args; /// The inputs associated with this builder. - const Driver::InputList &Inputs; + const InputList &Inputs; /// The associated offload kind. Action::OffloadKind AssociatedOffloadKind = Action::OFK_None; public: DeviceActionBuilder(Compilation &C, DerivedArgList &Args, - const Driver::InputList &Inputs, + const InputList &Inputs, Action::OffloadKind AssociatedOffloadKind) : C(C), Args(Args), Inputs(Inputs), AssociatedOffloadKind(AssociatedOffloadKind) {} @@ -3330,8 +3330,7 @@ class OffloadingActionBuilder final { public: CudaActionBuilderBase(Compilation &C, DerivedArgList &Args, - const Driver::InputList &Inputs, - Action::OffloadKind OFKind) + const InputList &Inputs, Action::OffloadKind OFKind) : DeviceActionBuilder(C, Args, Inputs, OFKind), CUIDOpts(C.getDriver().getCUIDOpts()) { @@ -3502,7 +3501,7 @@ class OffloadingActionBuilder final { class CudaActionBuilder final : public CudaActionBuilderBase { public: CudaActionBuilder(Compilation &C, DerivedArgList &Args, - const Driver::InputList &Inputs) + const InputList &Inputs) : CudaActionBuilderBase(C, Args, Inputs, Action::OFK_Cuda) { DefaultOffloadArch = OffloadArch::CudaDefault; } @@ -3631,7 +3630,7 @@ class OffloadingActionBuilder final { public: HIPActionBuilder(Compilation &C, DerivedArgList &Args, - const Driver::InputList &Inputs) + const InputList &Inputs) : CudaActionBuilderBase(C, Args, Inputs, Action::OFK_HIP) { DefaultOffloadArch = OffloadArch::HIPDefault; @@ -3892,7 +3891,7 @@ class OffloadingActionBuilder final { public: OffloadingActionBuilder(Compilation &C, DerivedArgList &Args, - const Driver::InputList &Inputs) + const InputList &Inputs) : C(C) { // Create a specialized builder for each device toolchain. `````````` </details> https://github.com/llvm/llvm-project/pull/182158 _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
