clang 10.0.0git

Classes | Public Types | Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Friends | List of all members
clang::Redeclarable< decl_type > Class Template Reference

Provides common interface for the Decls that can be redeclared. More...

`#include "clang/AST/Redeclarable.h"`

Inheritance diagram for clang::Redeclarable< decl_type >:
[legend]
Collaboration diagram for clang::Redeclarable< decl_type >:
[legend]

## Classes
class | DeclLink
class | redecl_iterator
| Iterates through all the redeclarations of the same decl. More...

## Public Types
using | redecl_range = llvm::iterator_range< redecl_iterator >

## Public Member Functions
| Redeclarable (const ASTContext &Ctx)
decl_type * | getPreviousDecl ()
| Return the previous declaration of this declaration or NULL if this is the first declaration. More...
const decl_type * | getPreviousDecl () const
decl_type * | getFirstDecl ()
| Return the first declaration of this declaration or itself if this is the only declaration. More...
const decl_type * | getFirstDecl () const
| Return the first declaration of this declaration or itself if this is the only declaration. More...
bool | isFirstDecl () const
| True if this is the first declaration in its redeclaration chain. More...
decl_type * | getMostRecentDecl ()
| Returns the most recent (re)declaration of this declaration. More...
const decl_type * | getMostRecentDecl () const
| Returns the most recent (re)declaration of this declaration. More...
void | setPreviousDecl (decl_type *PrevDecl)
| Set the previous declaration. More...
redecl_range | redecls () const
| Returns an iterator range for all the redeclarations of the same decl. More...
redecl_iterator | redecls_begin () const
redecl_iterator | redecls_end () const

## Protected Member Functions
decl_type * | getNextRedeclaration () const

## Static Protected Member Functions
static DeclLink | PreviousDeclLink (decl_type *D)
static DeclLink | LatestDeclLink (const ASTContext &Ctx)

## Protected Attributes
DeclLink | RedeclLink
| Points to the next redeclaration in the chain. More...
decl_type * | First

## Friends
class | ASTDeclReader
class | ASTDeclWriter

## Detailed Description

### template<typename decl_type>
class clang::Redeclarable< decl_type >

Provides common interface for the Decls that can be redeclared.

Definition at line 84 of file Redeclarable.h.

## Member Typedef Documentation

## ◆ redecl_range

template<typename decl_type>

using clang::Redeclarable< decl_type >::redecl_range = llvm::iterator_range<redecl_iterator>

Definition at line 290 of file Redeclarable.h.

## Constructor & Destructor Documentation

## ◆ Redeclarable()

template<typename decl_type>

clang::Redeclarable< decl_type >::Redeclarable | ( | const ASTContext & | Ctx | ) |
| inline

Definition at line 197 of file Redeclarable.h.

## Member Function Documentation

## ◆ getFirstDecl() [1/2]

template<typename decl_type>

decl_type* clang::Redeclarable< decl_type >::getFirstDecl | ( |  | ) |
| inline

Return the first declaration of this declaration or itself if this is the only declaration.

Definition at line 215 of file Redeclarable.h.

Referenced by clang::ASTContext::addCopyConstructorForExceptionObject(), clang::Sema::BuildVarTemplateInstantiation(), clang::getCanonicalForwardRedeclChain(), clang::ASTContext::getCopyConstructorForExceptionObject(), clang::ASTContext::getInlineVariableDefinitionKind(), clang::Redeclarable< VarDecl >::getMostRecentDecl(), clang::Sema::InstantiateVariableDefinition(), clang::Sema::InstantiateVariableInitializer(), clang::Sema::isEmptyCudaConstructor(), clang::Sema::isEmptyCudaDestructor(), clang::Mergeable< UnresolvedUsingTypenameDecl >::isFirstDecl(), isImportedDeclContext(), clang::ASTContext::isMSStaticDataMemberInlineDefinition(), clang::Sema::MaybeSuggestAddingStaticToDecl(), clang::ASTContext::setNonKeyFunction(), clang::ASTDeclWriter::VisitCXXMethodDecl(), clang::ASTDeclWriter::VisitEnumDecl(), clang::ASTDeclReader::VisitNamespaceDecl(), clang::ASTDeclWriter::VisitRecordDecl(), clang::ASTDeclWriter::VisitRedeclarable(), clang::ASTDeclWriter::VisitTypedefDecl(), and clang::ASTDeclWriter::VisitVarDecl().

## ◆ getFirstDecl() [2/2]

