Repository: apple/swift
File: lib/ClangImporter/ImporterImpl.h (C/C++)

Code before:

  /// Used to avoid running the AST verifier over the same declarations.
  size_t VerifiedDeclsCounter = 0;

  /// Clang compiler invocation.
  std::shared_ptr<clang::CompilerInvocation> Invocation;

  /// Clang compiler instance, which is used to actually load Clang
  /// modules.
  std::unique_ptr<clang::CompilerInstance> Instance;

  /// Clang compiler action, which is used to actually run the
  /// parser.
  std::unique_ptr<clang::FrontendAction> Action;

  /// Clang parser, which is used to load textual headers.
  std::unique_ptr<clang::Parser> Parser;

  /// Clang parser, which is used to load textual headers.
  std::unique_ptr<clang::MangleContext> Mangler;

  /// Clang arguments used to create the Clang invocation.
  std::vector<std::string> ClangArgs;

  /// Mapping from Clang swift_attr attribute text to the Swift source file(s)
  /// that contain that attribute text.
  ///
  /// These are re-used when parsing the Swift attributes on import.
  llvm::StringMap<llvm::TinyPtrVector<SourceFile *>> ClangSwiftAttrSourceFiles;

public:
  /// The Swift lookup table for the bridging header.
  std::unique_ptr<SwiftLookupTable> BridgingHeaderLookupTable;

  /// Mapping of already-imported declarations.
  llvm::DenseMap<std::pair<const clang::Decl *, Version>, Decl *> ImportedDecls;

  /// The set of "special" typedef-name declarations, which are
  /// mapped to specific Swift types.
  ///
  /// Normal typedef-name declarations imported into Swift will maintain
  /// equality between the imported declaration's underlying type and the
  /// import of the underlying type. A typedef-name declaration is special
  /// when this is not the case, e.g., Objective-C's "BOOL" has an underlying
  /// type of "signed char", but is mapped to a special Swift struct type
  /// ObjCBool.
  llvm::SmallDenseMap<const clang::TypedefNameDecl *, MappedTypeNameKind, 16>
    SpecialTypedefNames;

  /// Provide a single extension point for any given type per clang
  /// submodule

Review comment (suggestion):
```suggestion
  /// Clang diagnostic options used to create the Clang driver.
  std::unique_ptr<clang::DiagnosticOptions> DiagnosticOptions;
```

The invocation doesn't need external `DiagnosticOptions`.

Code after:

  /// Used to avoid running the AST verifier over the same declarations.
  size_t VerifiedDeclsCounter = 0;

  /// Clang compiler invocation.
  std::shared_ptr<clang::CompilerInvocation> Invocation;

  /// Clang compiler instance, which is used to actually load Clang
  /// modules.
  std::unique_ptr<clang::CompilerInstance> Instance;

  /// Clang compiler action, which is used to actually run the
  /// parser.
  std::unique_ptr<clang::FrontendAction> Action;

  /// Clang parser, which is used to load textual headers.
  std::unique_ptr<clang::Parser> Parser;

  /// Clang parser, which is used to load textual headers.
  std::unique_ptr<clang::MangleContext> Mangler;

  /// Clang arguments used to create the Clang invocation.
  std::vector<std::string> ClangArgs;

  /// Clang diagnostic options used to create the Clang invocation.
  std::unique_ptr<clang::DiagnosticOptions> DiagnosticOptions;

  /// Mapping from Clang swift_attr attribute text to the Swift source file(s)
  /// that contain that attribute text.
  ///
  /// These are re-used when parsing the Swift attributes on import.
  llvm::StringMap<llvm::TinyPtrVector<SourceFile *>> ClangSwiftAttrSourceFiles;

public:
  /// The Swift lookup table for the bridging header.
  std::unique_ptr<SwiftLookupTable> BridgingHeaderLookupTable;

  /// Mapping of already-imported declarations.
  llvm::DenseMap<std::pair<const clang::Decl *, Version>, Decl *> ImportedDecls;

  /// The set of "special" typedef-name declarations, which are
  /// mapped to specific Swift types.
  ///
  /// Normal typedef-name declarations imported into Swift will maintain
  /// equality between the imported declaration's underlying type and the
  /// import of the underlying type. A typedef-name declaration is special
  /// when this is not the case, e.g., Objective-C's "BOOL" has an underlying
  /// type of "signed char", but is mapped to a special Swift struct type
  /// ObjCBool.
  llvm::SmallDenseMap<const clang::TypedefNameDecl *, MappedTypeNameKind, 16>
    SpecialTypedefNames;