clang 19.0.0git
Classes | Public Member Functions | Static Public Member Functions | List of all members
clang::ODRDiagsEmitter Class Reference

#include "clang/AST/ODRDiagsEmitter.h"

Public Member Functions

 ODRDiagsEmitter (DiagnosticsEngine &Diags, const ASTContext &Context, const LangOptions &LangOpts)
 
bool diagnoseMismatch (const FunctionDecl *FirstFunction, const FunctionDecl *SecondFunction) const
 Diagnose ODR mismatch between 2 FunctionDecl.
 
bool diagnoseMismatch (const EnumDecl *FirstEnum, const EnumDecl *SecondEnum) const
 Diagnose ODR mismatch between 2 EnumDecl.
 
bool diagnoseMismatch (const CXXRecordDecl *FirstRecord, const CXXRecordDecl *SecondRecord, const struct CXXRecordDecl::DefinitionData *SecondDD) const
 Diagnose ODR mismatch between 2 CXXRecordDecl.
 
bool diagnoseMismatch (const RecordDecl *FirstRecord, const RecordDecl *SecondRecord) const
 Diagnose ODR mismatch between 2 RecordDecl that are not CXXRecordDecl.
 
bool diagnoseMismatch (const ObjCInterfaceDecl *FirstID, const ObjCInterfaceDecl *SecondID, const struct ObjCInterfaceDecl::DefinitionData *SecondDD) const
 Diagnose ODR mismatch between 2 ObjCInterfaceDecl.
 
bool diagnoseMismatch (const ObjCInterfaceDecl *FirstID, const ObjCInterfaceDecl *SecondID) const
 Diagnose ODR mismatch between ObjCInterfaceDecl with different definitions.
 
bool diagnoseMismatch (const ObjCProtocolDecl *FirstProtocol, const ObjCProtocolDecl *SecondProtocol, const struct ObjCProtocolDecl::DefinitionData *SecondDD) const
 Diagnose ODR mismatch between 2 ObjCProtocolDecl.
 
bool diagnoseMismatch (const ObjCProtocolDecl *FirstProtocol, const ObjCProtocolDecl *SecondProtocol) const
 Diagnose ODR mismatch between ObjCProtocolDecl with different definitions.
 

Static Public Member Functions

static std::string getOwningModuleNameForDiagnostic (const Decl *D)
 Get the best name we know for the module that owns the given declaration, or an empty string if the declaration is not from a module.
 

Detailed Description

Definition at line 20 of file ODRDiagsEmitter.h.

Constructor & Destructor Documentation

◆ ODRDiagsEmitter()

clang::ODRDiagsEmitter::ODRDiagsEmitter ( DiagnosticsEngine Diags,
const ASTContext Context,
const LangOptions LangOpts 
)
inline

Definition at line 22 of file ODRDiagsEmitter.h.

Member Function Documentation

◆ diagnoseMismatch() [1/8]

bool ODRDiagsEmitter::diagnoseMismatch ( const CXXRecordDecl FirstRecord,
const CXXRecordDecl SecondRecord,
const struct CXXRecordDecl::DefinitionData *  SecondDD 
) const

Diagnose ODR mismatch between 2 CXXRecordDecl.

Returns true if found a mismatch and diagnosed it. To compare 2 declarations with merged and identical definition data you need to provide pre-merge definition data in SecondDD.

Definition at line 706 of file ODRDiagsEmitter.cpp.

References clang::ODRHash::AddFunctionDecl(), clang::ODRHash::AddTemplateParameterList(), clang::TemplateParameterList::asArray(), clang::ODRHash::CalculateHash(), computeODRHash(), clang::TemplateTypeParmDecl::defaultArgumentWasInherited(), clang::NonTypeTemplateParmDecl::defaultArgumentWasInherited(), clang::TemplateTemplateParmDecl::defaultArgumentWasInherited(), Diag(), diagnoseSubMismatchMethodParameters(), clang::CXXBaseSpecifier::getAccessSpecifierAsWritten(), clang::TemplateArgumentLoc::getArgument(), clang::DeclarationName::getAsIdentifierInfo(), clang::StaticAssertDecl::getAssertExpr(), clang::Decl::getBeginLoc(), clang::Stmt::getBeginLoc(), clang::NamedDecl::getDeclName(), clang::TemplateTypeParmDecl::getDefaultArgument(), clang::NonTypeTemplateParmDecl::getDefaultArgument(), clang::TemplateTemplateParmDecl::getDefaultArgument(), clang::CXXRecordDecl::getDescribedClassTemplate(), clang::FriendDecl::getFriendDecl(), clang::FriendDecl::getFriendLoc(), clang::FriendDecl::getFriendType(), clang::NamedDecl::getIdentifier(), clang::VarDecl::getInit(), clang::Decl::getKind(), clang::Decl::getLocation(), clang::StaticAssertDecl::getMessage(), clang::NamedDecl::getName(), clang::FunctionDecl::getODRHash(), getOwningModuleNameForDiagnostic(), clang::TemplateParameterList::getParam(), clang::FunctionDecl::getParamDecl(), clang::Decl::getSourceRange(), clang::CXXBaseSpecifier::getSourceRange(), clang::Stmt::getSourceRange(), clang::FunctionDecl::getSourceRange(), clang::StaticAssertDecl::getSourceRange(), clang::FriendDecl::getSourceRange(), clang::TemplateDecl::getSourceRange(), clang::FunctionDecl::getStorageClass(), clang::TemplateDecl::getTemplateParameters(), clang::FunctionDecl::getTemplateSpecializationArgs(), clang::ValueDecl::getType(), clang::CXXBaseSpecifier::getType(), clang::TypeSourceInfo::getType(), clang::TemplateTypeParmDecl::hasDefaultArgument(), clang::NonTypeTemplateParmDecl::hasDefaultArgument(), clang::TemplateTemplateParmDecl::hasDefaultArgument(), int, clang::CXXMethodDecl::isConst(), clang::FunctionDecl::isDeletedAsWritten(), clang::FunctionDecl::isExplicitlyDefaulted(), clang::DeclarationName::isIdentifier(), clang::FunctionDecl::isInlineSpecified(), clang::TemplateTypeParmDecl::isParameterPack(), clang::NonTypeTemplateParmDecl::isParameterPack(), clang::TemplateTemplateParmDecl::isParameterPack(), clang::FunctionDecl::isPureVirtual(), clang::ODRHash::isSubDeclToBeProcessed(), clang::CXXBaseSpecifier::isVirtual(), clang::FunctionDecl::isVirtualAsWritten(), clang::CXXMethodDecl::isVolatile(), clang::Other, clang::TemplateArgument::Pack, clang::FunctionDecl::param_size(), clang::SC_Static, and clang::TemplateParameterList::size().