template<typename decl_type>

const decl_type* clang::Redeclarable< decl_type >::getFirstDecl | ( |  | ) | const
| inline

Return the first declaration of this declaration or itself if this is the only declaration.

Definition at line 219 of file Redeclarable.h.

## ◆ getMostRecentDecl() [1/2]

template<typename decl_type>

decl_type* clang::Redeclarable< decl_type >::getMostRecentDecl | ( |  | ) |
| inline

Returns the most recent (re)declaration of this declaration.

Definition at line 225 of file Redeclarable.h.

Referenced by clang::ASTContext::adjustDeducedFunctionResultType(), clang::Sema::diagIfOpenMPHostCode(), clang::CodeGen::emitDeclareSimdFunction(), clang::ASTContext::forEachMultiversionedFunctionVersion(), getMangledNameImpl(), clang::Sema::isOpenMPTargetCapturedDecl(), clang::Sema::MarkFunctionReferenced(), clang::Sema::MergeVarDecl(), clang::Sema::PerformPendingInstantiations(), clang::CodeGen::CodeGenModule::SetCommonAttributes(), ShouldRemoveFromUnused(), clang::ASTDeclWriter::VisitTypedefDecl(), and clang::ASTDeclWriter::VisitVarDecl().

## ◆ getMostRecentDecl() [2/2]

template<typename decl_type>

const decl_type* clang::Redeclarable< decl_type >::getMostRecentDecl | ( |  | ) | const
| inline

Returns the most recent (re)declaration of this declaration.

Definition at line 230 of file Redeclarable.h.

## ◆ getNextRedeclaration()

template<typename decl_type>

decl_type* clang::Redeclarable< decl_type >::getNextRedeclaration | ( |  | ) | const
| inline protected

Definition at line 189 of file Redeclarable.h.

Referenced by clang::Redeclarable< VarDecl >::getPreviousDecl().

## ◆ getPreviousDecl() [1/2]

template<typename decl_type>

decl_type* clang::Redeclarable< decl_type >::getPreviousDecl | ( |  | ) |
| inline

Return the previous declaration of this declaration or NULL if this is the first declaration.

Definition at line 203 of file Redeclarable.h.

Referenced by clang::ASTDeclReader::attachPreviousDeclImpl(), clang::Sema::BuildVariableInstantiation(), clang::Sema::CheckCompleteVariableDeclaration(), clang::Sema::DeduceVariableDeclarationType(), dumpPreviousDeclImpl(), clang::CodeGen::emitDeclareSimdFunction(), clang::NamedDecl::getExplicitVisibility(), clang::Redeclarable< VarDecl >::getPreviousDecl(), getStorageClass(), clang::ADLResult::insert(), PreviousDeclsHaveMultiVersionAttribute(), redeclForcesDefMSVC(), clang::Sema::SetDeclDeleted(), ShouldWarnAboutMissingPrototype(), clang::TemplateDeclInstantiator::VisitCXXMethodDecl(), clang::TemplateDeclInstantiator::VisitFunctionDecl(), clang::ASTDeclWriter::VisitParmVarDecl(), clang::ASTDeclWriter::VisitRedeclarable(), and clang::ASTDeclWriter::VisitVarTemplatePartialSpecializationDecl().

## ◆ getPreviousDecl() [2/2]

template<typename decl_type>

const decl_type* clang::Redeclarable< decl_type >::getPreviousDecl | ( |  | ) | const
| inline

Definition at line 208 of file Redeclarable.h.

## ◆ isFirstDecl()

template<typename decl_type>

bool clang::Redeclarable< decl_type >::isFirstDecl | ( |  | ) | const
| inline

True if this is the first declaration in its redeclaration chain.

Definition at line 222 of file Redeclarable.h.

Referenced by clang::ASTDeclReader::mergeRedeclarable(), clang::ASTDeclWriter::VisitClassTemplateDecl(), clang::ASTDeclWriter::VisitFunctionTemplateDecl(), clang::ASTDeclWriter::VisitRedeclarableTemplateDecl(), and clang::ASTDeclWriter::VisitVarTemplateDecl().

## ◆ LatestDeclLink()

template<typename decl_type>

static DeclLink clang::Redeclarable< decl_type >::LatestDeclLink | ( | const ASTContext & | Ctx | ) |
| inline static protected

Definition at line 170 of file Redeclarable.h.

## ◆ PreviousDeclLink()

template<typename decl_type>

