clang
8.0.0
|
#include "clang/Analysis/CFG.h"
#include "clang/AST/ASTContext.h"
#include "clang/AST/Attr.h"
#include "clang/AST/Decl.h"
#include "clang/AST/DeclBase.h"
#include "clang/AST/DeclCXX.h"
#include "clang/AST/DeclGroup.h"
#include "clang/AST/Expr.h"
#include "clang/AST/ExprCXX.h"
#include "clang/AST/OperationKinds.h"
#include "clang/AST/PrettyPrinter.h"
#include "clang/AST/Stmt.h"
#include "clang/AST/StmtCXX.h"
#include "clang/AST/StmtObjC.h"
#include "clang/AST/StmtVisitor.h"
#include "clang/AST/Type.h"
#include "clang/Analysis/Support/BumpVector.h"
#include "clang/Analysis/ConstructionContext.h"
#include "clang/Basic/Builtins.h"
#include "clang/Basic/ExceptionSpecificationType.h"
#include "clang/Basic/LLVM.h"
#include "clang/Basic/LangOptions.h"
#include "clang/Basic/SourceLocation.h"
#include "clang/Basic/Specifiers.h"
#include "llvm/ADT/APInt.h"
#include "llvm/ADT/APSInt.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/Optional.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SetVector.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/Support/Allocator.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/DOTGraphTraits.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/Format.h"
#include "llvm/Support/GraphWriter.h"
#include "llvm/Support/SaveAndRestore.h"
#include "llvm/Support/raw_ostream.h"
#include <cassert>
#include <memory>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
Go to the source code of this file.
Classes | |
struct | llvm::DOTGraphTraits< const CFG * > |
Namespaces | |
llvm | |
DominatorTree GraphTraits specialization so the DominatorTree can be iterable by generic graph iterators. | |
Functions | |
static SourceLocation | GetEndLoc (Decl *D) |
static const Expr * | tryTransformToIntOrEnumConstant (const Expr *E) |
Helper for tryNormalizeBinaryOperator. More... | |
static std::tuple< const DeclRefExpr *, BinaryOperatorKind, const Expr * > | tryNormalizeBinaryOperator (const BinaryOperator *B) |
Tries to interpret a binary operator into Decl Op Expr form, if Expr is an integer literal or an enum constant. More... | |
static bool | areExprTypesCompatible (const Expr *E1, const Expr *E2) |
For an expression x == Foo && x == Bar , this determines whether the Foo and Bar are either of the same enumeration type, or both integer literals. More... | |
static TryResult | bothKnownTrue (TryResult R1, TryResult R2) |
static const VariableArrayType * | FindVA (const Type *t) |
static QualType | getReferenceInitTemporaryType (const Expr *Init, bool *FoundMTE=nullptr) |
Retrieve the type of the temporary object whose lifetime was extended by a local reference with the given initializer. More... | |
static bool | CanThrow (Expr *E, ASTContext &Ctx) |
static bool | shouldAddCase (bool &switchExclusivelyCovered, const Expr::EvalResult *switchCond, const CaseStmt *CS, ASTContext &Ctx) |
static void | print_initializer (raw_ostream &OS, StmtPrinterHelper &Helper, const CXXCtorInitializer *I) |
static void | print_construction_context (raw_ostream &OS, StmtPrinterHelper &Helper, const ConstructionContext *CC) |
static void | print_elem (raw_ostream &OS, StmtPrinterHelper &Helper, const CFGElement &E) |
static void | print_block (raw_ostream &OS, const CFG *cfg, const CFGBlock &B, StmtPrinterHelper &Helper, bool print_edges, bool ShowColors) |
Variables | |
static StmtPrinterHelper * | GraphHelper |
For an expression x == Foo && x == Bar
, this determines whether the Foo
and Bar
are either of the same enumeration type, or both integer literals.
It's an error to pass this arguments that are not either IntegerLiterals or DeclRefExprs (that have decls of type EnumConstantDecl)
Definition at line 121 of file CFG.cpp.
References clang::ast_matchers::stmt.
|
static |
Definition at line 382 of file CFG.cpp.
References clang::children().
|
static |
Definition at line 2407 of file CFG.cpp.
References clang::C, clang::Type::getAs(), clang::CallExpr::getCallee(), clang::PointerType::getPointeeType(), clang::BlockPointerType::getPointeeType(), clang::Expr::getType(), clang::Type::isBlockPointerType(), clang::Type::isFunctionPointerType(), and clang::isUnresolvedExceptionSpec().
Referenced by clang::ASTContext::AnyObjCImplementation(), clang::Sema::BuildCXXNoexceptExpr(), clang::CodeGen::CodeGenFunction::enterByrefCleanup(), findBlockCapturedManagedEntities(), clang::CodeGen::CodeGenFunction::getCleanupKind(), and pushCaptureCleanup().
|
static |
Definition at line 1260 of file CFG.cpp.
References clang::ConstructionContextLayer::create(), clang::ConstructionContextItem::ElidableConstructorKind, clang::ConstructionContextLayer::getItem(), clang::ConstructionContextItem::getKind(), clang::Stmt::getStmtClass(), clang::CFGCXXRecordTypedCall::isCXXRecordTypedCall(), and clang::ConstructionContextItem::MaterializationKind.
|
static |
Definition at line 66 of file CFG.cpp.
References clang::Decl::getLocation().
|
static |
Retrieve the type of the temporary object whose lifetime was extended by a local reference with the given initializer.
Definition at line 1560 of file CFG.cpp.
References clang::Expr::getType(), clang::Expr::IgnoreParens(), clang::Type::isReferenceType(), P, and clang::Expr::skipRValueSubobjectAdjustments().
Referenced by clang::CFGImplicitDtor::getDestructorDecl(), and print_elem().
|
static |
Definition at line 5234 of file CFG.cpp.
References clang::CFGBlock::begin(), clang::CFGBlock::end(), clang::CFGBlock::getBlockID(), clang::CFG::getEntry(), clang::CXXCatchStmt::getExceptionDecl(), clang::CFG::getExit(), clang::SEHExceptStmt::getFilterExpr(), clang::CFG::getIndirectGotoBlock(), clang::CFGBlock::getLabel(), clang::LabelStmt::getName(), clang::CFGBlock::getTerminator(), clang::CFGBlock::hasNoReturnElement(), Label, clang::CFGBlock::pred_begin(), clang::CFGBlock::pred_empty(), clang::CFGBlock::pred_end(), clang::CFGBlock::pred_size(), clang::Decl::print(), print_elem(), clang::Stmt::printPretty(), clang::CFGBlock::succ_begin(), clang::CFGBlock::succ_empty(), clang::CFGBlock::succ_end(), and clang::CFGBlock::succ_size().
Referenced by llvm::DOTGraphTraits< const CFG * >::getNodeLabel(), clang::CFGBlock::print(), and clang::CFG::print().
|
static |
Definition at line 5033 of file CFG.cpp.
References clang::ConstructionContext::ArgumentKind, clang::ConstructionContext::CXX17ElidedCopyConstructorInitializerKind, clang::ConstructionContext::CXX17ElidedCopyReturnedValueKind, clang::ConstructionContext::CXX17ElidedCopyVariableKind, clang::ConstructionContext::ElidedTemporaryObjectKind, clang::ConstructionContext::getKind(), clang::ConstructionContext::NewAllocatedObjectKind, print_initializer(), clang::ConstructionContext::SimpleConstructorInitializerKind, clang::ConstructionContext::SimpleReturnedValueKind, clang::ConstructionContext::SimpleTemporaryObjectKind, and clang::ConstructionContext::SimpleVariableKind.
Referenced by print_elem().
|
static |
Definition at line 5112 of file CFG.cpp.
References clang::CompoundStmt::body_rbegin(), clang::CompoundStmt::children(), clang::CXXDeleteExpr::getArgument(), clang::CFGElement::getAs(), clang::ASTContext::getAsArrayType(), clang::Type::getAsCXXRecordDecl(), clang::Decl::getASTContext(), clang::ASTContext::getBaseElementType(), clang::Type::getBaseElementTypeUnsafe(), clang::VarDecl::getInit(), clang::NamedDecl::getName(), clang::NamedDecl::getQualifiedNameAsString(), getReferenceInitTemporaryType(), clang::Stmt::getStmtClassName(), clang::StmtExpr::getSubStmt(), clang::Expr::getType(), clang::CXXBaseSpecifier::getType(), clang::ValueDecl::getType(), clang::Type::isReferenceType(), clang::QualType::print(), print_construction_context(), print_initializer(), and clang::Stmt::printPretty().
Referenced by print_block().
|
static |
Definition at line 5012 of file CFG.cpp.
References clang::CXXCtorInitializer::getAnyMember(), clang::Type::getAsCXXRecordDecl(), clang::CXXCtorInitializer::getBaseClass(), clang::CXXCtorInitializer::getInit(), clang::NamedDecl::getName(), clang::TypeSourceInfo::getType(), clang::CXXCtorInitializer::getTypeSourceInfo(), clang::CXXCtorInitializer::isBaseInitializer(), and clang::CXXCtorInitializer::isDelegatingInitializer().
Referenced by print_construction_context(), and print_elem().
|
static |
Definition at line 3924 of file CFG.cpp.
References clang::Expr::EvaluateKnownConstInt(), clang::APValue::getInt(), clang::CaseStmt::getLHS(), clang::CaseStmt::getRHS(), clang::CaseStmt::getSubStmt(), clang::APValue::isInt(), clang::CFGBlock::setLabel(), and clang::Expr::EvalResult::Val.
|
static |
Tries to interpret a binary operator into Decl Op Expr
form, if Expr is an integer literal or an enum constant.
If this fails, at least one of the returned DeclRefExpr or Expr will be null.
Definition at line 90 of file CFG.cpp.
References clang::BinaryOperator::getLHS(), clang::BinaryOperator::getOpcode(), clang::BinaryOperator::getRHS(), clang::Expr::IgnoreParenImpCasts(), and tryTransformToIntOrEnumConstant().
Helper for tryNormalizeBinaryOperator.
Attempts to extract an IntegerLiteral or EnumConstantDecl from the given Expr. If it fails, returns nullptr.
Definition at line 75 of file CFG.cpp.
References clang::Expr::IgnoreParenImpCasts(), and clang::Expr::IgnoreParens().
Referenced by tryNormalizeBinaryOperator().