[Lldb-commits] [lldb] 4c2a656 - Avoid ASTContext.h -> TargetInfo.h dep
Reid Kleckner via lldb-commits
lldb-commits at lists.llvm.org
Thu Feb 27 14:36:17 PST 2020
Author: Reid Kleckner
Date: 2020-02-27T14:35:00-08:00
New Revision: 4c2a6567bb12559cfc091bca2b25ae907cbd4e0f
URL: https://github.com/llvm/llvm-project/commit/4c2a6567bb12559cfc091bca2b25ae907cbd4e0f
DIFF: https://github.com/llvm/llvm-project/commit/4c2a6567bb12559cfc091bca2b25ae907cbd4e0f.diff
LOG: Avoid ASTContext.h -> TargetInfo.h dep
This has been done before in 2008: ab13857072
But these things regress easily.
Move some things out of line.
Saves 316 includes + transitive stuff:
316 - ../clang/include/clang/Basic/TargetOptions.h
316 - ../clang/include/clang/Basic/TargetInfo.h
316 - ../clang/include/clang/Basic/TargetCXXABI.h
316 - ../clang/include/clang/Basic/OpenCLOptions.h
316 - ../clang/include/clang/Basic/OpenCLExtensions.def
302 - ../llvm/include/llvm/Target/TargetOptions.h
302 - ../llvm/include/llvm/Support/CodeGen.h
302 - ../llvm/include/llvm/MC/MCTargetOptions.h
302 - ../llvm/include/llvm/ADT/FloatingPointMode.h
302 - ../clang/include/clang/Basic/XRayInstr.h
302 - ../clang/include/clang/Basic/DebugInfoOptions.h
302 - ../clang/include/clang/Basic/CodeGenOptions.h
302 - ../clang/include/clang/Basic/CodeGenOptions.def
257 - ../llvm/include/llvm/Support/Regex.h
79 - ../llvm/include/llvm/ADT/SmallSet.h
68 - MSVCSTL/include/set
66 - ../llvm/include/llvm/ADT/SmallPtrSet.h
62 - ../llvm/include/llvm/ADT/StringSwitch.h
Added:
Modified:
clang/include/clang/AST/ASTContext.h
clang/include/clang/Basic/TargetInfo.h
clang/include/clang/StaticAnalyzer/Core/PathSensitive/SMTConstraintManager.h
clang/lib/AST/ASTContext.cpp
clang/lib/AST/Interp/ByteCodeExprGen.h
clang/lib/AST/Interp/Context.cpp
clang/lib/CodeGen/CodeGenModule.h
clang/lib/CodeGen/PatternInit.cpp
clang/unittests/CodeGen/TBAAMetadataTest.cpp
lldb/source/Plugins/Language/ObjC/NSArray.cpp
lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.cpp
lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h
Removed:
################################################################################
diff --git a/clang/include/clang/AST/ASTContext.h b/clang/include/clang/AST/ASTContext.h
index 2640c66cc8dd..92e5921fa375 100644
--- a/clang/include/clang/AST/ASTContext.h
+++ b/clang/include/clang/AST/ASTContext.h
@@ -39,7 +39,6 @@
#include "clang/Basic/SanitizerBlacklist.h"
#include "clang/Basic/SourceLocation.h"
#include "clang/Basic/Specifiers.h"
-#include "clang/Basic/TargetInfo.h"
#include "clang/Basic/XRayLists.h"
#include "llvm/ADT/APSInt.h"
#include "llvm/ADT/ArrayRef.h"
@@ -74,6 +73,7 @@
namespace llvm {
struct fltSemantics;
+template <typename T, unsigned N> class SmallPtrSet;
} // namespace llvm
@@ -131,7 +131,6 @@ class VarTemplateDecl;
class VTableContextBase;
struct BlockVarCopyInit;
-
namespace Builtin {
class Context;
@@ -139,6 +138,7 @@ class Context;
} // namespace Builtin
enum BuiltinTemplateKind : int;
+enum OpenCLTypeKind : uint8_t;
namespace comments {
@@ -1205,7 +1205,7 @@ class ASTContext : public RefCountedBase<ASTContext> {
QualType getBlockDescriptorExtendedType() const;
/// Map an AST Type to an OpenCLTypeKind enum value.
- TargetInfo::OpenCLTypeKind getOpenCLTypeKind(const Type *T) const;
+ OpenCLTypeKind getOpenCLTypeKind(const Type *T) const;
/// Get address space for OpenCL type.
LangAS getOpenCLTypeAddrSpace(const Type *T) const;
@@ -1635,23 +1635,9 @@ class ASTContext : public RefCountedBase<ASTContext> {
return NSCopyingName;
}
- CanQualType getNSUIntegerType() const {
- assert(Target && "Expected target to be initialized");
- const llvm::Triple &T = Target->getTriple();
- // Windows is LLP64 rather than LP64
- if (T.isOSWindows() && T.isArch64Bit())
- return UnsignedLongLongTy;
- return UnsignedLongTy;
- }
+ CanQualType getNSUIntegerType() const;
- CanQualType getNSIntegerType() const {
- assert(Target && "Expected target to be initialized");
- const llvm::Triple &T = Target->getTriple();
- // Windows is LLP64 rather than LP64
- if (T.isOSWindows() && T.isArch64Bit())
- return LongLongTy;
- return LongTy;
- }
+ CanQualType getNSIntegerType() const;
/// Retrieve the identifier 'bool'.
IdentifierInfo *getBoolName() const {
@@ -2129,9 +2115,7 @@ class ASTContext : public RefCountedBase<ASTContext> {
/// Return the alignment (in bytes) of the thrown exception object. This is
/// only meaningful for targets that allocate C++ exceptions in a system
/// runtime, such as those using the Itanium C++ ABI.
- CharUnits getExnObjectAlignment() const {
- return toCharUnitsFromBits(Target->getExnObjectAlignment());
- }
+ CharUnits getExnObjectAlignment() const;
/// Get or compute information about the layout of the specified
/// record (struct/union/class) \p D, which indicates its size and field
diff --git a/clang/include/clang/Basic/TargetInfo.h b/clang/include/clang/Basic/TargetInfo.h
index cb5aabdc468f..80581eabe1b7 100644
--- a/clang/include/clang/Basic/TargetInfo.h
+++ b/clang/include/clang/Basic/TargetInfo.h
@@ -159,6 +159,18 @@ struct TransferrableTargetInfo {
unsigned ZeroLengthBitfieldBoundary;
};
+/// OpenCL type kinds.
+enum OpenCLTypeKind : uint8_t {
+ OCLTK_Default,
+ OCLTK_ClkEvent,
+ OCLTK_Event,
+ OCLTK_Image,
+ OCLTK_Pipe,
+ OCLTK_Queue,
+ OCLTK_ReserveID,
+ OCLTK_Sampler,
+};
+
/// Exposes information about the current target.
///
class TargetInfo : public virtual TransferrableTargetInfo,
@@ -1347,17 +1359,6 @@ class TargetInfo : public virtual TransferrableTargetInfo,
return getTargetOpts().SupportedOpenCLOptions;
}
- enum OpenCLTypeKind {
- OCLTK_Default,
- OCLTK_ClkEvent,
- OCLTK_Event,
- OCLTK_Image,
- OCLTK_Pipe,
- OCLTK_Queue,
- OCLTK_ReserveID,
- OCLTK_Sampler,
- };
-
/// Get address space for OpenCL type.
virtual LangAS getOpenCLTypeAddrSpace(OpenCLTypeKind TK) const;
diff --git a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/SMTConstraintManager.h b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/SMTConstraintManager.h
index 1712501b13bd..294a45b214d7 100644
--- a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/SMTConstraintManager.h
+++ b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/SMTConstraintManager.h
@@ -15,6 +15,7 @@
#define LLVM_CLANG_STATICANALYZER_CORE_PATHSENSITIVE_SMTCONSTRAINTMANAGER_H
#include "clang/Basic/JsonSupport.h"
+#include "clang/Basic/TargetInfo.h"
#include "clang/StaticAnalyzer/Core/PathSensitive/RangedConstraintManager.h"
#include "clang/StaticAnalyzer/Core/PathSensitive/SMTConv.h"
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp
index b816f3baa0e0..bc4f2b491e11 100644
--- a/clang/lib/AST/ASTContext.cpp
+++ b/clang/lib/AST/ASTContext.cpp
@@ -1730,6 +1730,10 @@ CharUnits ASTContext::getDeclAlign(const Decl *D, bool ForAlignof) const {
return toCharUnitsFromBits(Align);
}
+CharUnits ASTContext::getExnObjectAlignment() const {
+ return toCharUnitsFromBits(Target->getExnObjectAlignment());
+}
+
// getTypeInfoDataSizeInChars - Return the size of a type, in
// chars. If the type is a record, its data size is returned. This is
// the size of the memcpy that's performed when assigning this type
@@ -6226,39 +6230,39 @@ QualType ASTContext::getBlockDescriptorExtendedType() const {
return getTagDeclType(BlockDescriptorExtendedType);
}
-TargetInfo::OpenCLTypeKind ASTContext::getOpenCLTypeKind(const Type *T) const {
+OpenCLTypeKind ASTContext::getOpenCLTypeKind(const Type *T) const {
const auto *BT = dyn_cast<BuiltinType>(T);
if (!BT) {
if (isa<PipeType>(T))
- return TargetInfo::OCLTK_Pipe;
+ return OCLTK_Pipe;
- return TargetInfo::OCLTK_Default;
+ return OCLTK_Default;
}
switch (BT->getKind()) {
#define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \
case BuiltinType::Id: \
- return TargetInfo::OCLTK_Image;
+ return OCLTK_Image;
#include "clang/Basic/OpenCLImageTypes.def"
case BuiltinType::OCLClkEvent:
- return TargetInfo::OCLTK_ClkEvent;
+ return OCLTK_ClkEvent;
case BuiltinType::OCLEvent:
- return TargetInfo::OCLTK_Event;
+ return OCLTK_Event;
case BuiltinType::OCLQueue:
- return TargetInfo::OCLTK_Queue;
+ return OCLTK_Queue;
case BuiltinType::OCLReserveID:
- return TargetInfo::OCLTK_ReserveID;
+ return OCLTK_ReserveID;
case BuiltinType::OCLSampler:
- return TargetInfo::OCLTK_Sampler;
+ return OCLTK_Sampler;
default:
- return TargetInfo::OCLTK_Default;
+ return OCLTK_Default;
}
}
@@ -6331,6 +6335,24 @@ bool ASTContext::getByrefLifetime(QualType Ty,
return true;
}
+CanQualType ASTContext::getNSUIntegerType() const {
+ assert(Target && "Expected target to be initialized");
+ const llvm::Triple &T = Target->getTriple();
+ // Windows is LLP64 rather than LP64
+ if (T.isOSWindows() && T.isArch64Bit())
+ return UnsignedLongLongTy;
+ return UnsignedLongTy;
+}
+
+CanQualType ASTContext::getNSIntegerType() const {
+ assert(Target && "Expected target to be initialized");
+ const llvm::Triple &T = Target->getTriple();
+ // Windows is LLP64 rather than LP64
+ if (T.isOSWindows() && T.isArch64Bit())
+ return LongLongTy;
+ return LongTy;
+}
+
TypedefDecl *ASTContext::getObjCInstanceTypeDecl() {
if (!ObjCInstanceTypeDecl)
ObjCInstanceTypeDecl =
diff --git a/clang/lib/AST/Interp/ByteCodeExprGen.h b/clang/lib/AST/Interp/ByteCodeExprGen.h
index 1d0e34fc991f..716f28551e58 100644
--- a/clang/lib/AST/Interp/ByteCodeExprGen.h
+++ b/clang/lib/AST/Interp/ByteCodeExprGen.h
@@ -21,6 +21,7 @@
#include "clang/AST/Decl.h"
#include "clang/AST/Expr.h"
#include "clang/AST/StmtVisitor.h"
+#include "clang/Basic/TargetInfo.h"
#include "llvm/ADT/Optional.h"
namespace clang {
diff --git a/clang/lib/AST/Interp/Context.cpp b/clang/lib/AST/Interp/Context.cpp
index e7f9ba0f010a..3bfcdfcd4c58 100644
--- a/clang/lib/AST/Interp/Context.cpp
+++ b/clang/lib/AST/Interp/Context.cpp
@@ -17,6 +17,7 @@
#include "PrimType.h"
#include "Program.h"
#include "clang/AST/Expr.h"
+#include "clang/Basic/TargetInfo.h"
using namespace clang;
using namespace clang::interp;
diff --git a/clang/lib/CodeGen/CodeGenModule.h b/clang/lib/CodeGen/CodeGenModule.h
index 48a3938ceeec..ff8cea486cc2 100644
--- a/clang/lib/CodeGen/CodeGenModule.h
+++ b/clang/lib/CodeGen/CodeGenModule.h
@@ -26,6 +26,7 @@
#include "clang/Basic/LangOptions.h"
#include "clang/Basic/Module.h"
#include "clang/Basic/SanitizerBlacklist.h"
+#include "clang/Basic/TargetInfo.h"
#include "clang/Basic/XRayLists.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/SetVector.h"
diff --git a/clang/lib/CodeGen/PatternInit.cpp b/clang/lib/CodeGen/PatternInit.cpp
index 3410c7f21533..71c8b94bdef1 100644
--- a/clang/lib/CodeGen/PatternInit.cpp
+++ b/clang/lib/CodeGen/PatternInit.cpp
@@ -8,6 +8,7 @@
#include "PatternInit.h"
#include "CodeGenModule.h"
+#include "clang/Basic/TargetInfo.h"
#include "llvm/IR/Constant.h"
#include "llvm/IR/Type.h"
diff --git a/clang/unittests/CodeGen/TBAAMetadataTest.cpp b/clang/unittests/CodeGen/TBAAMetadataTest.cpp
index 9726838508c1..c2a21bfa7aa1 100644
--- a/clang/unittests/CodeGen/TBAAMetadataTest.cpp
+++ b/clang/unittests/CodeGen/TBAAMetadataTest.cpp
@@ -10,6 +10,7 @@
#include "clang/AST/ASTConsumer.h"
#include "clang/AST/ASTContext.h"
#include "clang/Basic/SourceManager.h"
+#include "clang/Basic/TargetInfo.h"
#include "clang/CodeGen/ModuleBuilder.h"
#include "clang/Frontend/CompilerInstance.h"
#include "clang/Parse/ParseAST.h"
diff --git a/lldb/source/Plugins/Language/ObjC/NSArray.cpp b/lldb/source/Plugins/Language/ObjC/NSArray.cpp
index b3cc9d6cd462..8c889927b936 100644
--- a/lldb/source/Plugins/Language/ObjC/NSArray.cpp
+++ b/lldb/source/Plugins/Language/ObjC/NSArray.cpp
@@ -7,6 +7,7 @@
//===----------------------------------------------------------------------===//
#include "clang/AST/ASTContext.h"
+#include "clang/Basic/TargetInfo.h"
#include "Cocoa.h"
diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
index 50b5f2e250d6..d6b7abc5015a 100644
--- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
+++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
@@ -62,6 +62,7 @@
#include "clang/AST/ASTContext.h"
#include "clang/AST/DeclObjC.h"
+#include "clang/Basic/TargetInfo.h"
#include "Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.h"
diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.cpp
index 5f9bf5deb340..848431855b3b 100644
--- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.cpp
+++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.cpp
@@ -15,6 +15,8 @@
#include "lldb/Target/Target.h"
#include "lldb/Utility/StringLexer.h"
+#include "clang/Basic/TargetInfo.h"
+
#include <vector>
using namespace lldb_private;
diff --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h
index 8864c601c5dc..75e749f5783f 100644
--- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h
+++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h
@@ -23,6 +23,7 @@
#include "clang/AST/ASTContext.h"
#include "clang/AST/ASTFwd.h"
#include "clang/AST/TemplateBase.h"
+#include "clang/Basic/TargetInfo.h"
#include "llvm/ADT/APSInt.h"
#include "llvm/ADT/SmallVector.h"
More information about the lldb-commits
mailing list