Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions clang/include/clang/AST/CanonBounds.h
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,12 @@ namespace clang {
bool GetDerefOffset(const Expr *UpperExpr, const Expr *DerefExpr,
llvm::APSInt &Offset) const;

/// \brief Get the integer difference between two expressions.
/// The boolean return value indicates whether the two expressions are
/// comparable.
bool GetExprIntDiff(const Expr *E1, const Expr *E2,
llvm::APSInt &Offset) const;

/// \brief Compare declarations that may be used by expressions or
/// or types.
Result CompareDecl(const NamedDecl *D1, const NamedDecl *D2) const;
Expand Down
22 changes: 22 additions & 0 deletions clang/include/clang/AST/PreorderAST.h
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,16 @@ namespace clang {
bool GetDerefOffset(Node *UpperExpr, Node *DerefExpr,
llvm::APSInt &Offset);

// Get the integer difference between expressions.
// @param[in] E1 is the first expression.
// @param[in] E2 is the second expression.
// @param[out] Offset is the integer difference between E1 and E2.
// @return Returns a boolean indicating whether the expressions are
// comparable. True means the expressions are comparable and their integer
// difference is present in the "Offset" parameter. False means the
// expressions are not comparable.
bool GetExprIntDiff(Node *E1, Node *E2, llvm::APSInt &Offset);

// Set Error in case an error occurs during transformation of the AST.
void SetError() { Error = true; }

Expand All @@ -328,6 +338,18 @@ namespace clang {
return GetDerefOffset(/*UpperExpr*/ Root, /*DerefExpr*/ P.Root, Offset);
}

// Get the integer difference between two expressions represented as
// preorder ASTs. This function is intended to be called from outside this
// class.
// @param[in] this is the first AST.
// @param[in] P is the second AST.
// @param[out] Offset is the integer difference.
// @return Returns a bool indicating whether the two expressions are
// comparable.
bool GetExprIntDiff(PreorderAST &P, llvm::APSInt &Offset) {
return GetExprIntDiff(Root, P.Root, Offset);
}

// Lexicographically compare the two ASTs. This is intended to be called
// from outside this class and invokes Compare on the root nodes of the two
// ASTs to recursively compare the AST nodes.
Expand Down
354 changes: 0 additions & 354 deletions clang/include/clang/Sema/BoundsAnalysis.h

This file was deleted.

Loading