clang 20.0.0git
|
#include "clang/AST/Expr.h"
#include "clang/AST/APValue.h"
#include "clang/AST/ASTContext.h"
#include "clang/AST/ASTLambda.h"
#include "clang/AST/Attr.h"
#include "clang/AST/ComputeDependence.h"
#include "clang/AST/DeclCXX.h"
#include "clang/AST/DeclObjC.h"
#include "clang/AST/DeclTemplate.h"
#include "clang/AST/DependenceFlags.h"
#include "clang/AST/EvaluatedExprVisitor.h"
#include "clang/AST/ExprCXX.h"
#include "clang/AST/IgnoreExpr.h"
#include "clang/AST/Mangle.h"
#include "clang/AST/RecordLayout.h"
#include "clang/Basic/Builtins.h"
#include "clang/Basic/CharInfo.h"
#include "clang/Basic/SourceManager.h"
#include "clang/Basic/TargetInfo.h"
#include "clang/Lex/Lexer.h"
#include "clang/Lex/LiteralSupport.h"
#include "clang/Lex/Preprocessor.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/Format.h"
#include "llvm/Support/raw_ostream.h"
#include <algorithm>
#include <cstring>
#include <optional>
#include "clang/AST/StmtNodes.inc"
#include "clang/AST/OperationKinds.def"
Go to the source code of this file.
Macros | |
#define | ABSTRACT_STMT(type) |
#define | STMT(type, base) case Stmt::type##Class: break; |
#define | EXPR(type, base) case Stmt::type##Class: return getExprLocImpl<type>(this, &type::getExprLoc); |
#define | UNARY_OPERATION(Name, Spelling) case UO_##Name: return Spelling; |
#define | CAST_OPERATION(Name) case CK_##Name: return #Name; |
#define | ABSTRACT_STMT(x) |
#define | CASTEXPR(Type, Base) |
#define | STMT(Type, Base) |
#define | BINARY_OPERATION(Name, Spelling) case BO_##Name: return Spelling; |
#define | ABSTRACT_STMT(Type) |
#define | STMT(Type, Base) case Type##Class: |
#define | EXPR(Type, Base) |
Functions | |
static void | AssertResultStorageKind (ConstantResultStorageKind Kind) |
static const Expr * | skipTemporaryBindingsNoOpCastsAndParens (const Expr *E) |
Skip over any no-op casts and any temporary-binding expressions. | |
static std::optional< BinaryOperator * > | getOverflowPatternBinOp (const BinaryOperator *E) |
Certain overflow-dependent code patterns can have their integer overflow sanitization disabled. | |
static void | computeOverflowPatternExclusion (const ASTContext &Ctx, const BinaryOperator *E) |
Compute and set the OverflowPatternExclusion bit based on whether the BinaryOperator expression matches an overflow pattern being ignored by -fsanitize-undefined-ignore-overflow-pattern=add-signed-overflow-test or -fsanitize-undefined-ignore-overflow-pattern=add-unsigned-overflow-test. | |
#define ABSTRACT_STMT | ( | type | ) |
#define ABSTRACT_STMT | ( | Type | ) |
#define ABSTRACT_STMT | ( | x | ) |
#define BINARY_OPERATION | ( | Name, | |
Spelling | |||
) | case BO_##Name: return Spelling; |
#define CAST_OPERATION | ( | Name | ) | case CK_##Name: return #Name; |
#define EXPR | ( | type, | |
base | |||
) | case Stmt::type##Class: return getExprLocImpl<type>(this, &type::getExprLoc); |
#define STMT | ( | type, | |
base | |||
) | case Stmt::type##Class: break; |
#define UNARY_OPERATION | ( | Name, | |
Spelling | |||
) | case UO_##Name: return Spelling; |
|
static |
Definition at line 294 of file Expr.cpp.
References clang::APValue, clang::Int64, and clang::None.
Referenced by clang::ConstantExpr::Create(), and clang::ConstantExpr::CreateEmpty().
|
static |
Compute and set the OverflowPatternExclusion bit based on whether the BinaryOperator expression matches an overflow pattern being ignored by -fsanitize-undefined-ignore-overflow-pattern=add-signed-overflow-test or -fsanitize-undefined-ignore-overflow-pattern=add-unsigned-overflow-test.
Definition at line 4834 of file Expr.cpp.
References clang::LangOptionsBase::AddSignedOverflowTest, clang::LangOptionsBase::AddUnsignedOverflowTest, E, clang::ASTContext::getLangOpts(), getOverflowPatternBinOp(), clang::LangOptions::isOverflowPatternExcluded(), clang::Type::isSignedIntegerType(), clang::Type::isUnsignedIntegerType(), and clang::Result.
Referenced by clang::BinaryOperator::BinaryOperator().
|
static |
Certain overflow-dependent code patterns can have their integer overflow sanitization disabled.
Check for the common pattern if (a + b < a)
and return the resulting BinaryOperator responsible for the addition so we can elide overflow checks during codegen.
Definition at line 4788 of file Expr.cpp.
References clang::Addition, E, clang::BinaryOperator::getLHS(), clang::BinaryOperator::getOpcode(), clang::Expr::getReferencedDeclOfCallee(), clang::BinaryOperator::getRHS(), and clang::Expr::IgnoreParenImpCasts().
Referenced by computeOverflowPatternExclusion().
Skip over any no-op casts and any temporary-binding expressions.
Definition at line 3198 of file Expr.cpp.
References E, and clang::Expr::IgnoreParens().
Referenced by clang::Expr::isTemporaryObject().