clang 20.0.0git
|
#include "clang/AST/ExprCXX.h"
#include "clang/AST/GlobalDecl.h"
#include "clang/AST/RecordLayout.h"
#include "clang/AST/TypeLoc.h"
#include "clang/Basic/TargetInfo.h"
#include "clang/Lex/Preprocessor.h"
#include "clang/Sema/Initialization.h"
#include "clang/Sema/Lookup.h"
#include "clang/Sema/Scope.h"
#include "clang/Sema/ScopeInfo.h"
#include "clang/Sema/SemaInternal.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/StringSet.h"
#include "llvm/MC/MCParser/MCAsmParser.h"
#include <optional>
Go to the source code of this file.
Functions | |
static void | removeLValueToRValueCast (Expr *E) |
Remove the upper-level LValueToRValue cast from an expression. | |
static void | emitAndFixInvalidAsmCastLValue (const Expr *LVal, Expr *BadArgument, Sema &S) |
Emit a warning about usage of "noop"-like casts for lvalues (GNU extension) and fix the argument with removing LValueToRValue cast from the expression. | |
static bool | CheckAsmLValue (Expr *E, Sema &S) |
CheckAsmLValue - GNU C has an extremely ugly extension whereby they silently ignore "noop" casts in places where an lvalue is required by an inline asm. | |
static bool | isOperandMentioned (unsigned OpNo, ArrayRef< GCCAsmStmt::AsmStringPiece > AsmStrPieces) |
isOperandMentioned - Return true if the specified operand # is mentioned anywhere in the decomposed asm string. | |
static bool | CheckNakedParmReference (Expr *E, Sema &S) |
static bool | checkExprMemoryConstraintCompat (Sema &S, Expr *E, TargetInfo::ConstraintInfo &Info, bool is_input_expr) |
Returns true if given expression is not compatible with inline assembly's memory constraint; false otherwise. | |
static StringRef | extractRegisterName (const Expr *Expression, const TargetInfo &Target) |
static SourceLocation | getClobberConflictLocation (MultiExprArg Exprs, StringLiteral **Constraints, StringLiteral **Clobbers, int NumClobbers, unsigned NumLabels, const TargetInfo &Target, ASTContext &Cont) |
CheckAsmLValue - GNU C has an extremely ugly extension whereby they silently ignore "noop" casts in places where an lvalue is required by an inline asm.
We emulate this behavior when -fheinous-gnu-extensions is specified, but provide a strong guidance to not use it.
This method checks to see if the argument is an acceptable l-value and returns false if it is a case we can handle.
Definition at line 91 of file SemaStmtAsm.cpp.
References clang::Sema::Context, E, emitAndFixInvalidAsmCastLValue(), clang::Expr::IgnoreParenNoopCasts(), clang::Expr::isLValue(), and clang::Expr::isTypeDependent().
Referenced by clang::Sema::ActOnGCCAsmStmt().
|
static |
Returns true if given expression is not compatible with inline assembly's memory constraint; false otherwise.
Definition at line 163 of file SemaStmtAsm.cpp.
References clang::SemaBase::Diag(), E, clang::Stmt::getBeginLoc(), clang::TargetInfo::ConstraintInfo::getConstraintStr(), clang::Stmt::getSourceRange(), clang::Expr::refersToBitField(), clang::Expr::refersToGlobalRegisterVar(), and clang::Expr::refersToVectorElement().
Referenced by clang::Sema::ActOnGCCAsmStmt().
Definition at line 130 of file SemaStmtAsm.cpp.
References clang::Stmt::children(), clang::Sema::CurContext, clang::SemaBase::Diag(), E, clang::Func, and clang::Stmt::getBeginLoc().
Referenced by clang::Sema::ActOnGCCAsmStmt(), and clang::Sema::LookupInlineAsmIdentifier().
|
static |
Emit a warning about usage of "noop"-like casts for lvalues (GNU extension) and fix the argument with removing LValueToRValue cast from the expression.
Definition at line 72 of file SemaStmtAsm.cpp.
References clang::SemaBase::Diag(), clang::Stmt::getBeginLoc(), clang::Sema::getLangOpts(), clang::Stmt::getSourceRange(), and removeLValueToRValueCast().
Referenced by clang::Sema::ActOnGCCAsmStmt(), and CheckAsmLValue().
|
static |
Definition at line 194 of file SemaStmtAsm.cpp.
References clang::Decl::getAttr(), clang::VarDecl::getStorageClass(), clang::SC_Register, and Variable.
Referenced by getClobberConflictLocation().
|
static |
Definition at line 213 of file SemaStmtAsm.cpp.
References extractRegisterName(), clang::StringLiteral::getBeginLoc(), and clang::StringLiteral::getString().
Referenced by clang::Sema::ActOnGCCAsmStmt().
|
static |
isOperandMentioned - Return true if the specified operand # is mentioned anywhere in the decomposed asm string.
Definition at line 115 of file SemaStmtAsm.cpp.
References clang::GCCAsmStmt::AsmStringPiece::getOperandNo(), and clang::GCCAsmStmt::AsmStringPiece::isOperand().
Referenced by clang::Sema::ActOnGCCAsmStmt().
|
static |
Remove the upper-level LValueToRValue cast from an expression.
Definition at line 33 of file SemaStmtAsm.cpp.
References E, clang::CastExpr::getSubExpr(), clang::Expr::getValueKind(), Parent, clang::CastExpr::setSubExpr(), and clang::Expr::setValueKind().
Referenced by emitAndFixInvalidAsmCastLValue().