34 if (isa<PointerType>(From) && isa<PointerType>(To)) {
67 bool NeedParen =
true;
68 if (isa<ArraySubscriptExpr>(
Expr) ||
69 isa<CallExpr>(
Expr) ||
70 isa<DeclRefExpr>(
Expr) ||
71 isa<CastExpr>(
Expr) ||
72 isa<CXXNewExpr>(
Expr) ||
73 isa<CXXConstructExpr>(
Expr) ||
74 isa<CXXDeleteExpr>(
Expr) ||
75 isa<CXXNoexceptExpr>(
Expr) ||
76 isa<CXXPseudoDestructorExpr>(
Expr) ||
77 isa<CXXScalarValueInitExpr>(
Expr) ||
78 isa<CXXThisExpr>(
Expr) ||
79 isa<CXXTypeidExpr>(
Expr) ||
80 isa<CXXUnresolvedConstructExpr>(
Expr) ||
81 isa<ObjCMessageExpr>(
Expr) ||
82 isa<ObjCPropertyRefExpr>(
Expr) ||
83 isa<ObjCProtocolExpr>(
Expr) ||
84 isa<MemberExpr>(
Expr) ||
86 isa<ParenListExpr>(
Expr) ||
87 isa<SizeOfPackExpr>(
Expr) ||
88 isa<UnaryOperator>(
Expr))
93 if (
const PointerType *FromPtrTy = dyn_cast<PointerType>(FromQTy)) {
106 if (UO->getOpcode() == UO_AddrOf) {
111 }
else if (NeedParen) {
127 if (
const auto *ToPtrTy = dyn_cast<PointerType>(ToQTy)) {
128 bool CanConvert =
false;
136 if (isa<PointerType>(FromQTy) && ToPtrTy->isVoidPointerType())
144 if (UO->getOpcode() == UO_Deref) {
149 }
else if (NeedParen) {
177 return std::string();
214 return std::string();
219 return std::string();
Defines the clang::ASTContext interface.
Defines the clang::Expr interface and subclasses for C++ expressions.
Defines the clang::Preprocessor interface.
static std::string getScalarZeroExpressionForType(const Type &T, SourceLocation Loc, const Sema &S)
static bool isMacroDefined(const Sema &S, SourceLocation Loc, StringRef Name)
static QualType getPointeeType(const MemRegion *R)
__device__ __2f16 float __ockl_bool s
CanQualType getCanonicalType(QualType T) const
Return the canonical (structural) type corresponding to the specified potentially non-canonical type ...
QualType getPointerType(QualType T) const
Return the uniqued reference to the type for a pointer to the specified type.
Represents a C++ struct/union/class.
bool isAggregate() const
Determine whether this class is an aggregate (C++ [dcl.init.aggr]), which is a class with no user-dec...
bool hasUserProvidedDefaultConstructor() const
Whether this class has a user-provided default constructor per C++11.
bool hasDefinition() const
CanQual< Type > getNonReferenceType() const
If the canonical type is a reference type, returns the type that it refers to; otherwise,...
CanQual< T > getUnqualifiedType() const
Retrieve the unqualified form of this type.
bool isAtLeastAsQualifiedAs(CanQual< T > Other) const
Determines whether this canonical type is at least as qualified as the Other canonical type.
static CharSourceRange getTokenRange(SourceRange R)
This represents one expression.
Expr * IgnoreParenCasts() LLVM_READONLY
Skip past any parentheses and casts which might surround this expression until reaching a fixed point...
bool isLValue() const
isLValue - True if this expression is an "l-value" according to the rules of the current language.
@ NPC_ValueDependentIsNotNull
Specifies that a value-dependent expression should be considered to never be a null pointer constant.
ExprObjectKind getObjectKind() const
getObjectKind - The object kind that this expression produces.
Expr * IgnoreImpCasts() LLVM_READONLY
Skip past any implicit casts which might surround this expression until reaching a fixed point.
static FixItHint CreateRemoval(CharSourceRange RemoveRange)
Create a code modification hint that removes the given source range.
static FixItHint CreateInsertion(SourceLocation InsertionLoc, StringRef Code, bool BeforePreviousInsertions=false)
Create a code modification hint that inserts the given code string at a specific location.
FullExpr - Represents a "full-expression" node.
IdentifierInfo & get(StringRef Name)
Return the identifier token info for the specified named identifier.
PointerType - C99 6.7.5.1 - Pointer Declarators.
MacroDefinition getMacroDefinitionAtLoc(const IdentifierInfo *II, SourceLocation Loc)
A (possibly-)qualified type.
Sema - This implements semantic analysis and AST building for C.
std::string getFixItZeroLiteralForType(QualType T, SourceLocation Loc) const
ASTContext & getASTContext() const
std::string getFixItZeroInitializerForType(QualType T, SourceLocation Loc) const
Get a string to suggest for zero-initialization of a type.
SourceLocation getLocForEndOfToken(SourceLocation Loc, unsigned Offset=0)
Calls Lexer::getLocForEndOfToken()
const LangOptions & LangOpts
bool IsDerivedFrom(SourceLocation Loc, QualType Derived, QualType Base)
Determine whether the type Derived is a C++ class that is derived from the type Base.
Encodes a location in the source.
SourceLocation getEnd() const
SourceLocation getBegin() const
SourceRange getSourceRange() const LLVM_READONLY
SourceLocation tokens are not useful in isolation - they are low level value objects created/interpre...
The base class of the type hierarchy.
CXXRecordDecl * getAsCXXRecordDecl() const
Retrieves the CXXRecordDecl that this type refers to, either because the type is a RecordType or beca...
bool isBlockPointerType() const
bool isBooleanType() const
bool isPointerType() const
bool isEnumeralType() const
bool isScalarType() const
bool isChar16Type() const
bool isMemberPointerType() const
bool isChar32Type() const
bool isObjCObjectPointerType() const
bool isRealFloatingType() const
Floating point categories.
bool isWideCharType() const
UnaryOperator - This represents the unary-expression's (except sizeof and alignof),...
The JSON file list parser is used to communicate input to InstallAPI.
@ OK_Ordinary
An ordinary object is located at an address in memory.
ExprValueKind
The categorization of expression values, currently following the C++11 scheme.
@ VK_PRValue
A pr-value expression (in the C++11 taxonomy) produces a temporary value.
@ VK_LValue
An l-value expression is a reference to an object with independent storage.
const FunctionProtoType * T
OverloadFixItKind Kind
The type of fix applied.
unsigned NumConversionsFixed
The number of Conversions fixed.
TypeComparisonFuncTy CompareTypes
The type comparison function used to decide if expression FromExpr of type FromTy can be converted to...
bool tryToFixConversion(const Expr *FromExpr, const QualType FromQTy, const QualType ToQTy, Sema &S)
If possible, generates and stores a fix for the given conversion.
static bool compareTypesSimple(CanQualType From, CanQualType To, Sema &S, SourceLocation Loc, ExprValueKind FromVK)
Performs a simple check to see if From type can be converted to To type.
std::vector< FixItHint > Hints
The list of Hints generated so far.