Merge pull request #8584 from random-internet-cat/annotation-constructors

Delete copy/move on annotation polymorphic bases to improve safety
This commit is contained in:
Daniel Kirchner 2020-04-03 10:56:38 +02:00 committed by GitHub
commit 00acaadd10
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -47,6 +47,14 @@ using TypePointer = Type const*;
struct ASTAnnotation struct ASTAnnotation
{ {
ASTAnnotation() = default;
ASTAnnotation(ASTAnnotation const&) = delete;
ASTAnnotation(ASTAnnotation&&) = delete;
ASTAnnotation& operator=(ASTAnnotation const&) = delete;
ASTAnnotation& operator=(ASTAnnotation&&) = delete;
virtual ~ASTAnnotation() = default; virtual ~ASTAnnotation() = default;
}; };
@ -58,7 +66,16 @@ struct DocTag
struct StructurallyDocumentedAnnotation struct StructurallyDocumentedAnnotation
{ {
StructurallyDocumentedAnnotation() = default;
StructurallyDocumentedAnnotation(StructurallyDocumentedAnnotation const&) = delete;
StructurallyDocumentedAnnotation(StructurallyDocumentedAnnotation&&) = delete;
StructurallyDocumentedAnnotation& operator=(StructurallyDocumentedAnnotation const&) = delete;
StructurallyDocumentedAnnotation& operator=(StructurallyDocumentedAnnotation&&) = delete;
virtual ~StructurallyDocumentedAnnotation() = default; virtual ~StructurallyDocumentedAnnotation() = default;
/// Mapping docstring tag name -> content. /// Mapping docstring tag name -> content.
std::multimap<std::string, DocTag> docTags; std::multimap<std::string, DocTag> docTags;
}; };
@ -75,6 +92,16 @@ struct SourceUnitAnnotation: ASTAnnotation
struct ScopableAnnotation struct ScopableAnnotation
{ {
ScopableAnnotation() = default;
ScopableAnnotation(ScopableAnnotation const&) = delete;
ScopableAnnotation(ScopableAnnotation&&) = delete;
ScopableAnnotation& operator=(ScopableAnnotation const&) = delete;
ScopableAnnotation& operator=(ScopableAnnotation&&) = delete;
virtual ~ScopableAnnotation() = default;
/// The scope this declaration resides in. Can be nullptr if it is the global scope. /// The scope this declaration resides in. Can be nullptr if it is the global scope.
/// Available only after name and type resolution step. /// Available only after name and type resolution step.
ASTNode const* scope = nullptr; ASTNode const* scope = nullptr;