Skip to content

Commit 4642e68

Browse files
adrian-prantlmemfrob
authored andcommitted
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
1 parent ca50f25 commit 4642e68

File tree

4 files changed

+17
-3
lines changed

4 files changed

+17
-3
lines changed

clang/include/clang/AST/Decl.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3539,6 +3539,7 @@ class EnumDecl : public TagDecl {
35393539
/// negative enumerators of this enum. (see getNumNegativeBits)
35403540
void setNumNegativeBits(unsigned Num) { EnumDeclBits.NumNegativeBits = Num; }
35413541

3542+
public:
35423543
/// True if this tag declaration is a scoped enumeration. Only
35433544
/// possible in C++11 mode.
35443545
void setScoped(bool Scoped = true) { EnumDeclBits.IsScoped = Scoped; }
@@ -3555,6 +3556,7 @@ class EnumDecl : public TagDecl {
35553556
/// Microsoft-style enumeration with a fixed underlying type.
35563557
void setFixed(bool Fixed = true) { EnumDeclBits.IsFixed = Fixed; }
35573558

3559+
private:
35583560
/// True if a valid hash is stored in ODRHash.
35593561
bool hasODRHash() const { return EnumDeclBits.HasODRHash; }
35603562
void setHasODRHash(bool Hash = true) { EnumDeclBits.HasODRHash = Hash; }

clang/include/clang/AST/DeclBase.h

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -626,7 +626,16 @@ class alignas(8) Decl {
626626
setModuleOwnershipKind(ModuleOwnershipKind::ModulePrivate);
627627
}
628628

629-
/// Set the owning module ID.
629+
public:
630+
/// Set the FromASTFile flag. This indicates that this declaration
631+
/// was deserialized and not parsed from source code and enables
632+
/// features such as module ownership information.
633+
void setFromASTFile() {
634+
FromASTFile = true;
635+
}
636+
637+
/// Set the owning module ID. This may only be called for
638+
/// deserialized Decls.
630639
void setOwningModuleID(unsigned ID) {
631640
assert(isFromASTFile() && "Only works on a deserialized declaration");
632641
*((unsigned*)this - 2) = ID;

clang/include/clang/AST/DeclCXX.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2722,8 +2722,6 @@ class CXXConversionDecl : public CXXMethodDecl {
27222722

27232723
ExplicitSpecifier ExplicitSpec;
27242724

2725-
void setExplicitSpecifier(ExplicitSpecifier ES) { ExplicitSpec = ES; }
2726-
27272725
public:
27282726
friend class ASTDeclReader;
27292727
friend class ASTDeclWriter;
@@ -2745,6 +2743,7 @@ class CXXConversionDecl : public CXXMethodDecl {
27452743

27462744
/// Return true if the declartion is already resolved to be explicit.
27472745
bool isExplicit() const { return getExplicitSpecifier().isExplicit(); }
2746+
void setExplicitSpecifier(ExplicitSpecifier ES) { ExplicitSpec = ES; }
27482747

27492748
/// Returns the type that this conversion function is converting to.
27502749
QualType getConversionType() const {

clang/include/clang/AST/DeclTemplate.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1891,6 +1891,10 @@ class ClassTemplateSpecializationDecl
18911891
return *TemplateArgs;
18921892
}
18931893

1894+
void setTemplateArgs(TemplateArgumentList *Args) {
1895+
TemplateArgs = Args;
1896+
}
1897+
18941898
/// Determine the kind of specialization that this
18951899
/// declaration represents.
18961900
TemplateSpecializationKind getSpecializationKind() const {

0 commit comments

Comments
 (0)