clang 20.0.0git
|
#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. | |
Definition at line 20 of file ODRDiagsEmitter.h.
|
inline |
Definition at line 22 of file ODRDiagsEmitter.h.
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(), D, clang::TemplateTypeParmDecl::defaultArgumentWasInherited(), clang::NonTypeTemplateParmDecl::defaultArgumentWasInherited(), clang::TemplateTemplateParmDecl::defaultArgumentWasInherited(), Diag(), diagnoseSubMismatchMethodParameters(), clang::Friend, 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(), Loc, clang::Other, clang::TemplateArgument::Pack, clang::FunctionDecl::param_size(), Range, clang::SC_Static, and clang::TemplateParameterList::size().
bool ODRDiagsEmitter::diagnoseMismatch | ( | const EnumDecl * | FirstEnum, |
const EnumDecl * | SecondEnum | ||
) | const |
Diagnose ODR mismatch between 2 EnumDecl.
Returns true if found a mismatch and diagnosed it.
Definition at line 1794 of file ODRDiagsEmitter.cpp.
References computeODRHash(), D, Diag(), clang::Enum, clang::NamedDecl::getDeclName(), clang::EnumConstantDecl::getInitExpr(), clang::EnumDecl::getIntegerTypeSourceInfo(), getOwningModuleNameForDiagnostic(), clang::EnumDecl::getSourceRange(), clang::TypeSourceInfo::getType(), int, clang::QualType::isNull(), clang::EnumDecl::isScoped(), clang::EnumDecl::isScopedUsingClassTag(), and clang::ODRHash::isSubDeclToBeProcessed().
bool ODRDiagsEmitter::diagnoseMismatch | ( | const FunctionDecl * | FirstFunction, |
const FunctionDecl * | SecondFunction | ||
) | const |
Diagnose ODR mismatch between 2 FunctionDecl.
Returns true if found a mismatch and diagnosed it.
Definition at line 1661 of file ODRDiagsEmitter.cpp.
References computeODRHash(), Diag(), clang::Type::getAs(), clang::SourceRange::getBegin(), clang::NamedDecl::getDeclName(), clang::VarDecl::getInit(), clang::Decl::getLocation(), getOwningModuleNameForDiagnostic(), clang::FunctionDecl::getParamDecl(), clang::FunctionDecl::getReturnType(), clang::FunctionDecl::getReturnTypeSourceRange(), clang::Stmt::getSourceRange(), clang::ParmVarDecl::getSourceRange(), clang::FunctionDecl::getSourceRange(), clang::ValueDecl::getType(), clang::ASTContext::hasSameType(), Loc, clang::FunctionDecl::param_size(), and Range.
Referenced by diagnoseMismatch().
|
inline |
Diagnose ODR mismatch between ObjCInterfaceDecl with different definitions.
Definition at line 63 of file ODRDiagsEmitter.h.
References diagnoseMismatch().
bool ODRDiagsEmitter::diagnoseMismatch | ( | const ObjCInterfaceDecl * | FirstID, |
const ObjCInterfaceDecl * | SecondID, | ||
const struct ObjCInterfaceDecl::DefinitionData * | SecondDD | ||
) | const |
Diagnose ODR mismatch between 2 ObjCInterfaceDecl.
Returns true if found a mismatch and diagnosed it.
Definition at line 1928 of file ODRDiagsEmitter.cpp.
References bool, clang::Type::castAs(), computeODRHash(), D, Diag(), clang::Friend, clang::ObjCIvarDecl::getCanonicalAccessControl(), clang::ObjCInterfaceDecl::getDefinition(), clang::Decl::getLocation(), clang::NamedDecl::getName(), clang::ObjCInterfaceDecl::getODRHash(), getOwningModuleNameForDiagnostic(), clang::ObjCInterfaceDecl::getReferencedProtocols(), clang::Decl::getSourceRange(), clang::FieldDecl::getSourceRange(), clang::ObjCInterfaceDecl::getSuperClass(), clang::ObjCInterfaceDecl::getSuperClassTInfo(), clang::TypeSourceInfo::getType(), clang::TypeSourceInfo::getTypeLoc(), ID, int, clang::ODRHash::isSubDeclToBeProcessed(), Loc, clang::Other, and Range.
|
inline |
Diagnose ODR mismatch between ObjCProtocolDecl with different definitions.
Definition at line 81 of file ODRDiagsEmitter.h.
References diagnoseMismatch().
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 2114 of file ODRDiagsEmitter.cpp.
References computeODRHash(), D, Diag(), clang::Friend, clang::ObjCProtocolDecl::getDefinition(), clang::Decl::getLocation(), getOwningModuleNameForDiagnostic(), clang::ObjCProtocolDecl::getReferencedProtocols(), clang::Decl::getSourceRange(), ID, clang::ODRHash::isSubDeclToBeProcessed(), and clang::Other.
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 1565 of file ODRDiagsEmitter.cpp.
References computeODRHash(), D, Diag(), clang::Friend, clang::Decl::getLocation(), getOwningModuleNameForDiagnostic(), clang::Decl::getSourceRange(), clang::ODRHash::isSubDeclToBeProcessed(), and clang::Other.
|
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 D, and clang::Decl::getImportedOwningModule().
Referenced by diagnoseMismatch().