◆ diagnoseMismatch() [2/8]

bool ODRDiagsEmitter::diagnoseMismatch ( const EnumDecl FirstEnum,
const EnumDecl SecondEnum 
) const

◆ diagnoseMismatch() [3/8]

bool ODRDiagsEmitter::diagnoseMismatch ( const FunctionDecl FirstFunction,
const FunctionDecl SecondFunction 
) const

◆ diagnoseMismatch() [4/8]

bool clang::ODRDiagsEmitter::diagnoseMismatch ( const ObjCInterfaceDecl FirstID,
const ObjCInterfaceDecl SecondID 
) const
inline

Diagnose ODR mismatch between ObjCInterfaceDecl with different definitions.

Definition at line 63 of file ODRDiagsEmitter.h.

References diagnoseMismatch().

◆ diagnoseMismatch() [5/8]

bool ODRDiagsEmitter::diagnoseMismatch ( const ObjCInterfaceDecl FirstID,
const ObjCInterfaceDecl SecondID,
const struct ObjCInterfaceDecl::DefinitionData *  SecondDD 
) const

◆ diagnoseMismatch() [6/8]

bool clang::ODRDiagsEmitter::diagnoseMismatch ( const ObjCProtocolDecl FirstProtocol,
const ObjCProtocolDecl SecondProtocol 
) const
inline

Diagnose ODR mismatch between ObjCProtocolDecl with different definitions.

Definition at line 81 of file ODRDiagsEmitter.h.

References diagnoseMismatch().

◆ diagnoseMismatch() [7/8]

bool ODRDiagsEmitter::diagnoseMismatch ( const ObjCProtocolDecl FirstProtocol,
const ObjCProtocolDecl SecondProtocol,
const struct ObjCProtocolDecl::DefinitionData *  SecondDD 
) const

Diagnose ODR mismatch between 2 ObjCProtocolDecl.

Returns true if found a mismatch and diagnosed it. To compare 2 declarations with merged and identical definition data you need to provide pre-merge definition data in SecondDD.

Definition at line 2109 of file ODRDiagsEmitter.cpp.

References computeODRHash(), Diag(), clang::ObjCProtocolDecl::getDefinition(), clang::Decl::getLocation(), getOwningModuleNameForDiagnostic(), clang::ObjCProtocolDecl::getReferencedProtocols(), clang::Decl::getSourceRange(), ID, clang::ODRHash::isSubDeclToBeProcessed(), and clang::Other.

◆ diagnoseMismatch() [8/8]

bool ODRDiagsEmitter::diagnoseMismatch ( const RecordDecl FirstRecord,
const RecordDecl SecondRecord 
) const

Diagnose ODR mismatch between 2 RecordDecl that are not CXXRecordDecl.

Returns true if found a mismatch and diagnosed it.

Definition at line 1560 of file ODRDiagsEmitter.cpp.

References computeODRHash(), Diag(), clang::Decl::getLocation(), getOwningModuleNameForDiagnostic(), clang::Decl::getSourceRange(), clang::ODRHash::isSubDeclToBeProcessed(), and clang::Other.

◆ getOwningModuleNameForDiagnostic()

std::string ODRDiagsEmitter::getOwningModuleNameForDiagnostic ( const Decl D)
static

Get the best name we know for the module that owns the given declaration, or an empty string if the declaration is not from a module.

Definition at line 43 of file ODRDiagsEmitter.cpp.

References clang::Decl::getImportedOwningModule().

Referenced by diagnoseMismatch().


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