[clang] 2b366e7 - Make Decl::setOwningModuleID() public. (NFC)
Adrian Prantl via cfe-commits
cfe-commits at lists.llvm.org
Wed Mar 11 15:50:12 PDT 2020
Author: Adrian Prantl
Date: 2020-03-11T15:50:03-07:00
New Revision: 2b366e75d41341e7cb2e763b20c4fc8fd3bd4b3c
URL: https://github.com/llvm/llvm-project/commit/2b366e75d41341e7cb2e763b20c4fc8fd3bd4b3c
DIFF: https://github.com/llvm/llvm-project/commit/2b366e75d41341e7cb2e763b20c4fc8fd3bd4b3c.diff
LOG: 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
Added:
Modified:
clang/include/clang/AST/Decl.h
clang/include/clang/AST/DeclBase.h
clang/include/clang/AST/DeclCXX.h
clang/include/clang/AST/DeclTemplate.h
Removed:
################################################################################
diff --git a/clang/include/clang/AST/Decl.h b/clang/include/clang/AST/Decl.h
index bc7676534175..0ce8b852b2ff 100644
--- a/clang/include/clang/AST/Decl.h
+++ b/clang/include/clang/AST/Decl.h
@@ -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; }
diff --git a/clang/include/clang/AST/DeclBase.h b/clang/include/clang/AST/DeclBase.h
index 91c372585b07..05dec109828d 100644
--- a/clang/include/clang/AST/DeclBase.h
+++ b/clang/include/clang/AST/DeclBase.h
@@ -626,7 +626,16 @@ class alignas(8) Decl {
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;
diff --git a/clang/include/clang/AST/DeclCXX.h b/clang/include/clang/AST/DeclCXX.h
index 23b1adb26603..987738f73676 100644
--- a/clang/include/clang/AST/DeclCXX.h
+++ b/clang/include/clang/AST/DeclCXX.h
@@ -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 @@ class CXXConversionDecl : public CXXMethodDecl {
/// 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 {
diff --git a/clang/include/clang/AST/DeclTemplate.h b/clang/include/clang/AST/DeclTemplate.h
index 7a9f623d8152..def1ab18706c 100755
--- a/clang/include/clang/AST/DeclTemplate.h
+++ b/clang/include/clang/AST/DeclTemplate.h
@@ -1891,6 +1891,10 @@ class ClassTemplateSpecializationDecl
return *TemplateArgs;
}
+ void setTemplateArgs(TemplateArgumentList *Args) {
+ TemplateArgs = Args;
+ }
+
/// Determine the kind of specialization that this
/// declaration represents.
TemplateSpecializationKind getSpecializationKind() const {
More information about the cfe-commits
mailing list