static DeclLink clang::Redeclarable< decl_type >::PreviousDeclLink | ( | decl_type * | D | ) |
| inline static protected

Definition at line 166 of file Redeclarable.h.

Referenced by clang::ASTDeclReader::mergeRedeclarable(), and clang::ASTDeclReader::VisitRedeclarable().

## ◆ redecls()

template<typename decl_type>

redecl_range clang::Redeclarable< decl_type >::redecls | ( |  | ) | const
| inline

Returns an iterator range for all the redeclarations of the same decl.

It will iterate at least once (when this decl is the only one).

Definition at line 294 of file Redeclarable.h.

Referenced by addGslOwnerPointerAttributeIfNotExisting(), clang::Sema::CheckForFunctionRedefinition(), clang::VarDecl::getActingDefinition(), clang::VarDecl::getDefinition(), clang::ASTContext::getInlineVariableDefinitionKind(), getInterestingTagDecl(), hasAnyExplicitStorageClass(), clang::VarDecl::hasDefinition(), clang::Sema::InheritedConstructorInfo::InheritedConstructorInfo(), clang::Sema::MarkFunctionReferenced(), clang::Redeclarable< VarDecl >::redecls_begin(), clang::Redeclarable< VarDecl >::redecls_end(), clang::CodeGen::CodeGenModule::SetLLVMFunctionAttributesForDefinition(), clang::Sema::UpdateExceptionSpec(), and clang::TemplateDeclInstantiator::VisitFunctionDecl().

## ◆ redecls_begin()

template<typename decl_type>

redecl_iterator clang::Redeclarable< decl_type >::redecls_begin | ( |  | ) | const
| inline

Definition at line 300 of file Redeclarable.h.

## ◆ redecls_end()

template<typename decl_type>

redecl_iterator clang::Redeclarable< decl_type >::redecls_end | ( |  | ) | const
| inline

Definition at line 301 of file Redeclarable.h.

## ◆ setPreviousDecl()

template<typename decl_type>

void clang::Redeclarable< decl_type >::setPreviousDecl | ( | decl_type * | PrevDecl | ) |

Set the previous declaration.

If PrevDecl is NULL, set this as the first and only declaration.

Definition at line 4473 of file Decl.h.

Referenced by clang::Redeclarable< VarDecl >::getMostRecentDecl(), clang::TemplateDeclInstantiator::InstantiateEnumDefinition(), clang::TemplateDeclInstantiator::InstantiateTypedefNameDecl(), and clang::Sema::MergeVarDecl().

## Friends And Related Function Documentation

## ◆ ASTDeclReader

template<typename decl_type>

friend class ASTDeclReader
| friend

Definition at line 194 of file Redeclarable.h.

## ◆ ASTDeclWriter

template<typename decl_type>

friend class ASTDeclWriter
| friend

Definition at line 195 of file Redeclarable.h.

## Member Data Documentation

## ◆ First

template<typename decl_type>

decl_type* clang::Redeclarable< decl_type >::First
| protected

Definition at line 187 of file Redeclarable.h.

Referenced by clang::ASTDeclReader::attachPreviousDeclImpl(), clang::Redeclarable< VarDecl >::getFirstDecl(), clang::ASTDeclReader::mergeRedeclarable(), and clang::ASTDeclReader::VisitRedeclarable().

## ◆ RedeclLink

template<typename decl_type>

DeclLink clang::Redeclarable< decl_type >::RedeclLink
| protected

Points to the next redeclaration in the chain.

If isFirst() is false, this is a link to the previous declaration of this same Decl. If isFirst() is true, this is the first declaration and Link points to the latest declaration. For example:

#1 int f(int x, int y = 1); // <pointer to #3, true> #2 int f(int x = 0, int y); // <pointer to #1, false> #3 int f(int x, int y) { return x + y; } // <pointer to #2, false>

If there is only one declaration, it is <pointer to self, true>

Definition at line 185 of file Redeclarable.h.

Referenced by clang::ASTDeclReader::attachLatestDeclImpl(), clang::ASTDeclReader::attachPreviousDeclImpl(), clang::ASTDeclReader::getMostRecentDeclImpl(), clang::ASTDeclReader::markIncompleteDeclChainImpl(), clang::ASTDeclReader::mergeRedeclarable(), and clang::ASTDeclReader::VisitRedeclarable().

The documentation for this class was generated from the following files:

- include/clang/AST/Redeclarable.h
- include/clang/AST/Decl.h