Make Decl::setOwningModuleID() public. (NFC)

This API is going to be used by LLDB to recreate owning module
information for Decls deserialized from DWARF.

Differential Revision: https://reviews.llvm.org/D75560
This commit is contained in:
Adrian Prantl 2020-03-03 12:54:04 -08:00
parent ae73ab64b6
commit 2b366e75d4
4 changed files with 17 additions and 3 deletions

View File

@ -3539,6 +3539,7 @@ class EnumDecl : public TagDecl {
/// negative enumerators of this enum. (see getNumNegativeBits)
void setNumNegativeBits(unsigned Num) { EnumDeclBits.NumNegativeBits = Num; }
public:
/// True if this tag declaration is a scoped enumeration. Only
/// possible in C++11 mode.
void setScoped(bool Scoped = true) { EnumDeclBits.IsScoped = Scoped; }
@ -3555,6 +3556,7 @@ class EnumDecl : public TagDecl {
/// Microsoft-style enumeration with a fixed underlying type.
void setFixed(bool Fixed = true) { EnumDeclBits.IsFixed = Fixed; }
private:
/// True if a valid hash is stored in ODRHash.
bool hasODRHash() const { return EnumDeclBits.HasODRHash; }
void setHasODRHash(bool Hash = true) { EnumDeclBits.HasODRHash = Hash; }

View File

@ -626,7 +626,16 @@ protected:
setModuleOwnershipKind(ModuleOwnershipKind::ModulePrivate);
}
/// Set the owning module ID.
public:
/// Set the FromASTFile flag. This indicates that this declaration
/// was deserialized and not parsed from source code and enables
/// features such as module ownership information.
void setFromASTFile() {
FromASTFile = true;
}
/// Set the owning module ID. This may only be called for
/// deserialized Decls.
void setOwningModuleID(unsigned ID) {
assert(isFromASTFile() && "Only works on a deserialized declaration");
*((unsigned*)this - 2) = ID;

View File

@ -2722,8 +2722,6 @@ class CXXConversionDecl : public CXXMethodDecl {
ExplicitSpecifier ExplicitSpec;
void setExplicitSpecifier(ExplicitSpecifier ES) { ExplicitSpec = ES; }
public:
friend class ASTDeclReader;
friend class ASTDeclWriter;
@ -2745,6 +2743,7 @@ public:
/// Return true if the declartion is already resolved to be explicit.
bool isExplicit() const { return getExplicitSpecifier().isExplicit(); }
void setExplicitSpecifier(ExplicitSpecifier ES) { ExplicitSpec = ES; }
/// Returns the type that this conversion function is converting to.
QualType getConversionType() const {

View File

@ -1891,6 +1891,10 @@ public:
return *TemplateArgs;
}
void setTemplateArgs(TemplateArgumentList *Args) {
TemplateArgs = Args;
}
/// Determine the kind of specialization that this
/// declaration represents.
TemplateSpecializationKind getSpecializationKind() const {