================ @@ -94,47 +96,37 @@ class CompilerInvocationRefBase { /// Options controlling the static analyzer. AnalyzerOptionsRef AnalyzerOpts; - CompilerInvocationRefBase(); - CompilerInvocationRefBase(const CompilerInvocationRefBase &X); - CompilerInvocationRefBase(CompilerInvocationRefBase &&X); - CompilerInvocationRefBase &operator=(CompilerInvocationRefBase X); - CompilerInvocationRefBase &operator=(CompilerInvocationRefBase &&X); - ~CompilerInvocationRefBase(); + struct ShallowCopy {}; + struct DeepCopy {}; - LangOptions &getLangOpts() { return *LangOpts; } - const LangOptions &getLangOpts() const { return *LangOpts; } + RefBase(); - TargetOptions &getTargetOpts() { return *TargetOpts.get(); } - const TargetOptions &getTargetOpts() const { return *TargetOpts.get(); } + RefBase(const RefBase &X, DeepCopy); + RefBase(const RefBase &X, ShallowCopy); + RefBase(const RefBase &) = delete; - DiagnosticOptions &getDiagnosticOpts() const { return *DiagnosticOpts; } + RefBase &assign(const RefBase &X, DeepCopy); + RefBase &assign(const RefBase &X, ShallowCopy); + RefBase &operator=(const RefBase &) = delete; - HeaderSearchOptions &getHeaderSearchOpts() { return *HeaderSearchOpts; } + RefBase(RefBase &&); + RefBase &operator=(RefBase &&); - const HeaderSearchOptions &getHeaderSearchOpts() const { - return *HeaderSearchOpts; - } + ~RefBase(); - std::shared_ptr<HeaderSearchOptions> getHeaderSearchOptsPtr() const { - return HeaderSearchOpts; - } - - std::shared_ptr<PreprocessorOptions> getPreprocessorOptsPtr() { - return PreprocessorOpts; - } - - PreprocessorOptions &getPreprocessorOpts() { return *PreprocessorOpts; } - - const PreprocessorOptions &getPreprocessorOpts() const { - return *PreprocessorOpts; - } - - AnalyzerOptions &getAnalyzerOpts() { return *AnalyzerOpts; } +public: + // clang-format off + const LangOptions &getLangOpts() const { return *LangOpts; } + const TargetOptions &getTargetOpts() const { return *TargetOpts; } + const DiagnosticOptions &getDiagnosticOpts() const { return *DiagnosticOpts; } + const HeaderSearchOptions &getHeaderSearchOpts() const { return *HeaderSearchOpts; } + const PreprocessorOptions &getPreprocessorOpts() const { return *PreprocessorOpts; } const AnalyzerOptions &getAnalyzerOpts() const { return *AnalyzerOpts; } + // clang-format on }; /// The base class of CompilerInvocation with value semantics. -class CompilerInvocationValueBase { +class ValBase { ---------------- benlangmuir wrote:
Doesn't have to be this PR, but might be worth just moving everything into RefBase... some of these contain a lot of strings like FrontendOptions and it's not clear ValBase is providing value. https://github.com/llvm/llvm-project/pull/65412 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits