summaryrefslogtreecommitdiff
path: root/include/clang/AST
diff options
context:
space:
mode:
Diffstat (limited to 'include/clang/AST')
-rw-r--r--include/clang/AST/ASTContext.h5
-rw-r--r--include/clang/AST/CXXInheritance.h6
-rw-r--r--include/clang/AST/DeclBase.h24
-rw-r--r--include/clang/AST/Type.h16
4 files changed, 33 insertions, 18 deletions
diff --git a/include/clang/AST/ASTContext.h b/include/clang/AST/ASTContext.h
index 474cf2c0e3f32..4c379620ab2d5 100644
--- a/include/clang/AST/ASTContext.h
+++ b/include/clang/AST/ASTContext.h
@@ -935,7 +935,7 @@ public:
/// \brief Get the additional modules in which the definition \p Def has
/// been merged.
- ArrayRef<Module*> getModulesWithMergedDefinition(NamedDecl *Def) {
+ ArrayRef<Module*> getModulesWithMergedDefinition(const NamedDecl *Def) {
auto MergedIt = MergedDefModules.find(Def);
if (MergedIt == MergedDefModules.end())
return None;
@@ -2324,8 +2324,7 @@ public:
uint64_t getTargetNullPointerValue(QualType QT) const;
bool addressSpaceMapManglingFor(unsigned AS) const {
- return AddrSpaceMapMangling ||
- AS >= LangAS::Count;
+ return AddrSpaceMapMangling || AS >= LangAS::FirstTargetAddressSpace;
}
private:
diff --git a/include/clang/AST/CXXInheritance.h b/include/clang/AST/CXXInheritance.h
index a7961ebe8ce6a..980608570fd68 100644
--- a/include/clang/AST/CXXInheritance.h
+++ b/include/clang/AST/CXXInheritance.h
@@ -127,7 +127,11 @@ class CXXBasePaths {
/// class subobjects for that class type. The key of the map is
/// the cv-unqualified canonical type of the base class subobject.
llvm::SmallDenseMap<QualType, std::pair<bool, unsigned>, 8> ClassSubobjects;
-
+
+ /// VisitedDependentRecords - Records the dependent records that have been
+ /// already visited.
+ llvm::SmallDenseSet<const CXXRecordDecl *, 4> VisitedDependentRecords;
+
/// FindAmbiguities - Whether Sema::IsDerivedFrom should try find
/// ambiguous paths while it is looking for a path from a derived
/// type to a base type.
diff --git a/include/clang/AST/DeclBase.h b/include/clang/AST/DeclBase.h
index 08879b36cce54..c26e2d7bde95a 100644
--- a/include/clang/AST/DeclBase.h
+++ b/include/clang/AST/DeclBase.h
@@ -34,6 +34,7 @@ class DeclarationName;
class DependentDiagnostic;
class EnumDecl;
class ExportDecl;
+class ExternalSourceSymbolAttr;
class FunctionDecl;
class FunctionType;
enum Linkage : unsigned char;
@@ -332,15 +333,15 @@ private:
bool AccessDeclContextSanity() const;
protected:
-
Decl(Kind DK, DeclContext *DC, SourceLocation L)
- : NextInContextAndBits(), DeclCtx(DC),
- Loc(L), DeclKind(DK), InvalidDecl(0),
- HasAttrs(false), Implicit(false), Used(false), Referenced(false),
- Access(AS_none), FromASTFile(0), Hidden(DC && cast<Decl>(DC)->Hidden),
- IdentifierNamespace(getIdentifierNamespaceForKind(DK)),
- CacheValidAndLinkage(0)
- {
+ : NextInContextAndBits(), DeclCtx(DC), Loc(L), DeclKind(DK),
+ InvalidDecl(0), HasAttrs(false), Implicit(false), Used(false),
+ Referenced(false), Access(AS_none), FromASTFile(0),
+ Hidden(DC && cast<Decl>(DC)->Hidden &&
+ (!cast<Decl>(DC)->isFromASTFile() ||
+ hasLocalOwningModuleStorage())),
+ IdentifierNamespace(getIdentifierNamespaceForKind(DK)),
+ CacheValidAndLinkage(0) {
if (StatisticsEnabled) add(DK);
}
@@ -562,6 +563,10 @@ public:
NextInContextAndBits.setInt(Bits);
}
+ /// \brief Looks on this and related declarations for an applicable
+ /// external source symbol attribute.
+ ExternalSourceSymbolAttr *getExternalSourceSymbolAttr() const;
+
/// \brief Whether this declaration was marked as being private to the
/// module in which it was defined.
bool isModulePrivate() const {
@@ -698,6 +703,9 @@ public:
Module *getLocalOwningModule() const {
if (isFromASTFile() || !Hidden)
return nullptr;
+
+ assert(hasLocalOwningModuleStorage() &&
+ "hidden local decl but no local module storage");
return reinterpret_cast<Module *const *>(this)[-1];
}
void setLocalOwningModule(Module *M) {
diff --git a/include/clang/AST/Type.h b/include/clang/AST/Type.h
index b1c2503c32e3d..9eb6d81296d8a 100644
--- a/include/clang/AST/Type.h
+++ b/include/clang/AST/Type.h
@@ -333,15 +333,18 @@ public:
bool hasAddressSpace() const { return Mask & AddressSpaceMask; }
unsigned getAddressSpace() const { return Mask >> AddressSpaceShift; }
+ bool hasTargetSpecificAddressSpace() const {
+ return getAddressSpace() >= LangAS::FirstTargetAddressSpace;
+ }
/// Get the address space attribute value to be printed by diagnostics.
unsigned getAddressSpaceAttributePrintValue() const {
auto Addr = getAddressSpace();
// This function is not supposed to be used with language specific
// address spaces. If that happens, the diagnostic message should consider
// printing the QualType instead of the address space value.
- assert(Addr == 0 || Addr >= LangAS::Count);
+ assert(Addr == 0 || hasTargetSpecificAddressSpace());
if (Addr)
- return Addr - LangAS::Count;
+ return Addr - LangAS::FirstTargetAddressSpace;
// TODO: The diagnostic messages where Addr may be 0 should be fixed
// since it cannot differentiate the situation where 0 denotes the default
// address space or user specified __attribute__((address_space(0))).
@@ -2008,10 +2011,11 @@ public:
Optional<NullabilityKind> getNullability(const ASTContext &context) const;
/// Determine whether the given type can have a nullability
- /// specifier applied to it, i.e., if it is any kind of pointer type
- /// or a dependent type that could instantiate to any kind of
- /// pointer type.
- bool canHaveNullability() const;
+ /// specifier applied to it, i.e., if it is any kind of pointer type.
+ ///
+ /// \param ResultIfUnknown The value to return if we don't yet know whether
+ /// this type can have nullability because it is dependent.
+ bool canHaveNullability(bool ResultIfUnknown = true) const;
/// Retrieve the set of substitutions required when accessing a member
/// of the Objective-C receiver type that is declared in the given context.