clang 24.0.0git
CallUtils.cpp
Go to the documentation of this file.
1//===--- CallUtils.cpp - Shared call emission queries ---------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
10#include "clang/AST/ExprCXX.h"
12
13namespace clang::CodeGenUtils {
14
20
21llvm::FPClassTest getNoFPClassTestMask(const LangOptions &LangOpts) {
22 llvm::FPClassTest Mask = llvm::fcNone;
23 if (LangOpts.NoHonorInfs)
24 Mask |= llvm::fcInf;
25 if (LangOpts.NoHonorNaNs)
26 Mask |= llvm::fcNan;
27 return Mask;
28}
29
31 // Note that we allow this to override the order dictated by the calling
32 // convention on the MS ABI, which means that parameter destruction order is
33 // not necessarily reverse construction order.
34 // FIXME: Revisit this based on C++ committee response to unimplementability.
35 const auto *OCE = dyn_cast<CXXOperatorCallExpr>(E);
36 if (!OCE)
38
39 if (OCE->isAssignmentOp())
41
42 switch (OCE->getOperator()) {
43 case OO_LessLess:
44 case OO_GreaterGreater:
45 case OO_AmpAmp:
46 case OO_PipePipe:
47 case OO_Comma:
48 case OO_ArrowStar:
50 default:
52 }
53}
54
61
62} // namespace clang::CodeGenUtils
Defines the clang::Expr interface and subclasses for C++ expressions.
Defines the TargetCXXABI class, which abstracts details of the C++ ABI that we're targeting.
Represents a static or instance method of a struct/union/class.
Definition DeclCXX.h:2150
CallExpr - Represents a function call (C99 6.5.2.2, C++ [expr.call]).
Definition Expr.h:3012
Represents a canonical, potentially-qualified type.
CanProxy< U > getAs() const
Retrieve a canonical type pointer with a different static type, upcasting or downcasting as needed.
Represents a prototype with parameter type info, e.g.
Definition TypeBase.h:5416
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
The basic abstraction for the target C++ ABI.
bool areArgsDestroyedLeftToRightInCallee() const
Are arguments to a call destroyed left to right in the callee?
CanQualType getCanonicalTypeUnqualified() const
QualType getType() const
Definition Decl.h:725
CanQual< FunctionProtoType > getFormalType(const CXXMethodDecl *MD)
Returns the canonical formal type of the given C++ method.
Definition CallUtils.cpp:15
EvaluationOrder getCallArgEvaluationOrder(const CallExpr *E)
Returns the argument evaluation order the language requires for the given call.
Definition CallUtils.cpp:30
llvm::FPClassTest getNoFPClassTestMask(const LangOptions &LangOpts)
Returns the set of floating-point value kinds that the language options promise never reach a functio...
Definition CallUtils.cpp:21
EvaluationOrder
The order in which the arguments of a call must be evaluated.
Definition CallUtils.h:29
@ ForceLeftToRight
! Language semantics require left-to-right evaluation.
Definition CallUtils.h:33
@ Default
! No language constraints on evaluation order.
Definition CallUtils.h:31
@ ForceRightToLeft
! Language semantics require right-to-left evaluation.
Definition CallUtils.h:35
bool shouldEvaluateArgsLeftToRight(EvaluationOrder Order, const TargetCXXABI &ABI)
Returns true if call arguments should be emitted left-to-right, given the order the language requires...
Definition CallUtils.cpp:55