https://github.com/davidstone created https://github.com/llvm/llvm-project/pull/93417
None >From f4b9852b0c11a9b5087c5fdb7794b5cab7f4d22c Mon Sep 17 00:00:00 2001 From: David Stone <davidfromonl...@gmail.com> Date: Sun, 26 May 2024 10:34:09 -0600 Subject: [PATCH] [clang][Modules] Remove unnecessary includes of `Module.h` --- .../clangd/unittests/ReplayPeambleTests.cpp | 10 +- .../include/clang/APINotes/APINotesManager.h | 5 +- .../Serialization/SymbolGraphSerializer.h | 1 - clang/include/clang/Serialization/ASTWriter.h | 32 ++--- .../clang/Serialization/ModuleManager.h | 14 +- clang/lib/APINotes/APINotesManager.cpp | 1 + clang/lib/AST/ASTDumper.cpp | 12 +- clang/lib/CodeGen/CodeGenModule.h | 126 ++++++++---------- clang/lib/ExtractAPI/API.cpp | 1 - .../header_exportable_declarations.cpp | 2 - 10 files changed, 93 insertions(+), 111 deletions(-) diff --git a/clang-tools-extra/clangd/unittests/ReplayPeambleTests.cpp b/clang-tools-extra/clangd/unittests/ReplayPeambleTests.cpp index 147d9abe69137..32942e6bbfdc8 100644 --- a/clang-tools-extra/clangd/unittests/ReplayPeambleTests.cpp +++ b/clang-tools-extra/clangd/unittests/ReplayPeambleTests.cpp @@ -25,7 +25,6 @@ #include "clang/AST/DeclTemplate.h" #include "clang/Basic/FileEntry.h" #include "clang/Basic/LLVM.h" -#include "clang/Basic/Module.h" #include "clang/Basic/SourceLocation.h" #include "clang/Basic/SourceManager.h" #include "clang/Basic/TokenKinds.h" @@ -42,7 +41,11 @@ #include <memory> #include <vector> -namespace clang::clangd { +namespace clang { + +class Module; + +namespace clangd { namespace { struct Inclusion { Inclusion(const SourceManager &SM, SourceLocation HashLoc, @@ -170,4 +173,5 @@ TEST(ReplayPreambleTest, IncludesAndSkippedFiles) { } } } // namespace -} // namespace clang::clangd +} // namespace clangd +} // namespace clang diff --git a/clang/include/clang/APINotes/APINotesManager.h b/clang/include/clang/APINotes/APINotesManager.h index 18375c9e51a17..40c6328319dbd 100644 --- a/clang/include/clang/APINotes/APINotesManager.h +++ b/clang/include/clang/APINotes/APINotesManager.h @@ -9,7 +9,6 @@ #ifndef LLVM_CLANG_APINOTES_APINOTESMANAGER_H #define LLVM_CLANG_APINOTES_APINOTESMANAGER_H -#include "clang/Basic/Module.h" #include "clang/Basic/SourceLocation.h" #include "llvm/ADT/ArrayRef.h" #include "llvm/ADT/DenseMap.h" @@ -24,6 +23,7 @@ namespace clang { class DirectoryEntry; class FileEntry; class LangOptions; +class Module; class SourceManager; namespace api_notes { @@ -159,7 +159,8 @@ class APINotesManager { ArrayRef<APINotesReader *> getCurrentModuleReaders() const { bool HasPublic = CurrentModuleReaders[ReaderKind::Public]; bool HasPrivate = CurrentModuleReaders[ReaderKind::Private]; - assert((!HasPrivate || HasPublic) && "private module requires public module"); + assert((!HasPrivate || HasPublic) && + "private module requires public module"); if (!HasPrivate && !HasPublic) return {}; return ArrayRef(CurrentModuleReaders).slice(0, HasPrivate ? 2 : 1); diff --git a/clang/include/clang/ExtractAPI/Serialization/SymbolGraphSerializer.h b/clang/include/clang/ExtractAPI/Serialization/SymbolGraphSerializer.h index 27e9167ca1ad0..f8759bf2d8f25 100644 --- a/clang/include/clang/ExtractAPI/Serialization/SymbolGraphSerializer.h +++ b/clang/include/clang/ExtractAPI/Serialization/SymbolGraphSerializer.h @@ -17,7 +17,6 @@ #ifndef LLVM_CLANG_EXTRACTAPI_SERIALIZATION_SYMBOLGRAPHSERIALIZER_H #define LLVM_CLANG_EXTRACTAPI_SERIALIZATION_SYMBOLGRAPHSERIALIZER_H -#include "clang/Basic/Module.h" #include "clang/ExtractAPI/API.h" #include "clang/ExtractAPI/APIIgnoresList.h" #include "clang/ExtractAPI/Serialization/APISetVisitor.h" diff --git a/clang/include/clang/Serialization/ASTWriter.h b/clang/include/clang/Serialization/ASTWriter.h index 88192e439a3f0..ddd3514b3c2db 100644 --- a/clang/include/clang/Serialization/ASTWriter.h +++ b/clang/include/clang/Serialization/ASTWriter.h @@ -18,7 +18,6 @@ #include "clang/AST/Decl.h" #include "clang/AST/Type.h" #include "clang/Basic/LLVM.h" -#include "clang/Basic/Module.h" #include "clang/Basic/SourceLocation.h" #include "clang/Sema/Sema.h" #include "clang/Sema/SemaConsumer.h" @@ -277,7 +276,8 @@ class ASTWriter : public ASTDeserializationListener, std::vector<serialization::UnalignedUInt64> TypeOffsets; /// The first ID number we can use for our own identifiers. - serialization::IdentifierID FirstIdentID = serialization::NUM_PREDEF_IDENT_IDS; + serialization::IdentifierID FirstIdentID = + serialization::NUM_PREDEF_IDENT_IDS; /// The identifier ID that will be assigned to the next new identifier. serialization::IdentifierID NextIdentID = FirstIdentID; @@ -288,7 +288,8 @@ class ASTWriter : public ASTDeserializationListener, /// The ID numbers for identifiers are consecutive (in order of /// discovery), starting at 1. An ID of zero refers to a NULL /// IdentifierInfo. - llvm::MapVector<const IdentifierInfo *, serialization::IdentifierID> IdentifierIDs; + llvm::MapVector<const IdentifierInfo *, serialization::IdentifierID> + IdentifierIDs; /// The first ID number we can use for our own macros. serialization::MacroID FirstMacroID = serialization::NUM_PREDEF_MACRO_IDS; @@ -351,7 +352,8 @@ class ASTWriter : public ASTDeserializationListener, /// Mapping from macro definitions (as they occur in the preprocessing /// record) to the macro IDs. llvm::DenseMap<const MacroDefinitionRecord *, - serialization::PreprocessedEntityID> MacroDefinitions; + serialization::PreprocessedEntityID> + MacroDefinitions; /// Cache of indices of anonymous declarations within their lexical /// contexts. @@ -387,7 +389,7 @@ class ASTWriter : public ASTDeserializationListener, DeclUpdate(unsigned Kind, unsigned Val) : Kind(Kind), Val(Val) {} DeclUpdate(unsigned Kind, Module *M) : Kind(Kind), Mod(M) {} DeclUpdate(unsigned Kind, const Attr *Attribute) - : Kind(Kind), Attribute(Attribute) {} + : Kind(Kind), Attribute(Attribute) {} unsigned getKind() const { return Kind; } const Decl *getDecl() const { return Dcl; } @@ -426,11 +428,10 @@ class ASTWriter : public ASTDeserializationListener, /// We keep track of external definitions and other 'interesting' declarations /// as we are emitting declarations to the AST file. The AST file contains a /// separate record for these declarations, which are provided to the AST - /// consumer by the AST reader. This is behavior is required to properly cope with, - /// e.g., tentative variable definitions that occur within - /// headers. The declarations themselves are stored as declaration - /// IDs, since they will be written out to an EAGERLY_DESERIALIZED_DECLS - /// record. + /// consumer by the AST reader. This is behavior is required to properly cope + /// with, e.g., tentative variable definitions that occur within headers. The + /// declarations themselves are stored as declaration IDs, since they will be + /// written out to an EAGERLY_DESERIALIZED_DECLS record. RecordData EagerlyDeserializedDecls; RecordData ModularCodegenDecls; @@ -772,8 +773,8 @@ class ASTWriter : public ASTDeserializationListener, void AddVersionTuple(const VersionTuple &Version, RecordDataImpl &Record); /// Retrieve or create a submodule ID for this module, or return 0 if - /// the submodule is neither local (a submodle of the currently-written module) - /// nor from an imported module. + /// the submodule is neither local (a submodle of the currently-written + /// module) nor from an imported module. unsigned getLocalOrImportedSubmoduleID(const Module *Mod); /// Note that the identifier II occurs at the given offset @@ -792,9 +793,7 @@ class ASTWriter : public ASTDeserializationListener, void ClearSwitchCaseIDs(); - unsigned getTypeExtQualAbbrev() const { - return TypeExtQualAbbrev; - } + unsigned getTypeExtQualAbbrev() const { return TypeExtQualAbbrev; } unsigned getDeclParmVarAbbrev() const { return DeclParmVarAbbrev; } unsigned getDeclRecordAbbrev() const { return DeclRecordAbbrev; } @@ -853,7 +852,8 @@ class ASTWriter : public ASTDeserializationListener, private: // ASTDeserializationListener implementation void ReaderInitialized(ASTReader *Reader) override; - void IdentifierRead(serialization::IdentifierID ID, IdentifierInfo *II) override; + void IdentifierRead(serialization::IdentifierID ID, + IdentifierInfo *II) override; void MacroRead(serialization::MacroID ID, MacroInfo *MI) override; void TypeRead(serialization::TypeIdx Idx, QualType T) override; void SelectorRead(serialization::SelectorID ID, Selector Sel) override; diff --git a/clang/include/clang/Serialization/ModuleManager.h b/clang/include/clang/Serialization/ModuleManager.h index 3bd379acf7eda..09931328491b8 100644 --- a/clang/include/clang/Serialization/ModuleManager.h +++ b/clang/include/clang/Serialization/ModuleManager.h @@ -15,7 +15,6 @@ #define LLVM_CLANG_SERIALIZATION_MODULEMANAGER_H #include "clang/Basic/LLVM.h" -#include "clang/Basic/Module.h" #include "clang/Basic/SourceLocation.h" #include "clang/Serialization/ModuleFile.h" #include "llvm/ADT/DenseMap.h" @@ -100,9 +99,7 @@ class ModuleManager { /// State used by the "visit" operation to avoid malloc traffic in /// calls to visit(). struct VisitState { - explicit VisitState(unsigned N) : VisitNumber(N, 0) { - Stack.reserve(N); - } + explicit VisitState(unsigned N) : VisitNumber(N, 0) { Stack.reserve(N); } /// The stack used when marking the imports of a particular module /// as not-to-be-visited. @@ -240,13 +237,12 @@ class ModuleManager { /// \return A pointer to the module that corresponds to this file name, /// and a value indicating whether the module was loaded. AddModuleResult addModule(StringRef FileName, ModuleKind Type, - SourceLocation ImportLoc, - ModuleFile *ImportedBy, unsigned Generation, - off_t ExpectedSize, time_t ExpectedModTime, + SourceLocation ImportLoc, ModuleFile *ImportedBy, + unsigned Generation, off_t ExpectedSize, + time_t ExpectedModTime, ASTFileSignature ExpectedSignature, ASTFileSignatureReader ReadSignature, - ModuleFile *&Module, - std::string &ErrorStr); + ModuleFile *&Module, std::string &ErrorStr); /// Remove the modules starting from First (to the end). void removeModules(ModuleIterator First); diff --git a/clang/lib/APINotes/APINotesManager.cpp b/clang/lib/APINotes/APINotesManager.cpp index 789bb97d81de0..039d09fa7cf57 100644 --- a/clang/lib/APINotes/APINotesManager.cpp +++ b/clang/lib/APINotes/APINotesManager.cpp @@ -12,6 +12,7 @@ #include "clang/Basic/Diagnostic.h" #include "clang/Basic/FileManager.h" #include "clang/Basic/LangOptions.h" +#include "clang/Basic/Module.h" #include "clang/Basic/SourceManager.h" #include "clang/Basic/SourceMgrAdapter.h" #include "clang/Basic/Version.h" diff --git a/clang/lib/AST/ASTDumper.cpp b/clang/lib/AST/ASTDumper.cpp index 6efc5bb92e28d..85779379d6d42 100644 --- a/clang/lib/AST/ASTDumper.cpp +++ b/clang/lib/AST/ASTDumper.cpp @@ -17,7 +17,6 @@ #include "clang/AST/DeclLookups.h" #include "clang/AST/JSONNodeDumper.h" #include "clang/Basic/Builtins.h" -#include "clang/Basic/Module.h" #include "clang/Basic/SourceManager.h" #include "llvm/Support/raw_ostream.h" @@ -242,9 +241,7 @@ LLVM_DUMP_METHOD void Decl::dumpColor() const { P.Visit(this); } -LLVM_DUMP_METHOD void DeclContext::dumpAsDecl() const { - dumpAsDecl(nullptr); -} +LLVM_DUMP_METHOD void DeclContext::dumpAsDecl() const { dumpAsDecl(nullptr); } LLVM_DUMP_METHOD void DeclContext::dumpAsDecl(const ASTContext *Ctx) const { // By design, DeclContext is required to be a base class of some class that @@ -271,8 +268,7 @@ LLVM_DUMP_METHOD void DeclContext::dumpLookups() const { dumpLookups(llvm::errs()); } -LLVM_DUMP_METHOD void DeclContext::dumpLookups(raw_ostream &OS, - bool DumpDecls, +LLVM_DUMP_METHOD void DeclContext::dumpLookups(raw_ostream &OS, bool DumpDecls, bool Deserialize) const { const DeclContext *DC = this; while (!DC->isTranslationUnit()) @@ -352,9 +348,7 @@ LLVM_DUMP_METHOD void APValue::dump(raw_ostream &OS, // ConceptReference method implementations //===----------------------------------------------------------------------===// -LLVM_DUMP_METHOD void ConceptReference::dump() const { - dump(llvm::errs()); -} +LLVM_DUMP_METHOD void ConceptReference::dump() const { dump(llvm::errs()); } LLVM_DUMP_METHOD void ConceptReference::dump(raw_ostream &OS) const { auto &Ctx = getNamedConcept()->getASTContext(); diff --git a/clang/lib/CodeGen/CodeGenModule.h b/clang/lib/CodeGen/CodeGenModule.h index 0f68418130ead..c80c59bf12b68 100644 --- a/clang/lib/CodeGen/CodeGenModule.h +++ b/clang/lib/CodeGen/CodeGenModule.h @@ -24,7 +24,6 @@ #include "clang/AST/Mangle.h" #include "clang/Basic/ABI.h" #include "clang/Basic/LangOptions.h" -#include "clang/Basic/Module.h" #include "clang/Basic/NoSanitizeList.h" #include "clang/Basic/ProfileList.h" #include "clang/Basic/TargetInfo.h" @@ -54,7 +53,7 @@ class IndexedInstrProfReader; namespace vfs { class FileSystem; } -} +} // namespace llvm namespace clang { class ASTContext; @@ -96,10 +95,7 @@ class CGHLSLRuntime; class CoverageMappingModuleGen; class TargetCodeGenInfo; -enum ForDefinition_t : bool { - NotForDefinition = false, - ForDefinition = true -}; +enum ForDefinition_t : bool { NotForDefinition = false, ForDefinition = true }; struct OrderGlobalInitsOrStermFinalizers { unsigned int priority; @@ -302,8 +298,8 @@ class CodeGenModule : public CodeGenTypeCache { ASTContext &Context; const LangOptions &LangOpts; IntrusiveRefCntPtr<llvm::vfs::FileSystem> FS; // Only used for debug info. - const HeaderSearchOptions &HeaderSearchOpts; // Only used for debug info. - const PreprocessorOptions &PreprocessorOpts; // Only used for debug info. + const HeaderSearchOptions &HeaderSearchOpts; // Only used for debug info. + const PreprocessorOptions &PreprocessorOpts; // Only used for debug info. const CodeGenOptions &CodeGenOpts; unsigned NumAutoVarInit = 0; llvm::Module &TheModule; @@ -340,7 +336,7 @@ class CodeGenModule : public CodeGenTypeCache { // A set of references that have only been seen via a weakref so far. This is // used to remove the weak of the reference if we ever see a direct reference // or a definition. - llvm::SmallPtrSet<llvm::GlobalValue*, 10> WeakRefReferences; + llvm::SmallPtrSet<llvm::GlobalValue *, 10> WeakRefReferences; /// This contains all the decls which have definitions but/ which are deferred /// for emission and therefore should only be output if they are actually @@ -395,11 +391,11 @@ class CodeGenModule : public CodeGenTypeCache { /// want to replace a GlobalValue but can't identify it by its mangled name /// anymore (because the name is already taken). llvm::SmallVector<std::pair<llvm::GlobalValue *, llvm::Constant *>, 8> - GlobalValReplacements; + GlobalValReplacements; /// Variables for which we've emitted globals containing their constant /// values along with the corresponding globals, for opportunistic reuse. - llvm::DenseMap<const VarDecl*, llvm::GlobalVariable*> InitializerConstants; + llvm::DenseMap<const VarDecl *, llvm::GlobalVariable *> InitializerConstants; /// Set of global decls for which we already diagnosed mangled name conflict. /// Required to not issue a warning (on a mangling conflict) multiple times @@ -407,7 +403,7 @@ class CodeGenModule : public CodeGenTypeCache { llvm::DenseSet<GlobalDecl> DiagnosedConflictingDefinitions; /// A queue of (optional) vtables to consider emitting. - std::vector<const CXXRecordDecl*> DeferredVTables; + std::vector<const CXXRecordDecl *> DeferredVTables; /// A queue of (optional) vtables that may be emitted opportunistically. std::vector<const CXXRecordDecl *> OpportunisticVTables; @@ -431,14 +427,14 @@ class CodeGenModule : public CodeGenTypeCache { llvm::StringMap<GlobalDecl, llvm::BumpPtrAllocator> Manglings; /// Global annotations. - std::vector<llvm::Constant*> Annotations; + std::vector<llvm::Constant *> Annotations; // Store deferred function annotations so they can be emitted at the end with // most up to date ValueDecl that will have all the inherited annotations. llvm::DenseMap<StringRef, const ValueDecl *> DeferredAnnotations; /// Map used to get unique annotation strings. - llvm::StringMap<llvm::Constant*> AnnotationStrings; + llvm::StringMap<llvm::Constant *> AnnotationStrings; /// Used for uniquing of annotation arguments. llvm::DenseMap<unsigned, llvm::Constant *> AnnotationArgs; @@ -448,9 +444,9 @@ class CodeGenModule : public CodeGenTypeCache { llvm::DenseMap<llvm::Constant *, llvm::GlobalVariable *> ConstantStringMap; llvm::DenseMap<const UnnamedGlobalConstantDecl *, llvm::GlobalVariable *> UnnamedGlobalConstantDeclMap; - llvm::DenseMap<const Decl*, llvm::Constant *> StaticLocalDeclMap; - llvm::DenseMap<const Decl*, llvm::GlobalVariable*> StaticLocalDeclGuardMap; - llvm::DenseMap<const Expr*, llvm::Constant *> MaterializedGlobalTemporaryMap; + llvm::DenseMap<const Decl *, llvm::Constant *> StaticLocalDeclMap; + llvm::DenseMap<const Decl *, llvm::GlobalVariable *> StaticLocalDeclGuardMap; + llvm::DenseMap<const Expr *, llvm::Constant *> MaterializedGlobalTemporaryMap; llvm::DenseMap<QualType, llvm::Constant *> AtomicSetterHelperFnMap; llvm::DenseMap<QualType, llvm::Constant *> AtomicGetterHelperFnMap; @@ -460,8 +456,8 @@ class CodeGenModule : public CodeGenTypeCache { /// Map used to track internal linkage functions declared within /// extern "C" regions. - typedef llvm::MapVector<IdentifierInfo *, - llvm::GlobalValue *> StaticExternCMap; + typedef llvm::MapVector<IdentifierInfo *, llvm::GlobalValue *> + StaticExternCMap; StaticExternCMap StaticExternCValues; /// thread_local variables defined or used in this TU. @@ -480,7 +476,7 @@ class CodeGenModule : public CodeGenTypeCache { /// here so that the initializer will be performed in the correct /// order. Once the decl is emitted, the index is replaced with ~0U to ensure /// that we don't re-emit the initializer. - llvm::DenseMap<const Decl*, unsigned> DelayedCXXInitPosition; + llvm::DenseMap<const Decl *, unsigned> DelayedCXXInitPosition; typedef std::pair<OrderGlobalInitsOrStermFinalizers, llvm::Function *> GlobalInitData; @@ -629,7 +625,8 @@ class CodeGenModule : public CodeGenTypeCache { /// Return a reference to the configured Objective-C runtime. CGObjCRuntime &getObjCRuntime() { - if (!ObjCRuntime) createObjCRuntime(); + if (!ObjCRuntime) + createObjCRuntime(); return *ObjCRuntime; } @@ -683,8 +680,7 @@ class CodeGenModule : public CodeGenTypeCache { llvm::Constant *getStaticLocalDeclAddress(const VarDecl *D) { return StaticLocalDeclMap[D]; } - void setStaticLocalDeclAddress(const VarDecl *D, - llvm::Constant *C) { + void setStaticLocalDeclAddress(const VarDecl *D, llvm::Constant *C) { StaticLocalDeclMap[D] = C; } @@ -709,16 +705,14 @@ class CodeGenModule : public CodeGenTypeCache { llvm::Constant *getAtomicSetterHelperFnMap(QualType Ty) { return AtomicSetterHelperFnMap[Ty]; } - void setAtomicSetterHelperFnMap(QualType Ty, - llvm::Constant *Fn) { + void setAtomicSetterHelperFnMap(QualType Ty, llvm::Constant *Fn) { AtomicSetterHelperFnMap[Ty] = Fn; } llvm::Constant *getAtomicGetterHelperFnMap(QualType Ty) { return AtomicGetterHelperFnMap[Ty]; } - void setAtomicGetterHelperFnMap(QualType Ty, - llvm::Constant *Fn) { + void setAtomicGetterHelperFnMap(QualType Ty, llvm::Constant *Fn) { AtomicGetterHelperFnMap[Ty] = Fn; } @@ -743,10 +737,12 @@ class CodeGenModule : public CodeGenTypeCache { const IntrusiveRefCntPtr<llvm::vfs::FileSystem> &getFileSystem() const { return FS; } - const HeaderSearchOptions &getHeaderSearchOpts() - const { return HeaderSearchOpts; } - const PreprocessorOptions &getPreprocessorOpts() - const { return PreprocessorOpts; } + const HeaderSearchOptions &getHeaderSearchOpts() const { + return HeaderSearchOpts; + } + const PreprocessorOptions &getPreprocessorOpts() const { + return PreprocessorOpts; + } const CodeGenOptions &getCodeGenOpts() const { return CodeGenOpts; } llvm::Module &getModule() const { return TheModule; } DiagnosticsEngine &getDiags() const { return Diags; } @@ -873,16 +869,19 @@ class CodeGenModule : public CodeGenTypeCache { static llvm::GlobalValue::VisibilityTypes GetLLVMVisibility(Visibility V) { switch (V) { - case DefaultVisibility: return llvm::GlobalValue::DefaultVisibility; - case HiddenVisibility: return llvm::GlobalValue::HiddenVisibility; - case ProtectedVisibility: return llvm::GlobalValue::ProtectedVisibility; + case DefaultVisibility: + return llvm::GlobalValue::DefaultVisibility; + case HiddenVisibility: + return llvm::GlobalValue::HiddenVisibility; + case ProtectedVisibility: + return llvm::GlobalValue::ProtectedVisibility; } llvm_unreachable("unknown visibility!"); } - llvm::Constant *GetAddrOfGlobal(GlobalDecl GD, - ForDefinition_t IsForDefinition - = NotForDefinition); + llvm::Constant * + GetAddrOfGlobal(GlobalDecl GD, + ForDefinition_t IsForDefinition = NotForDefinition); /// Will return a global variable of the given type. If a variable with a /// different type already exists then a new variable with the right type @@ -922,18 +921,16 @@ class CodeGenModule : public CodeGenTypeCache { /// would be. If IsForDefinition is true, it is guaranteed that an actual /// global with type Ty will be returned, not conversion of a variable with /// the same mangled name but some other type. - llvm::Constant *GetAddrOfGlobalVar(const VarDecl *D, - llvm::Type *Ty = nullptr, - ForDefinition_t IsForDefinition - = NotForDefinition); + llvm::Constant * + GetAddrOfGlobalVar(const VarDecl *D, llvm::Type *Ty = nullptr, + ForDefinition_t IsForDefinition = NotForDefinition); /// Return the address of the given function. If Ty is non-null, then this /// function will use the specified type if it has to create it. - llvm::Constant *GetAddrOfFunction(GlobalDecl GD, llvm::Type *Ty = nullptr, - bool ForVTable = false, - bool DontDefer = false, - ForDefinition_t IsForDefinition - = NotForDefinition); + llvm::Constant * + GetAddrOfFunction(GlobalDecl GD, llvm::Type *Ty = nullptr, + bool ForVTable = false, bool DontDefer = false, + ForDefinition_t IsForDefinition = NotForDefinition); // Return the function body address of the given function. llvm::Constant *GetFunctionStart(const ValueDecl *Decl); @@ -1035,26 +1032,24 @@ class CodeGenModule : public CodeGenTypeCache { llvm::Constant *GetConstantArrayFromStringLiteral(const StringLiteral *E); /// Return a pointer to a constant array for the given string literal. - ConstantAddress - GetAddrOfConstantStringFromLiteral(const StringLiteral *S, - StringRef Name = ".str"); + ConstantAddress GetAddrOfConstantStringFromLiteral(const StringLiteral *S, + StringRef Name = ".str"); /// Return a pointer to a constant array for the given ObjCEncodeExpr node. - ConstantAddress - GetAddrOfConstantStringFromObjCEncode(const ObjCEncodeExpr *); + ConstantAddress GetAddrOfConstantStringFromObjCEncode(const ObjCEncodeExpr *); /// Returns a pointer to a character array containing the literal and a /// terminating '\0' character. The result has pointer to array type. /// /// \param GlobalName If provided, the name to use for the global (if one is /// created). - ConstantAddress - GetAddrOfConstantCString(const std::string &Str, - const char *GlobalName = nullptr); + ConstantAddress GetAddrOfConstantCString(const std::string &Str, + const char *GlobalName = nullptr); /// Returns a pointer to a constant global variable for the given file-scope /// compound literal expression. - ConstantAddress GetAddrOfConstantCompoundLiteral(const CompoundLiteralExpr*E); + ConstantAddress + GetAddrOfConstantCompoundLiteral(const CompoundLiteralExpr *E); /// If it's been emitted already, returns the GlobalVariable corresponding to /// a compound literal. Otherwise, returns null. @@ -1129,7 +1124,7 @@ class CodeGenModule : public CodeGenTypeCache { /// If the declaration has internal linkage but is inside an /// extern "C" linkage specification, prepare to emit an alias for it /// to the expected name. - template<typename SomeDecl> + template <typename SomeDecl> void MaybeHandleStaticInExternC(const SomeDecl *D, llvm::GlobalValue *GV); /// Add a global to a list to be added to the llvm.used metadata. @@ -1176,8 +1171,7 @@ class CodeGenModule : public CodeGenTypeCache { bool Local = false, bool AssumeConvergent = false); /// Create a new runtime global variable with the specified type and name. - llvm::Constant *CreateRuntimeVariable(llvm::Type *Ty, - StringRef Name); + llvm::Constant *CreateRuntimeVariable(llvm::Type *Ty, StringRef Name); ///@name Custom Blocks Runtime Interfaces ///@{ @@ -1300,7 +1294,6 @@ class CodeGenModule : public CodeGenTypeCache { /// Appends a dependent lib to the appropriate metadata value. void AddDependentLib(StringRef Lib); - llvm::GlobalVariable::LinkageTypes getFunctionLinkage(GlobalDecl GD); void setFunctionLinkage(GlobalDecl GD, llvm::Function *F) { @@ -1345,8 +1338,7 @@ class CodeGenModule : public CodeGenTypeCache { /// string containing the name of the translation unit. The fourth field is /// the line number in the file of the annotated value declaration. llvm::Constant *EmitAnnotateAttr(llvm::GlobalValue *GV, - const AnnotateAttr *AA, - SourceLocation L); + const AnnotateAttr *AA, SourceLocation L); /// Add global annotations that are set on D, for the global GV. Those /// annotations are emitted during finalization of the LLVM code. @@ -1376,9 +1368,7 @@ class CodeGenModule : public CodeGenTypeCache { isFunctionBlockedFromProfileInstr(llvm::Function *Fn, SourceLocation Loc) const; - SanitizerMetadata *getSanitizerMetadata() { - return SanitizerMD.get(); - } + SanitizerMetadata *getSanitizerMetadata() { return SanitizerMD.get(); } void addDeferredVTable(const CXXRecordDecl *RD) { DeferredVTables.push_back(RD); @@ -1507,8 +1497,8 @@ class CodeGenModule : public CodeGenTypeCache { llvm::SanitizerStatReport &getSanStats(); - llvm::Value * - createOpenCLIntToSamplerConversion(const Expr *E, CodeGenFunction &CGF); + llvm::Value *createOpenCLIntToSamplerConversion(const Expr *E, + CodeGenFunction &CGF); /// OpenCL v1.2 s5.6.4.6 allows the compiler to store kernel argument /// information in the program executable. The argument information stored @@ -1784,7 +1774,7 @@ class CodeGenModule : public CodeGenTypeCache { StringRef Suffix); }; -} // end namespace CodeGen -} // end namespace clang +} // end namespace CodeGen +} // end namespace clang #endif // LLVM_CLANG_LIB_CODEGEN_CODEGENMODULE_H diff --git a/clang/lib/ExtractAPI/API.cpp b/clang/lib/ExtractAPI/API.cpp index 96bef967d8591..ab1108f663dea 100644 --- a/clang/lib/ExtractAPI/API.cpp +++ b/clang/lib/ExtractAPI/API.cpp @@ -14,7 +14,6 @@ #include "clang/ExtractAPI/API.h" #include "clang/AST/RawCommentList.h" -#include "clang/Basic/Module.h" #include "clang/Index/USRGeneration.h" #include "llvm/ADT/StringRef.h" #include "llvm/Support/ErrorHandling.h" diff --git a/libcxx/test/tools/clang_tidy_checks/header_exportable_declarations.cpp b/libcxx/test/tools/clang_tidy_checks/header_exportable_declarations.cpp index 0a48f855fba06..6124bd30b19f0 100644 --- a/libcxx/test/tools/clang_tidy_checks/header_exportable_declarations.cpp +++ b/libcxx/test/tools/clang_tidy_checks/header_exportable_declarations.cpp @@ -9,8 +9,6 @@ #include "clang-tidy/ClangTidyCheck.h" #include "clang-tidy/ClangTidyModuleRegistry.h" -#include "clang/Basic/Module.h" - #include "llvm/ADT/ArrayRef.h" #include "header_exportable_declarations.hpp" _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits