29#include "llvm/ADT/StringExtras.h"
30#include "llvm/ADT/StringRef.h"
37using namespace threadSafety;
42 case Stmt::IntegerLiteralClass:
43 return toString(cast<IntegerLiteral>(CE)->getValue(), 10,
true);
44 case Stmt::StringLiteralClass: {
45 std::string ret(
"\"");
46 ret += cast<StringLiteral>(CE)->getString();
50 case Stmt::CharacterLiteralClass:
51 case Stmt::CXXNullPtrLiteralExprClass:
52 case Stmt::GNUNullExprClass:
53 case Stmt::CXXBoolLiteralExprClass:
54 case Stmt::FloatingLiteralClass:
55 case Stmt::ImaginaryLiteralClass:
56 case Stmt::ObjCStringLiteralClass:
64 if (
const auto *Ph = dyn_cast<til::Phi>(
E))
75 if (
const auto *CA = TD.
getAttr<CapabilityAttr>())
76 return {CA->getName(), TD.
hasAttr<ReentrantCapabilityAttr>()};
112 return ME ? ME->isArrow() :
false;
129 if (!DeclExp && !
Self)
138 else if (
const auto *ME = dyn_cast<MemberExpr>(DeclExp)) {
139 Ctx.SelfArg = ME->getBase();
140 Ctx.SelfArrow = ME->isArrow();
141 }
else if (
const auto *CE = dyn_cast<CXXMemberCallExpr>(DeclExp)) {
142 Ctx.SelfArg = CE->getImplicitObjectArgument();
144 Ctx.NumArgs = CE->getNumArgs();
145 Ctx.FunArgs = CE->getArgs();
146 }
else if (
const auto *CE = dyn_cast<CallExpr>(DeclExp)) {
148 if (isa<CXXOperatorCallExpr>(CE) && isa<CXXMethodDecl>(
D)) {
149 Ctx.SelfArg = CE->getArg(0);
150 Ctx.SelfArrow =
false;
151 Ctx.NumArgs = CE->getNumArgs() - 1;
152 Ctx.FunArgs = CE->getArgs() + 1;
154 Ctx.NumArgs = CE->getNumArgs();
155 Ctx.FunArgs = CE->getArgs();
157 }
else if (
const auto *CE = dyn_cast<CXXConstructExpr>(DeclExp)) {
158 Ctx.SelfArg =
nullptr;
159 Ctx.NumArgs = CE->getNumArgs();
160 Ctx.FunArgs = CE->getArgs();
167 if (
const auto *CMD = dyn_cast<CXXMethodDecl>(
D))
168 if (CMD->getParent()->isLambda())
169 Ctx.SelfArg =
nullptr;
172 assert(!Ctx.SelfArg &&
"Ambiguous self argument");
173 assert(isa<FunctionDecl>(
D) &&
"Self argument requires function");
174 if (isa<CXXMethodDecl>(
D))
182 Self, cast<CXXMethodDecl>(
D)->getFunctionObjectParameterType(),
202 if (
const auto* SLit = dyn_cast<StringLiteral>(AttrExp)) {
203 if (SLit->getString() ==
"*")
214 if (
const auto *OE = dyn_cast<CXXOperatorCallExpr>(AttrExp)) {
215 if (OE->getOperator() == OO_Exclaim) {
217 AttrExp = OE->getArg(0);
220 else if (
const auto *UO = dyn_cast<UnaryOperator>(AttrExp)) {
221 if (UO->getOpcode() == UO_LNot) {
231 if (!
E || isa<til::Literal>(
E))
235 if (
const auto *CE = dyn_cast<til::Cast>(
E)) {
258 switch (S->getStmtClass()) {
259 case Stmt::DeclRefExprClass:
260 return translateDeclRefExpr(cast<DeclRefExpr>(S), Ctx);
261 case Stmt::CXXThisExprClass:
262 return translateCXXThisExpr(cast<CXXThisExpr>(S), Ctx);
263 case Stmt::MemberExprClass:
264 return translateMemberExpr(cast<MemberExpr>(S), Ctx);
265 case Stmt::ObjCIvarRefExprClass:
266 return translateObjCIVarRefExpr(cast<ObjCIvarRefExpr>(S), Ctx);
267 case Stmt::CallExprClass:
268 return translateCallExpr(cast<CallExpr>(S), Ctx);
269 case Stmt::CXXMemberCallExprClass:
270 return translateCXXMemberCallExpr(cast<CXXMemberCallExpr>(S), Ctx);
271 case Stmt::CXXOperatorCallExprClass:
272 return translateCXXOperatorCallExpr(cast<CXXOperatorCallExpr>(S), Ctx);
273 case Stmt::UnaryOperatorClass:
274 return translateUnaryOperator(cast<UnaryOperator>(S), Ctx);
275 case Stmt::BinaryOperatorClass:
276 case Stmt::CompoundAssignOperatorClass:
277 return translateBinaryOperator(cast<BinaryOperator>(S), Ctx);
279 case Stmt::ArraySubscriptExprClass:
280 return translateArraySubscriptExpr(cast<ArraySubscriptExpr>(S), Ctx);
281 case Stmt::ConditionalOperatorClass:
282 return translateAbstractConditionalOperator(
283 cast<ConditionalOperator>(S), Ctx);
284 case Stmt::BinaryConditionalOperatorClass:
285 return translateAbstractConditionalOperator(
286 cast<BinaryConditionalOperator>(S), Ctx);
289 case Stmt::ConstantExprClass:
290 return translate(cast<ConstantExpr>(S)->getSubExpr(), Ctx);
291 case Stmt::ParenExprClass:
292 return translate(cast<ParenExpr>(S)->getSubExpr(), Ctx);
293 case Stmt::ExprWithCleanupsClass:
294 return translate(cast<ExprWithCleanups>(S)->getSubExpr(), Ctx);
295 case Stmt::CXXBindTemporaryExprClass:
296 return translate(cast<CXXBindTemporaryExpr>(S)->getSubExpr(), Ctx);
297 case Stmt::MaterializeTemporaryExprClass:
298 return translate(cast<MaterializeTemporaryExpr>(S)->getSubExpr(), Ctx);
301 case Stmt::CharacterLiteralClass:
302 case Stmt::CXXNullPtrLiteralExprClass:
303 case Stmt::GNUNullExprClass:
304 case Stmt::CXXBoolLiteralExprClass:
305 case Stmt::FloatingLiteralClass:
306 case Stmt::ImaginaryLiteralClass:
307 case Stmt::IntegerLiteralClass:
308 case Stmt::StringLiteralClass:
309 case Stmt::ObjCStringLiteralClass:
312 case Stmt::DeclStmtClass:
313 return translateDeclStmt(cast<DeclStmt>(S), Ctx);
317 if (
const auto *CE = dyn_cast<CastExpr>(S))
318 return translateCastExpr(CE, Ctx);
328 if (
const auto *PV = dyn_cast<ParmVarDecl>(VD)) {
329 unsigned I = PV->getFunctionScopeIndex();
331 if (Ctx && Ctx->FunArgs) {
332 const Decl *Canonical = Ctx->AttrDecl->getCanonicalDecl();
333 if (isa<FunctionDecl>(
D)
337 if (
const Expr *
const *FunArgs =
338 dyn_cast<const Expr *const *>(Ctx->FunArgs)) {
339 assert(I < Ctx->NumArgs);
344 return cast<til::SExpr *>(Ctx->FunArgs);
349 VD = isa<FunctionDecl>(
D)
350 ? cast<FunctionDecl>(
D)->getCanonicalDecl()->getParamDecl(I)
351 : cast<ObjCMethodDecl>(
D)->getCanonicalDecl()->getParamDecl(I);
361 if (Ctx && Ctx->SelfArg) {
362 if (
const auto *SelfArg = dyn_cast<const Expr *>(Ctx->SelfArg))
365 return cast<til::SExpr *>(Ctx->SelfArg);
367 assert(SelfVar &&
"We have no variable for 'this'!");
372 if (
const auto *
V = dyn_cast<til::Variable>(
E))
373 return V->clangDecl();
374 if (
const auto *Ph = dyn_cast<til::Phi>(
E))
375 return Ph->clangDecl();
376 if (
const auto *
P = dyn_cast<til::Project>(
E))
377 return P->clangDecl();
378 if (
const auto *L = dyn_cast<til::LiteralPtr>(
E))
379 return L->clangDecl();
385 if (VD && VD->getType()->isAnyPointerType())
387 if (
const auto *
C = dyn_cast<til::Cast>(
E))
397 auto OverriddenMethods =
D->overridden_methods();
398 if (OverriddenMethods.begin() == OverriddenMethods.end())
401 D = *OverriddenMethods.begin();
412 if (
const auto *VD = dyn_cast<CXXMethodDecl>(
D))
437 if (CapabilityExprMode) {
440 FD = FD->getMostRecentDecl();
441 if (LockReturnedAttr *At = FD->getAttr<LockReturnedAttr>()) {
444 LRCallCtx.SelfArg = SelfE;
446 LRCallCtx.FunArgs = CE->
getArgs();
454 for (
const auto *Arg : CE->
arguments()) {
461til::SExpr *SExprBuilder::translateCXXMemberCallExpr(
463 if (CapabilityExprMode) {
472 return translateCallExpr(cast<CallExpr>(ME), Ctx,
476til::SExpr *SExprBuilder::translateCXXOperatorCallExpr(
478 if (CapabilityExprMode) {
481 if (k == OO_Star || k == OO_Arrow) {
487 return translateCallExpr(cast<CallExpr>(OCE), Ctx);
500 if (CapabilityExprMode) {
502 if (
const auto *DRE = dyn_cast<DeclRefExpr>(UO->
getSubExpr())) {
561 if (
const auto *DRE = dyn_cast<DeclRefExpr>(LHS)) {
563 CV = lookupVarDecl(VD);
569 E1 = addStatement(E1,
nullptr, VD);
572 return updateVarDecl(VD, E1);
583 case BO_Mul:
return translateBinOp(
til::BOP_Mul, BO, Ctx);
584 case BO_Div:
return translateBinOp(
til::BOP_Div, BO, Ctx);
585 case BO_Rem:
return translateBinOp(
til::BOP_Rem, BO, Ctx);
586 case BO_Add:
return translateBinOp(
til::BOP_Add, BO, Ctx);
587 case BO_Sub:
return translateBinOp(
til::BOP_Sub, BO, Ctx);
588 case BO_Shl:
return translateBinOp(
til::BOP_Shl, BO, Ctx);
589 case BO_Shr:
return translateBinOp(
til::BOP_Shr, BO, Ctx);
590 case BO_LT:
return translateBinOp(
til::BOP_Lt, BO, Ctx);
591 case BO_GT:
return translateBinOp(
til::BOP_Lt, BO, Ctx,
true);
592 case BO_LE:
return translateBinOp(
til::BOP_Leq, BO, Ctx);
593 case BO_GE:
return translateBinOp(
til::BOP_Leq, BO, Ctx,
true);
594 case BO_EQ:
return translateBinOp(
til::BOP_Eq, BO, Ctx);
595 case BO_NE:
return translateBinOp(
til::BOP_Neq, BO, Ctx);
596 case BO_Cmp:
return translateBinOp(
til::BOP_Cmp, BO, Ctx);
603 case BO_Assign:
return translateBinAssign(
til::BOP_Eq, BO, Ctx,
true);
604 case BO_MulAssign:
return translateBinAssign(
til::BOP_Mul, BO, Ctx);
605 case BO_DivAssign:
return translateBinAssign(
til::BOP_Div, BO, Ctx);
606 case BO_RemAssign:
return translateBinAssign(
til::BOP_Rem, BO, Ctx);
607 case BO_AddAssign:
return translateBinAssign(
til::BOP_Add, BO, Ctx);
608 case BO_SubAssign:
return translateBinAssign(
til::BOP_Sub, BO, Ctx);
609 case BO_ShlAssign:
return translateBinAssign(
til::BOP_Shl, BO, Ctx);
610 case BO_ShrAssign:
return translateBinAssign(
til::BOP_Shr, BO, Ctx);
611 case BO_AndAssign:
return translateBinAssign(
til::BOP_BitAnd, BO, Ctx);
612 case BO_XorAssign:
return translateBinAssign(
til::BOP_BitXor, BO, Ctx);
613 case BO_OrAssign:
return translateBinAssign(
til::BOP_BitOr, BO, Ctx);
626 case CK_LValueToRValue: {
627 if (
const auto *DRE = dyn_cast<DeclRefExpr>(CE->
getSubExpr())) {
638 case CK_DerivedToBase:
639 case CK_UncheckedDerivedToBase:
640 case CK_ArrayToPointerDecay:
641 case CK_FunctionToPointerDecay: {
648 if (CapabilityExprMode)
664SExprBuilder::translateAbstractConditionalOperator(
675 for (
auto *I : DGrp) {
676 if (
auto *VD = dyn_cast_or_null<VarDecl>(I)) {
677 Expr *
E = VD->getInit();
683 return addVarDecl(VD, SE);
702 CurrentInstructions.push_back(
E);
710 auto It = LVarIdxMap.find(VD);
711 if (It != LVarIdxMap.end()) {
712 assert(CurrentLVarMap[It->second].first == VD);
713 return CurrentLVarMap[It->second].second;
722 if (
auto *
V = dyn_cast<til::Variable>(
E)) {
731 LVarIdxMap.insert(std::make_pair(VD, CurrentLVarMap.
size()));
733 CurrentLVarMap.
push_back(std::make_pair(VD,
E));
740 auto It = LVarIdxMap.find(VD);
741 if (It == LVarIdxMap.end()) {
747 CurrentLVarMap.
elem(It->second).second =
E;
754void SExprBuilder::makePhiNodeVar(
unsigned i,
unsigned NPreds,
til::SExpr *
E) {
755 unsigned ArgIndex = CurrentBlockInfo->ProcessedPredecessors;
756 assert(ArgIndex > 0 && ArgIndex < NPreds);
759 if (CurrE->
block() == CurrentBB) {
762 auto *Ph = dyn_cast<til::Phi>(CurrE);
763 assert(Ph &&
"Expecting Phi node.");
765 Ph->values()[ArgIndex] =
E;
773 for (
unsigned PIdx = 0; PIdx < ArgIndex; ++PIdx)
774 Ph->
values()[PIdx] = CurrE;
784 CurrentArguments.push_back(Ph);
786 IncompleteArgs.push_back(Ph);
789 CurrentLVarMap.
elem(i).second = Ph;
794void SExprBuilder::mergeEntryMap(LVarDefinitionMap Map) {
795 assert(CurrentBlockInfo &&
"Not processing a block!");
797 if (!CurrentLVarMap.
valid()) {
799 CurrentLVarMap = std::move(Map);
802 if (CurrentLVarMap.
sameAs(Map))
806 unsigned ESz = CurrentLVarMap.
size();
807 unsigned MSz = Map.size();
808 unsigned Sz = std::min(ESz, MSz);
810 for (
unsigned i = 0; i < Sz; ++i) {
811 if (CurrentLVarMap[i].first != Map[i].first) {
817 if (CurrentLVarMap[i].second != Map[i].second)
818 makePhiNodeVar(i, NPreds, Map[i].second);
822 CurrentLVarMap.
downsize(Map.size());
828void SExprBuilder::mergeEntryMapBackEdge() {
837 assert(CurrentBlockInfo &&
"Not processing a block!");
839 if (CurrentBlockInfo->HasBackEdges)
841 CurrentBlockInfo->HasBackEdges =
true;
844 unsigned Sz = CurrentLVarMap.
size();
847 for (
unsigned i = 0; i < Sz; ++i)
848 makePhiNodeVar(i, NPreds,
nullptr);
854void SExprBuilder::mergePhiNodesBackEdge(
const CFGBlock *Blk) {
856 unsigned ArgIndex = BBInfo[Blk->
getBlockID()].ProcessedPredecessors;
857 assert(ArgIndex > 0 && ArgIndex < BB->numPredecessors());
860 auto *Ph = dyn_cast_or_null<til::Phi>(PE);
861 assert(Ph &&
"Expecting Phi Node.");
862 assert(Ph->
values()[ArgIndex] ==
nullptr &&
"Wrong index for back edge.");
865 assert(
E &&
"Couldn't find local variable for Phi node.");
874 Scfg =
new (Arena)
til::SCFG(Arena, NBlocks);
877 BBInfo.resize(NBlocks);
878 BlockMap.resize(NBlocks,
nullptr);
880 for (
auto *B : *Cfg) {
883 BlockMap[B->getBlockID()] = BB;
887 auto Parms = isa<ObjCMethodDecl>(
D) ? cast<ObjCMethodDecl>(
D)->parameters()
888 : cast<FunctionDecl>(
D)->parameters();
889 for (
auto *Pm : Parms) {
891 if (!
T.isTrivialType(Pm->getASTContext()))
903void SExprBuilder::enterCFGBlock(
const CFGBlock *B) {
907 Scfg->
add(CurrentBB);
916void SExprBuilder::handlePredecessor(
const CFGBlock *Pred) {
920 BlockInfo *PredInfo = &BBInfo[Pred->
getBlockID()];
921 assert(PredInfo->UnprocessedSuccessors > 0);
923 if (--PredInfo->UnprocessedSuccessors == 0)
924 mergeEntryMap(std::move(PredInfo->ExitMap));
926 mergeEntryMap(PredInfo->ExitMap.clone());
928 ++CurrentBlockInfo->ProcessedPredecessors;
931void SExprBuilder::handlePredecessorBackEdge(
const CFGBlock *Pred) {
932 mergeEntryMapBackEdge();
935void SExprBuilder::enterCFGBlockBody(
const CFGBlock *B) {
939 static_cast<unsigned>(CurrentArguments.size()), Arena);
940 for (
auto *A : CurrentArguments)
944void SExprBuilder::handleStatement(
const Stmt *S) {
949void SExprBuilder::handleDestructorCall(
const VarDecl *VD,
955 addStatement(
E,
nullptr);
958void SExprBuilder::exitCFGBlockBody(
const CFGBlock *B) {
960 static_cast<unsigned>(CurrentInstructions.size()), Arena);
961 for (
auto *
V : CurrentInstructions)
971 auto *Tm =
new (Arena)
til::Goto(BB, Idx);
985void SExprBuilder::handleSuccessor(
const CFGBlock *Succ) {
986 ++CurrentBlockInfo->UnprocessedSuccessors;
989void SExprBuilder::handleSuccessorBackEdge(
const CFGBlock *Succ) {
990 mergePhiNodesBackEdge(Succ);
991 ++BBInfo[Succ->
getBlockID()].ProcessedPredecessors;
994void SExprBuilder::exitCFGBlock(
const CFGBlock *B) {
995 CurrentArguments.clear();
996 CurrentInstructions.clear();
997 CurrentBlockInfo->ExitMap = std::move(CurrentLVarMap);
999 CurrentBlockInfo =
nullptr;
1003 for (
auto *Ph : IncompleteArgs) {
1008 CurrentArguments.clear();
1009 CurrentInstructions.clear();
1010 IncompleteArgs.clear();
1022namespace threadSafety {
1025 llvm::BumpPtrAllocator Bpa;
1029 TILPrinter::print(Scfg, llvm::errs());
llvm::DenseMap< const Stmt *, CFGBlock * > SMap
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate....
Defines the clang::Expr interface and subclasses for C++ expressions.
static const Decl * getCanonicalDecl(const Decl *D)
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified.
Defines an enumeration for C++ overloaded operators.
static std::string toString(const clang::SanitizerSet &Sanitizers)
Produce a string containing comma-separated names of sanitizers in Sanitizers set.
Defines various enumerations that describe declaration and type specifiers.
static bool isIncompletePhi(const til::SExpr *E)
static const ValueDecl * getValueDeclFromSExpr(const til::SExpr *E)
static void maybeUpdateVD(til::SExpr *E, const ValueDecl *VD)
static bool hasAnyPointerType(const til::SExpr *E)
static const CXXMethodDecl * getFirstVirtualDecl(const CXXMethodDecl *D)
static std::pair< StringRef, bool > classifyCapability(const TypeDecl &TD)
static bool isCalleeArrow(const Expr *E)
static constexpr std::pair< StringRef, bool > ClassifyCapabilityFallback
C Language Family Type Representation.
AbstractConditionalOperator - An abstract base class for ConditionalOperator and BinaryConditionalOpe...
Expr * getCond() const
getCond - Return the expression representing the condition for the ?: operator.
Expr * getTrueExpr() const
getTrueExpr - Return the subexpression representing the value of the expression if the condition eval...
Expr * getFalseExpr() const
getFalseExpr - Return the subexpression representing the value of the expression if the condition eva...
ArraySubscriptExpr - [C99 6.5.2.1] Array Subscripting.
A builtin binary operation expression such as "x + y" or "x <= y".
Represents a single basic block in a source-level CFG.
succ_iterator succ_begin()
unsigned pred_size() const
unsigned getBlockID() const
Stmt * getTerminatorCondition(bool StripParens=true)
unsigned succ_size() const
Represents a source-level, intra-procedural CFG that represents the control-flow of a Stmt.
unsigned getNumBlockIDs() const
Returns the total number of BlockIDs allocated (which start at 0).
Represents a C++ destructor within a class.
Represents a call to a member function that may be written either with member call syntax (e....
CXXMethodDecl * getMethodDecl() const
Retrieve the declaration of the called method.
Expr * getImplicitObjectArgument() const
Retrieve the implicit object argument for the member call.
Represents a static or instance method of a struct/union/class.
A call to an overloaded operator written using operator syntax.
OverloadedOperatorKind getOperator() const
Returns the kind of overloaded operator that this expression refers to.
Represents the this expression in C++.
CallExpr - Represents a function call (C99 6.5.2.2, C++ [expr.call]).
Expr * getArg(unsigned Arg)
getArg - Return the specified argument.
FunctionDecl * getDirectCallee()
If the callee is a FunctionDecl, return it. Otherwise return null.
unsigned getNumArgs() const
getNumArgs - Return the number of actual arguments to this call.
Expr ** getArgs()
Retrieve the call arguments.
CastExpr - Base class for type casts, including both implicit casts (ImplicitCastExpr) and explicit c...
CastKind getCastKind() const
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
A reference to a declared variable, function, enum, etc.
DeclStmt - Adaptor class for mixing declarations with statements and expressions.
Decl - This represents one declaration (or definition), e.g.
ASTContext & getASTContext() const LLVM_READONLY
DeclContext * getDeclContext()
virtual Decl * getCanonicalDecl()
Retrieves the "canonical" declaration of the given declaration.
This represents one expression.
Expr * IgnoreParenCasts() LLVM_READONLY
Skip past any parentheses and casts which might surround this expression until reaching a fixed point...
Expr * IgnoreImplicit() LLVM_READONLY
Skip past any implicit AST nodes which might surround this expression until reaching a fixed point.
Represents a function declaration or definition.
MemberExpr - [C99 6.5.2.3] Structure and Union Members.
ValueDecl * getMemberDecl() const
Retrieve the member declaration to which this expression refers.
This represents a decl that may have a name.
std::string getNameAsString() const
Get a human-readable name for the declaration, even if it is one of the special kinds of names (C++ c...
bool isCXXInstanceMember() const
Determine whether the given declaration is an instance member of a C++ class.
ObjCIvarDecl * getCanonicalDecl() override
Retrieves the canonical declaration of this field.
ObjCIvarRefExpr - A reference to an ObjC instance variable.
const Expr * getBase() const
A (possibly-)qualified type.
Stmt - This represents one statement.
StmtClass getStmtClass() const
Represents a declaration of a type.
RecordDecl * getAsRecordDecl() const
Retrieves the RecordDecl this type refers to.
QualType getPointeeType() const
If this is a pointer, ObjC object pointer, or block pointer, this returns the respective pointee.
bool isPointerOrReferenceType() const
const T * getAs() const
Member-template getAs<specific type>'.
UnaryOperator - This represents the unary-expression's (except sizeof and alignof),...
Expr * getSubExpr() const
Represent the declaration of a variable (in which case it is an lvalue) a function (in which case it ...
Represents a variable declaration or definition.
const til::SExpr * sexpr() const
void push_back(const T &Elem)
bool sameAs(const CopyOnWriteVector &V) const
void downsize(unsigned i)
CapabilityExpr translateAttrExpr(const Expr *AttrExp, const NamedDecl *D, const Expr *DeclExp, til::SExpr *Self=nullptr)
Translate a clang expression in an attribute to a til::SExpr.
til::SExpr * translate(const Stmt *S, CallingContext *Ctx)
til::SExpr * lookupStmt(const Stmt *S)
til::SCFG * buildCFG(CFGWalker &Walker)
til::LiteralPtr * createVariable(const VarDecl *VD)
til::BasicBlock * lookupBlock(const CFGBlock *B)
Apply an argument to a function.
If p is a reference to an array, then p[i] is a reference to the i'th element of the array.
A basic block is part of an SCFG.
unsigned addPredecessor(BasicBlock *Pred)
const InstrArray & arguments() const
void reserveInstructions(unsigned Nins)
void addArgument(Phi *V)
Add a new argument.
size_t numPredecessors() const
Returns the number of predecessors.
InstrArray & instructions()
void reservePredecessors(unsigned NumPreds)
unsigned findPredecessorIndex(const BasicBlock *BB) const
Return the index of BB, or Predecessors.size if BB is not a predecessor.
void setTerminator(Terminator *E)
void addInstruction(SExpr *V)
Add a new instruction.
Simple arithmetic binary operations, e.g.
A conditional branch to two other blocks.
Call a function (after all arguments have been applied).
Jump to another basic block.
An if-then-else expression.
A Literal pointer to an object allocated in memory.
Load a value from memory.
Phi Node, for code in SSA form.
const ValueDecl * clangDecl() const
Return the clang declaration of the variable for this Phi node, if any.
void setClangDecl(const ValueDecl *Cvd)
Set the clang variable associated with this Phi node.
const ValArray & values() const
Project a named slot from a C++ struct or class.
Apply a self-argument to a self-applicable function.
An SCFG is a control-flow graph.
Base class for AST nodes in the typed intermediate language.
BasicBlock * block() const
Returns the block, if this is an instruction in a basic block, otherwise returns null.
void setValues(unsigned Sz, const T &C)
void reserve(size_t Ncp, MemRegionRef A)
Simple arithmetic unary operations, e.g.
Placeholder for expressions that cannot be represented in the TIL.
Placeholder for a wildcard that matches any other expression.
bool isTrivial(const SExpr *E)
void simplifyIncompleteArg(til::Phi *Ph)
TIL_BinaryOpcode
Opcode for binary arithmetic operations.
void printSCFG(CFGWalker &Walker)
std::string getSourceLiteralString(const Expr *CE)
The JSON file list parser is used to communicate input to InstallAPI.
OverloadedOperatorKind
Enumeration specifying the different kinds of C++ overloaded operators.
@ Self
'self' clause, allowed on Compute and Combined Constructs, plus 'update'.
CastKind
CastKind - The kind of operation required for a conversion.
const FunctionProtoType * T
Encapsulates the lexical context of a function call.