clang API Documentation
#include "clang/Sema/SemaInternal.h"#include "clang/Sema/DeclSpec.h"#include "clang/Sema/Initialization.h"#include "clang/Sema/Lookup.h"#include "clang/Sema/ParsedTemplate.h"#include "clang/Sema/ScopeInfo.h"#include "clang/Sema/Scope.h"#include "clang/Sema/TemplateDeduction.h"#include "clang/AST/ASTContext.h"#include "clang/AST/CharUnits.h"#include "clang/AST/CXXInheritance.h"#include "clang/AST/DeclObjC.h"#include "clang/AST/ExprCXX.h"#include "clang/AST/ExprObjC.h"#include "clang/AST/TypeLoc.h"#include "clang/Basic/PartialDiagnostic.h"#include "clang/Basic/TargetInfo.h"#include "clang/Lex/Preprocessor.h"#include "TypeLocBuilder.h"#include "llvm/ADT/STLExtras.h"#include "llvm/Support/ErrorHandling.h"
Go to the source code of this file.
Functions | |
| static UuidAttr * | GetUuidAttrOfType (QualType QT) |
| Retrieve the UuidAttr associated with QT. | |
| static bool | doesUsualArrayDeleteWantSize (Sema &S, SourceLocation loc, QualType allocType) |
| static bool | isNonPlacementDeallocationFunction (FunctionDecl *FD) |
| Determine whether the given function is a non-placement deallocation function. | |
| static ExprResult | BuildCXXCastArgument (Sema &S, SourceLocation CastLoc, QualType Ty, CastKind Kind, CXXMethodDecl *Method, DeclAccessPair FoundDecl, bool HadMultipleCandidates, Expr *From) |
| static bool | CheckUnaryTypeTraitTypeCompleteness (Sema &S, UnaryTypeTrait UTT, SourceLocation Loc, QualType ArgTy) |
| Check the completeness of a type in a unary type trait. | |
| static bool | EvaluateUnaryTypeTrait (Sema &Self, UnaryTypeTrait UTT, SourceLocation KeyLoc, QualType T) |
| static bool | EvaluateBinaryTypeTrait (Sema &Self, BinaryTypeTrait BTT, QualType LhsT, QualType RhsT, SourceLocation KeyLoc) |
| static uint64_t | EvaluateArrayTypeTrait (Sema &Self, ArrayTypeTrait ATT, QualType T, Expr *DimExpr, SourceLocation KeyLoc) |
| static bool | EvaluateExpressionTrait (ExpressionTrait ET, Expr *E) |
| static bool | TryClassUnification (Sema &Self, Expr *From, Expr *To, SourceLocation QuestionLoc, bool &HaveConversion, QualType &ToType) |
| Try to convert a type to another according to C++0x 5.16p3. | |
| static bool | FindConditionalOverload (Sema &Self, ExprResult &LHS, ExprResult &RHS, SourceLocation QuestionLoc) |
| Try to find a common type for two according to C++0x 5.16p5. | |
| static bool | ConvertForConditional (Sema &Self, ExprResult &E, QualType T) |
| Perform an "extended" implicit conversion as returned by TryClassUnification. | |
| static bool | CheckArrow (Sema &S, QualType &ObjectType, Expr *&Base, tok::TokenKind &OpKind, SourceLocation OpLoc) |
| static ExprResult BuildCXXCastArgument | ( | Sema & | S, |
| SourceLocation | CastLoc, | ||
| QualType | Ty, | ||
| CastKind | Kind, | ||
| CXXMethodDecl * | Method, | ||
| DeclAccessPair | FoundDecl, | ||
| bool | HadMultipleCandidates, | ||
| Expr * | From | ||
| ) | [static] |
Definition at line 2137 of file SemaExprCXX.cpp.
References clang::Sema::BuildCXXConstructExpr(), clang::Sema::BuildCXXMemberCallExpr(), clang::Sema::CheckConstructorAccess(), clang::Sema::CheckMemberOperatorAccess(), clang::CXXConstructExpr::CK_Complete, clang::CK_ConstructorConversion, clang::CK_UserDefinedConversion, clang::Sema::CompleteConstructorCall(), clang::Sema::Context, clang::ImplicitCastExpr::Create(), clang::ExprError(), clang::Decl::getAccess(), clang::Expr::getType(), clang::ActionResult< PtrTy, CompressInvalid >::isInvalid(), clang::Sema::MaybeBindToTemporary(), clang::move_arg(), clang::Sema::Owned(), clang::Sema::PDiag(), and clang::ActionResult< PtrTy, CompressInvalid >::takeAs().
Referenced by clang::Sema::PerformImplicitConversion().
| static bool CheckArrow | ( | Sema & | S, |
| QualType & | ObjectType, | ||
| Expr *& | Base, | ||
| tok::TokenKind & | OpKind, | ||
| SourceLocation | OpLoc | ||
| ) | [static] |
Definition at line 4401 of file SemaExprCXX.cpp.
References clang::Sema::CheckPlaceholderExpr(), clang::FixItHint::CreateReplacement(), clang::Sema::Diag(), clang::Expr::getType(), clang::Expr::hasPlaceholderType(), clang::ActionResult< PtrTy, CompressInvalid >::isInvalid(), clang::Sema::isSFINAEContext(), clang::Expr::isTypeDependent(), and clang::ActionResult< PtrTy, CompressInvalid >::take().
Referenced by clang::Sema::ActOnPseudoDestructorExpr(), and clang::Sema::BuildPseudoDestructorExpr().
| static bool CheckUnaryTypeTraitTypeCompleteness | ( | Sema & | S, |
| UnaryTypeTrait | UTT, | ||
| SourceLocation | Loc, | ||
| QualType | ArgTy | ||
| ) | [static] |
Check the completeness of a type in a unary type trait.
If the particular type trait requires a complete type, tries to complete it. If completing the type fails, a diagnostic is emitted and false returned. If completing the type succeeds or no completion was required, returns true.
Definition at line 2664 of file SemaExprCXX.cpp.
References clang::Sema::Context, clang::ASTContext::getAsArrayType(), clang::ArrayType::getElementType(), clang::Sema::RequireCompleteType(), clang::UTT_HasNothrowAssign, clang::UTT_HasNothrowConstructor, clang::UTT_HasNothrowCopy, clang::UTT_HasTrivialAssign, clang::UTT_HasTrivialCopy, clang::UTT_HasTrivialDefaultConstructor, clang::UTT_HasTrivialDestructor, clang::UTT_HasVirtualDestructor, clang::UTT_IsAbstract, clang::UTT_IsArithmetic, clang::UTT_IsArray, clang::UTT_IsClass, clang::UTT_IsCompleteType, clang::UTT_IsCompound, clang::UTT_IsConst, clang::UTT_IsEmpty, clang::UTT_IsEnum, clang::UTT_IsFinal, clang::UTT_IsFloatingPoint, clang::UTT_IsFunction, clang::UTT_IsFundamental, clang::UTT_IsIntegral, clang::UTT_IsLiteral, clang::UTT_IsLvalueReference, clang::UTT_IsMemberFunctionPointer, clang::UTT_IsMemberObjectPointer, clang::UTT_IsMemberPointer, clang::UTT_IsObject, clang::UTT_IsPOD, clang::UTT_IsPointer, clang::UTT_IsPolymorphic, clang::UTT_IsReference, clang::UTT_IsRvalueReference, clang::UTT_IsScalar, clang::UTT_IsSigned, clang::UTT_IsStandardLayout, clang::UTT_IsTrivial, clang::UTT_IsTriviallyCopyable, clang::UTT_IsUnion, clang::UTT_IsUnsigned, clang::UTT_IsVoid, and clang::UTT_IsVolatile.
Referenced by clang::Sema::BuildUnaryTypeTrait().
| static bool ConvertForConditional | ( | Sema & | Self, |
| ExprResult & | E, | ||
| QualType | T | ||
| ) | [static] |
Perform an "extended" implicit conversion as returned by TryClassUnification.
Definition at line 3665 of file SemaExprCXX.cpp.
References Arg, clang::InitializationKind::CreateCopy(), clang::ActionResult< PtrTy, CompressInvalid >::get(), clang::Stmt::getLocStart(), clang::InitializedEntity::InitializeTemporary(), clang::ActionResult< PtrTy, CompressInvalid >::isInvalid(), clang::InitializationSequence::Perform(), and clang::ActionResult< PtrTy, CompressInvalid >::take().
Referenced by clang::Sema::CXXCheckConditionalOperands().
| static bool doesUsualArrayDeleteWantSize | ( | Sema & | S, |
| SourceLocation | loc, | ||
| QualType | allocType | ||
| ) | [static] |
doesUsualArrayDeleteWantSize - Answers whether the usual operator delete[] for the given type has a size_t parameter.
Definition at line 808 of file SemaExprCXX.cpp.
References clang::Sema::Context, clang::ASTContext::DeclarationNames, clang::LookupResult::Filter::done(), clang::LookupResult::empty(), clang::LookupResult::Filter::erase(), clang::DeclarationNameTable::getCXXOperatorName(), clang::RecordType::getDecl(), clang::LookupResult::getFoundDecl(), clang::FunctionDecl::getNumParams(), clang::NamedDecl::getUnderlyingDecl(), clang::LookupResult::Filter::hasNext(), clang::LookupResult::isAmbiguous(), clang::LookupResult::isSingleResult(), clang::Sema::LookupOrdinaryName, clang::Sema::LookupQualifiedName(), clang::LookupResult::makeFilter(), clang::LookupResult::Filter::next(), and clang::LookupResult::suppressDiagnostics().
Referenced by clang::Sema::ActOnCXXDelete(), and clang::Sema::BuildCXXNew().
| static uint64_t EvaluateArrayTypeTrait | ( | Sema & | Self, |
| ArrayTypeTrait | ATT, | ||
| QualType | T, | ||
| Expr * | DimExpr, | ||
| SourceLocation | KeyLoc | ||
| ) | [static] |
Definition at line 3254 of file SemaExprCXX.cpp.
References clang::ATT_ArrayExtent, clang::ATT_ArrayRank, clang::Sema::Context, clang::Sema::Diag(), clang::ASTContext::getAsArrayType(), clang::ASTContext::getAsConstantArrayType(), clang::Stmt::getSourceRange(), isInvalid(), clang::Sema::PDiag(), and clang::Sema::VerifyIntegerConstantExpression().
Referenced by clang::Sema::BuildArrayTypeTrait().
| static bool EvaluateBinaryTypeTrait | ( | Sema & | Self, |
| BinaryTypeTrait | BTT, | ||
| QualType | LhsT, | ||
| QualType | RhsT, | ||
| SourceLocation | KeyLoc | ||
| ) | [static] |
Definition at line 3113 of file SemaExprCXX.cpp.
References clang::BTT_IsBaseOf, clang::BTT_IsConvertible, clang::BTT_IsConvertibleTo, clang::BTT_IsSame, clang::BTT_TypeCompatible, clang::Sema::Context, clang::InitializationKind::CreateCopy(), clang::RecordType::getDecl(), clang::QualType::getNonLValueExprType(), clang::ASTContext::getRValueReferenceType(), clang::ASTContext::getTranslationUnitDecl(), clang::QualType::getUnqualifiedType(), clang::Expr::getValueKindForType(), clang::Sema::SFINAETrap::hasErrorOccurred(), clang::ASTContext::hasSameType(), clang::ASTContext::hasSameUnqualifiedType(), clang::InitializedEntity::InitializeTemporary(), clang::ActionResult< PtrTy, CompressInvalid >::isInvalid(), clang::TagDecl::isUnion(), clang::Sema::RequireCompleteType(), clang::ASTContext::typesAreCompatible(), and clang::Sema::Unevaluated.
Referenced by clang::Sema::BuildBinaryTypeTrait().
| static bool EvaluateExpressionTrait | ( | ExpressionTrait | ET, |
| Expr * | E | ||
| ) | [static] |
Definition at line 3344 of file SemaExprCXX.cpp.
References clang::ET_IsLValueExpr, clang::ET_IsRValueExpr, clang::Expr::isLValue(), and clang::Expr::isRValue().
Referenced by clang::Sema::BuildExpressionTrait().
| static bool EvaluateUnaryTypeTrait | ( | Sema & | Self, |
| UnaryTypeTrait | UTT, | ||
| SourceLocation | KeyLoc, | ||
| QualType | T | ||
| ) | [static] |
Definition at line 2762 of file SemaExprCXX.cpp.
References clang::LookupResult::begin(), clang::Sema::Context, clang::LookupResult::end(), clang::EST_Delayed, clang::Type::getAs(), clang::FunctionProtoType::getExceptionSpecType(), clang::FunctionProtoType::getNumArgs(), clang::QualType::getObjCLifetime(), clang::ValueDecl::getType(), clang::CXXRecordDecl::hasTrivialCopyAssignment(), clang::CXXRecordDecl::hasTrivialCopyConstructor(), clang::CXXRecordDecl::hasTrivialDefaultConstructor(), clang::QualType::isConstQualified(), clang::CXXMethodDecl::isCopyAssignmentOperator(), clang::CXXConstructorDecl::isCopyConstructor(), clang::CXXConstructorDecl::isDefaultConstructor(), clang::FunctionProtoType::isNothrow(), clang::QualType::isPODType(), clang::QualType::isTriviallyCopyableType(), clang::QualType::isTrivialType(), clang::QualType::isVolatileQualified(), clang::Sema::LookupConstructors(), clang::Sema::LookupDestructor(), clang::Sema::LookupOrdinaryName, clang::Sema::LookupQualifiedName(), clang::Qualifiers::OCL_Autoreleasing, clang::Qualifiers::OCL_ExplicitNone, clang::Qualifiers::OCL_None, clang::Qualifiers::OCL_Strong, clang::Qualifiers::OCL_Weak, clang::LookupResult::suppressDiagnostics(), clang::UTT_HasNothrowAssign, clang::UTT_HasNothrowConstructor, clang::UTT_HasNothrowCopy, clang::UTT_HasTrivialAssign, clang::UTT_HasTrivialCopy, clang::UTT_HasTrivialDefaultConstructor, clang::UTT_HasTrivialDestructor, clang::UTT_HasVirtualDestructor, clang::UTT_IsAbstract, clang::UTT_IsArithmetic, clang::UTT_IsArray, clang::UTT_IsClass, clang::UTT_IsCompleteType, clang::UTT_IsCompound, clang::UTT_IsConst, clang::UTT_IsEmpty, clang::UTT_IsEnum, clang::UTT_IsFinal, clang::UTT_IsFloatingPoint, clang::UTT_IsFunction, clang::UTT_IsFundamental, clang::UTT_IsIntegral, clang::UTT_IsLiteral, clang::UTT_IsLvalueReference, clang::UTT_IsMemberFunctionPointer, clang::UTT_IsMemberObjectPointer, clang::UTT_IsMemberPointer, clang::UTT_IsObject, clang::UTT_IsPOD, clang::UTT_IsPointer, clang::UTT_IsPolymorphic, clang::UTT_IsReference, clang::UTT_IsRvalueReference, clang::UTT_IsScalar, clang::UTT_IsSigned, clang::UTT_IsStandardLayout, clang::UTT_IsTrivial, clang::UTT_IsTriviallyCopyable, clang::UTT_IsUnion, clang::UTT_IsUnsigned, clang::UTT_IsVoid, and clang::UTT_IsVolatile.
Referenced by clang::Sema::BuildUnaryTypeTrait().
| static bool FindConditionalOverload | ( | Sema & | Self, |
| ExprResult & | LHS, | ||
| ExprResult & | RHS, | ||
| SourceLocation | QuestionLoc | ||
| ) | [static] |
Try to find a common type for two according to C++0x 5.16p5.
This is part of the parameter validation for the ? operator. If either value operand is a class type, overload resolution is used to find a conversion to a common type.
Definition at line 3607 of file SemaExprCXX.cpp.
References clang::Sema::AA_Converting, clang::Sema::AddBuiltinOperatorCandidates(), Args, clang::OverloadCandidateSet::BestViableFunction(), CandidateSet, clang::Sema::Diag(), clang::Sema::DiagnoseConditionalForNull(), clang::ActionResult< PtrTy, CompressInvalid >::get(), clang::Stmt::getSourceRange(), clang::Expr::getType(), clang::ActionResult< PtrTy, CompressInvalid >::isInvalid(), clang::Sema::MarkFunctionReferenced(), clang::move(), clang::OR_Ambiguous, clang::OR_Deleted, clang::OR_No_Viable_Function, clang::OR_Success, and clang::Sema::PerformImplicitConversion().
Referenced by clang::Sema::CXXCheckConditionalOperands().
| static UuidAttr* GetUuidAttrOfType | ( | QualType | QT | ) | [static] |
Retrieve the UuidAttr associated with QT.
Definition at line 402 of file SemaExprCXX.cpp.
References clang::Type::getAsCXXRecordDecl(), clang::QualType::getTypePtr(), clang::Redeclarable< decl_type >::redecls_begin(), and clang::Redeclarable< decl_type >::redecls_end().
Referenced by clang::Sema::BuildCXXUuidof().
| static bool isNonPlacementDeallocationFunction | ( | FunctionDecl * | FD | ) | [static] |
Determine whether the given function is a non-placement deallocation function.
Definition at line 1288 of file SemaExprCXX.cpp.
References clang::FunctionDecl::getNumParams(), clang::FunctionDecl::getOverloadedOperator(), and clang::Decl::isInvalidDecl().
Referenced by clang::Sema::FindAllocationFunctions().
| static bool TryClassUnification | ( | Sema & | Self, |
| Expr * | From, | ||
| Expr * | To, | ||
| SourceLocation | QuestionLoc, | ||
| bool & | HaveConversion, | ||
| QualType & | ToType | ||
| ) | [static] |
Try to convert a type to another according to C++0x 5.16p3.
This is part of the parameter validation for the ? operator. If either value operand is a class type, the two operands are attempted to be converted to each other. This function does the conversion in one direction. It returns true if the program is ill-formed and has already been diagnosed as such.
Definition at line 3518 of file SemaExprCXX.cpp.
References clang::Sema::Context, clang::InitializationKind::CreateCopy(), clang::InitializationSequence::Diagnose(), clang::InitializationSequence::Failed(), clang::Stmt::getLocStart(), clang::ASTContext::getLValueReferenceType(), clang::Expr::getType(), clang::QualType::getUnqualifiedType(), clang::InitializedEntity::InitializeTemporary(), clang::InitializationSequence::isAmbiguous(), clang::QualType::isAtLeastAsQualifiedAs(), clang::Sema::IsDerivedFrom(), clang::InitializationSequence::isDirectReferenceBinding(), and clang::Expr::isLValue().
Referenced by clang::Sema::CXXCheckConditionalOperands().