forked from OSchip/llvm-project
Revert "[FPEnv] Allow CompoundStmt to keep FP options"
On some buildbots test `ast-print-fp-pragmas.c` fails, need to investigate it. This reverts commit0401fd12d4
. This reverts commitb822efc740
.
This commit is contained in:
parent
0dd4fb0408
commit
dc34d8df4c
|
@ -160,7 +160,6 @@ class JSONNodeDumper
|
||||||
std::string createPointerRepresentation(const void *Ptr);
|
std::string createPointerRepresentation(const void *Ptr);
|
||||||
llvm::json::Object createQualType(QualType QT, bool Desugar = true);
|
llvm::json::Object createQualType(QualType QT, bool Desugar = true);
|
||||||
llvm::json::Object createBareDeclRef(const Decl *D);
|
llvm::json::Object createBareDeclRef(const Decl *D);
|
||||||
llvm::json::Object createFPOptions(FPOptionsOverride FPO);
|
|
||||||
void writeBareDeclRef(const Decl *D);
|
void writeBareDeclRef(const Decl *D);
|
||||||
llvm::json::Object createCXXRecordDefinitionData(const CXXRecordDecl *RD);
|
llvm::json::Object createCXXRecordDefinitionData(const CXXRecordDecl *RD);
|
||||||
llvm::json::Object createCXXBaseSpecifier(const CXXBaseSpecifier &BS);
|
llvm::json::Object createCXXBaseSpecifier(const CXXBaseSpecifier &BS);
|
||||||
|
@ -318,7 +317,6 @@ public:
|
||||||
void VisitGotoStmt(const GotoStmt *GS);
|
void VisitGotoStmt(const GotoStmt *GS);
|
||||||
void VisitWhileStmt(const WhileStmt *WS);
|
void VisitWhileStmt(const WhileStmt *WS);
|
||||||
void VisitObjCAtCatchStmt(const ObjCAtCatchStmt *OACS);
|
void VisitObjCAtCatchStmt(const ObjCAtCatchStmt *OACS);
|
||||||
void VisitCompoundStmt(const CompoundStmt *IS);
|
|
||||||
|
|
||||||
void VisitNullTemplateArgument(const TemplateArgument &TA);
|
void VisitNullTemplateArgument(const TemplateArgument &TA);
|
||||||
void VisitTypeTemplateArgument(const TemplateArgument &TA);
|
void VisitTypeTemplateArgument(const TemplateArgument &TA);
|
||||||
|
|
|
@ -19,7 +19,6 @@
|
||||||
#include "clang/Basic/CapturedStmt.h"
|
#include "clang/Basic/CapturedStmt.h"
|
||||||
#include "clang/Basic/IdentifierTable.h"
|
#include "clang/Basic/IdentifierTable.h"
|
||||||
#include "clang/Basic/LLVM.h"
|
#include "clang/Basic/LLVM.h"
|
||||||
#include "clang/Basic/LangOptions.h"
|
|
||||||
#include "clang/Basic/SourceLocation.h"
|
#include "clang/Basic/SourceLocation.h"
|
||||||
#include "clang/Basic/Specifiers.h"
|
#include "clang/Basic/Specifiers.h"
|
||||||
#include "llvm/ADT/ArrayRef.h"
|
#include "llvm/ADT/ArrayRef.h"
|
||||||
|
@ -129,10 +128,6 @@ protected:
|
||||||
|
|
||||||
unsigned : NumStmtBits;
|
unsigned : NumStmtBits;
|
||||||
|
|
||||||
/// True if the compound statement has one or more pragmas that set some
|
|
||||||
/// floating-point features.
|
|
||||||
unsigned HasFPFeatures : 1;
|
|
||||||
|
|
||||||
unsigned NumStmts;
|
unsigned NumStmts;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1403,9 +1398,8 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
/// CompoundStmt - This represents a group of statements like { stmt stmt }.
|
/// CompoundStmt - This represents a group of statements like { stmt stmt }.
|
||||||
class CompoundStmt final
|
class CompoundStmt final : public Stmt,
|
||||||
: public Stmt,
|
private llvm::TrailingObjects<CompoundStmt, Stmt *> {
|
||||||
private llvm::TrailingObjects<CompoundStmt, Stmt *, FPOptionsOverride> {
|
|
||||||
friend class ASTStmtReader;
|
friend class ASTStmtReader;
|
||||||
friend TrailingObjects;
|
friend TrailingObjects;
|
||||||
|
|
||||||
|
@ -1415,49 +1409,27 @@ class CompoundStmt final
|
||||||
/// The location of the closing "}".
|
/// The location of the closing "}".
|
||||||
SourceLocation RBraceLoc;
|
SourceLocation RBraceLoc;
|
||||||
|
|
||||||
CompoundStmt(ArrayRef<Stmt *> Stmts, FPOptionsOverride FPFeatures,
|
CompoundStmt(ArrayRef<Stmt *> Stmts, SourceLocation LB, SourceLocation RB);
|
||||||
SourceLocation LB, SourceLocation RB);
|
|
||||||
explicit CompoundStmt(EmptyShell Empty) : Stmt(CompoundStmtClass, Empty) {}
|
explicit CompoundStmt(EmptyShell Empty) : Stmt(CompoundStmtClass, Empty) {}
|
||||||
|
|
||||||
void setStmts(ArrayRef<Stmt *> Stmts);
|
void setStmts(ArrayRef<Stmt *> Stmts);
|
||||||
|
|
||||||
/// Set FPOptionsOverride in trailing storage. Used only by Serialization.
|
|
||||||
void setStoredFPFeatures(FPOptionsOverride F) {
|
|
||||||
assert(hasStoredFPFeatures());
|
|
||||||
*getTrailingObjects<FPOptionsOverride>() = F;
|
|
||||||
}
|
|
||||||
|
|
||||||
size_t numTrailingObjects(OverloadToken<Stmt *>) const {
|
|
||||||
return CompoundStmtBits.NumStmts;
|
|
||||||
}
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static CompoundStmt *Create(const ASTContext &C, ArrayRef<Stmt *> Stmts,
|
static CompoundStmt *Create(const ASTContext &C, ArrayRef<Stmt *> Stmts,
|
||||||
FPOptionsOverride FPFeatures, SourceLocation LB,
|
SourceLocation LB, SourceLocation RB);
|
||||||
SourceLocation RB);
|
|
||||||
|
|
||||||
// Build an empty compound statement with a location.
|
// Build an empty compound statement with a location.
|
||||||
explicit CompoundStmt(SourceLocation Loc)
|
explicit CompoundStmt(SourceLocation Loc)
|
||||||
: Stmt(CompoundStmtClass), LBraceLoc(Loc), RBraceLoc(Loc) {
|
: Stmt(CompoundStmtClass), LBraceLoc(Loc), RBraceLoc(Loc) {
|
||||||
CompoundStmtBits.NumStmts = 0;
|
CompoundStmtBits.NumStmts = 0;
|
||||||
CompoundStmtBits.HasFPFeatures = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Build an empty compound statement.
|
// Build an empty compound statement.
|
||||||
static CompoundStmt *CreateEmpty(const ASTContext &C, unsigned NumStmts,
|
static CompoundStmt *CreateEmpty(const ASTContext &C, unsigned NumStmts);
|
||||||
bool HasFPFeatures);
|
|
||||||
|
|
||||||
bool body_empty() const { return CompoundStmtBits.NumStmts == 0; }
|
bool body_empty() const { return CompoundStmtBits.NumStmts == 0; }
|
||||||
unsigned size() const { return CompoundStmtBits.NumStmts; }
|
unsigned size() const { return CompoundStmtBits.NumStmts; }
|
||||||
|
|
||||||
bool hasStoredFPFeatures() const { return CompoundStmtBits.HasFPFeatures; }
|
|
||||||
|
|
||||||
/// Get FPOptionsOverride from trailing storage.
|
|
||||||
FPOptionsOverride getStoredFPFeatures() const {
|
|
||||||
assert(hasStoredFPFeatures());
|
|
||||||
return *getTrailingObjects<FPOptionsOverride>();
|
|
||||||
}
|
|
||||||
|
|
||||||
using body_iterator = Stmt **;
|
using body_iterator = Stmt **;
|
||||||
using body_range = llvm::iterator_range<body_iterator>;
|
using body_range = llvm::iterator_range<body_iterator>;
|
||||||
|
|
||||||
|
|
|
@ -246,7 +246,6 @@ public:
|
||||||
void VisitLabelStmt(const LabelStmt *Node);
|
void VisitLabelStmt(const LabelStmt *Node);
|
||||||
void VisitGotoStmt(const GotoStmt *Node);
|
void VisitGotoStmt(const GotoStmt *Node);
|
||||||
void VisitCaseStmt(const CaseStmt *Node);
|
void VisitCaseStmt(const CaseStmt *Node);
|
||||||
void VisitCompoundStmt(const CompoundStmt *Node);
|
|
||||||
void VisitConstantExpr(const ConstantExpr *Node);
|
void VisitConstantExpr(const ConstantExpr *Node);
|
||||||
void VisitCallExpr(const CallExpr *Node);
|
void VisitCallExpr(const CallExpr *Node);
|
||||||
void VisitCXXOperatorCallExpr(const CXXOperatorCallExpr *Node);
|
void VisitCXXOperatorCallExpr(const CXXOperatorCallExpr *Node);
|
||||||
|
|
|
@ -653,8 +653,6 @@ public:
|
||||||
private:
|
private:
|
||||||
storage_type Value;
|
storage_type Value;
|
||||||
|
|
||||||
FPOptionsOverride getChangesSlow(const FPOptions &Base) const;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
FPOptions() : Value(0) {
|
FPOptions() : Value(0) {
|
||||||
setFPContractMode(LangOptions::FPM_Off);
|
setFPContractMode(LangOptions::FPM_Off);
|
||||||
|
@ -745,9 +743,6 @@ public:
|
||||||
return Opts;
|
return Opts;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Return difference with the given option set.
|
|
||||||
FPOptionsOverride getChangesFrom(const FPOptions &Base) const;
|
|
||||||
|
|
||||||
// We can define most of the accessors automatically:
|
// We can define most of the accessors automatically:
|
||||||
#define OPTION(NAME, TYPE, WIDTH, PREVIOUS) \
|
#define OPTION(NAME, TYPE, WIDTH, PREVIOUS) \
|
||||||
TYPE get##NAME() const { \
|
TYPE get##NAME() const { \
|
||||||
|
@ -796,8 +791,6 @@ public:
|
||||||
: Options(LO), OverrideMask(OverrideMaskBits) {}
|
: Options(LO), OverrideMask(OverrideMaskBits) {}
|
||||||
FPOptionsOverride(FPOptions FPO)
|
FPOptionsOverride(FPOptions FPO)
|
||||||
: Options(FPO), OverrideMask(OverrideMaskBits) {}
|
: Options(FPO), OverrideMask(OverrideMaskBits) {}
|
||||||
FPOptionsOverride(FPOptions FPO, FPOptions::storage_type Mask)
|
|
||||||
: Options(FPO), OverrideMask(Mask) {}
|
|
||||||
|
|
||||||
bool requiresTrailingStorage() const { return OverrideMask != 0; }
|
bool requiresTrailingStorage() const { return OverrideMask != 0; }
|
||||||
|
|
||||||
|
@ -878,12 +871,6 @@ public:
|
||||||
LLVM_DUMP_METHOD void dump();
|
LLVM_DUMP_METHOD void dump();
|
||||||
};
|
};
|
||||||
|
|
||||||
inline FPOptionsOverride FPOptions::getChangesFrom(const FPOptions &Base) const {
|
|
||||||
if (Value == Base.Value)
|
|
||||||
return FPOptionsOverride();
|
|
||||||
return getChangesSlow(Base);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Describes the kind of translation unit being processed.
|
/// Describes the kind of translation unit being processed.
|
||||||
enum TranslationUnitKind {
|
enum TranslationUnitKind {
|
||||||
/// The translation unit is a complete translation unit.
|
/// The translation unit is a complete translation unit.
|
||||||
|
|
|
@ -74,12 +74,7 @@ public:
|
||||||
/// expression.
|
/// expression.
|
||||||
bool IsStmtExpr;
|
bool IsStmtExpr;
|
||||||
|
|
||||||
/// FP options at the beginning of the compound statement, prior to
|
CompoundScopeInfo(bool IsStmtExpr) : IsStmtExpr(IsStmtExpr) {}
|
||||||
/// any pragma.
|
|
||||||
FPOptions InitialFPFeatures;
|
|
||||||
|
|
||||||
CompoundScopeInfo(bool IsStmtExpr, FPOptions FPO)
|
|
||||||
: IsStmtExpr(IsStmtExpr), InitialFPFeatures(FPO) {}
|
|
||||||
|
|
||||||
void setHasEmptyLoopBodies() {
|
void setHasEmptyLoopBodies() {
|
||||||
HasEmptyLoopBodies = true;
|
HasEmptyLoopBodies = true;
|
||||||
|
|
|
@ -6339,10 +6339,9 @@ ExpectedStmt ASTNodeImporter::VisitCompoundStmt(CompoundStmt *S) {
|
||||||
if (!ToRBracLocOrErr)
|
if (!ToRBracLocOrErr)
|
||||||
return ToRBracLocOrErr.takeError();
|
return ToRBracLocOrErr.takeError();
|
||||||
|
|
||||||
FPOptionsOverride FPO =
|
return CompoundStmt::Create(
|
||||||
S->hasStoredFPFeatures() ? S->getStoredFPFeatures() : FPOptionsOverride();
|
Importer.getToContext(), ToStmts,
|
||||||
return CompoundStmt::Create(Importer.getToContext(), ToStmts, FPO,
|
*ToLBracLocOrErr, *ToRBracLocOrErr);
|
||||||
*ToLBracLocOrErr, *ToRBracLocOrErr);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ExpectedStmt ASTNodeImporter::VisitCaseStmt(CaseStmt *S) {
|
ExpectedStmt ASTNodeImporter::VisitCaseStmt(CaseStmt *S) {
|
||||||
|
|
|
@ -1692,18 +1692,3 @@ void JSONNodeDumper::visitVerbatimLineComment(
|
||||||
const comments::VerbatimLineComment *C, const comments::FullComment *) {
|
const comments::VerbatimLineComment *C, const comments::FullComment *) {
|
||||||
JOS.attribute("text", C->getText());
|
JOS.attribute("text", C->getText());
|
||||||
}
|
}
|
||||||
|
|
||||||
llvm::json::Object JSONNodeDumper::createFPOptions(FPOptionsOverride FPO) {
|
|
||||||
llvm::json::Object Ret;
|
|
||||||
#define OPTION(NAME, TYPE, WIDTH, PREVIOUS) \
|
|
||||||
if (FPO.has##NAME##Override()) \
|
|
||||||
Ret.try_emplace(#NAME, static_cast<unsigned>(FPO.get##NAME##Override()));
|
|
||||||
#include "clang/Basic/FPOptions.def"
|
|
||||||
return Ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
void JSONNodeDumper::VisitCompoundStmt(const CompoundStmt *S) {
|
|
||||||
VisitStmt(S);
|
|
||||||
if (S->hasStoredFPFeatures())
|
|
||||||
JOS.attribute("fpoptions", createFPOptions(S->getStoredFPFeatures()));
|
|
||||||
}
|
|
||||||
|
|
|
@ -361,14 +361,11 @@ int64_t Stmt::getID(const ASTContext &Context) const {
|
||||||
return Context.getAllocator().identifyKnownAlignedObject<Stmt>(this);
|
return Context.getAllocator().identifyKnownAlignedObject<Stmt>(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
CompoundStmt::CompoundStmt(ArrayRef<Stmt *> Stmts, FPOptionsOverride FPFeatures,
|
CompoundStmt::CompoundStmt(ArrayRef<Stmt *> Stmts, SourceLocation LB,
|
||||||
SourceLocation LB, SourceLocation RB)
|
SourceLocation RB)
|
||||||
: Stmt(CompoundStmtClass), LBraceLoc(LB), RBraceLoc(RB) {
|
: Stmt(CompoundStmtClass), LBraceLoc(LB), RBraceLoc(RB) {
|
||||||
CompoundStmtBits.NumStmts = Stmts.size();
|
CompoundStmtBits.NumStmts = Stmts.size();
|
||||||
CompoundStmtBits.HasFPFeatures = FPFeatures.requiresTrailingStorage();
|
|
||||||
setStmts(Stmts);
|
setStmts(Stmts);
|
||||||
if (hasStoredFPFeatures())
|
|
||||||
setStoredFPFeatures(FPFeatures);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CompoundStmt::setStmts(ArrayRef<Stmt *> Stmts) {
|
void CompoundStmt::setStmts(ArrayRef<Stmt *> Stmts) {
|
||||||
|
@ -379,23 +376,18 @@ void CompoundStmt::setStmts(ArrayRef<Stmt *> Stmts) {
|
||||||
}
|
}
|
||||||
|
|
||||||
CompoundStmt *CompoundStmt::Create(const ASTContext &C, ArrayRef<Stmt *> Stmts,
|
CompoundStmt *CompoundStmt::Create(const ASTContext &C, ArrayRef<Stmt *> Stmts,
|
||||||
FPOptionsOverride FPFeatures,
|
|
||||||
SourceLocation LB, SourceLocation RB) {
|
SourceLocation LB, SourceLocation RB) {
|
||||||
void *Mem =
|
void *Mem =
|
||||||
C.Allocate(totalSizeToAlloc<Stmt *, FPOptionsOverride>(
|
C.Allocate(totalSizeToAlloc<Stmt *>(Stmts.size()), alignof(CompoundStmt));
|
||||||
Stmts.size(), FPFeatures.requiresTrailingStorage()),
|
return new (Mem) CompoundStmt(Stmts, LB, RB);
|
||||||
alignof(CompoundStmt));
|
|
||||||
return new (Mem) CompoundStmt(Stmts, FPFeatures, LB, RB);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CompoundStmt *CompoundStmt::CreateEmpty(const ASTContext &C, unsigned NumStmts,
|
CompoundStmt *CompoundStmt::CreateEmpty(const ASTContext &C,
|
||||||
bool HasFPFeatures) {
|
unsigned NumStmts) {
|
||||||
void *Mem = C.Allocate(
|
void *Mem =
|
||||||
totalSizeToAlloc<Stmt *, FPOptionsOverride>(NumStmts, HasFPFeatures),
|
C.Allocate(totalSizeToAlloc<Stmt *>(NumStmts), alignof(CompoundStmt));
|
||||||
alignof(CompoundStmt));
|
|
||||||
CompoundStmt *New = new (Mem) CompoundStmt(EmptyShell());
|
CompoundStmt *New = new (Mem) CompoundStmt(EmptyShell());
|
||||||
New->CompoundStmtBits.NumStmts = NumStmts;
|
New->CompoundStmtBits.NumStmts = NumStmts;
|
||||||
New->CompoundStmtBits.HasFPFeatures = HasFPFeatures;
|
|
||||||
return New;
|
return New;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -128,7 +128,6 @@ namespace {
|
||||||
void PrintRawSEHFinallyStmt(SEHFinallyStmt *S);
|
void PrintRawSEHFinallyStmt(SEHFinallyStmt *S);
|
||||||
void PrintOMPExecutableDirective(OMPExecutableDirective *S,
|
void PrintOMPExecutableDirective(OMPExecutableDirective *S,
|
||||||
bool ForceNoStmt = false);
|
bool ForceNoStmt = false);
|
||||||
void PrintFPPragmas(CompoundStmt *S);
|
|
||||||
|
|
||||||
void PrintExpr(Expr *E) {
|
void PrintExpr(Expr *E) {
|
||||||
if (E)
|
if (E)
|
||||||
|
@ -175,73 +174,12 @@ namespace {
|
||||||
/// with no newline after the }.
|
/// with no newline after the }.
|
||||||
void StmtPrinter::PrintRawCompoundStmt(CompoundStmt *Node) {
|
void StmtPrinter::PrintRawCompoundStmt(CompoundStmt *Node) {
|
||||||
OS << "{" << NL;
|
OS << "{" << NL;
|
||||||
PrintFPPragmas(Node);
|
|
||||||
for (auto *I : Node->body())
|
for (auto *I : Node->body())
|
||||||
PrintStmt(I);
|
PrintStmt(I);
|
||||||
|
|
||||||
Indent() << "}";
|
Indent() << "}";
|
||||||
}
|
}
|
||||||
|
|
||||||
void StmtPrinter::PrintFPPragmas(CompoundStmt *S) {
|
|
||||||
if (!S->hasStoredFPFeatures())
|
|
||||||
return;
|
|
||||||
FPOptionsOverride FPO = S->getStoredFPFeatures();
|
|
||||||
bool FEnvAccess = false;
|
|
||||||
if (FPO.hasAllowFEnvAccessOverride()) {
|
|
||||||
FEnvAccess = FPO.getAllowFEnvAccessOverride();
|
|
||||||
Indent() << "#pragma STDC FENV_ACCESS " << (FEnvAccess ? "ON" : "OFF")
|
|
||||||
<< NL;
|
|
||||||
}
|
|
||||||
if (FPO.hasSpecifiedExceptionModeOverride()) {
|
|
||||||
LangOptions::FPExceptionModeKind EM =
|
|
||||||
FPO.getSpecifiedExceptionModeOverride();
|
|
||||||
if (!FEnvAccess || EM != LangOptions::FPE_Strict) {
|
|
||||||
Indent() << "#pragma clang fp exceptions(";
|
|
||||||
switch (FPO.getSpecifiedExceptionModeOverride()) {
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
case LangOptions::FPE_Ignore:
|
|
||||||
OS << "ignore";
|
|
||||||
break;
|
|
||||||
case LangOptions::FPE_MayTrap:
|
|
||||||
OS << "maytrap";
|
|
||||||
break;
|
|
||||||
case LangOptions::FPE_Strict:
|
|
||||||
OS << "strict";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
OS << ")\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (FPO.hasConstRoundingModeOverride()) {
|
|
||||||
LangOptions::RoundingMode RM = FPO.getConstRoundingModeOverride();
|
|
||||||
Indent() << "#pragma STDC FENV_ROUND ";
|
|
||||||
switch (RM) {
|
|
||||||
case llvm::RoundingMode::TowardZero:
|
|
||||||
OS << "FE_TOWARDZERO";
|
|
||||||
break;
|
|
||||||
case llvm::RoundingMode::NearestTiesToEven:
|
|
||||||
OS << "FE_TONEAREST";
|
|
||||||
break;
|
|
||||||
case llvm::RoundingMode::TowardPositive:
|
|
||||||
OS << "FE_DOWNWARD";
|
|
||||||
break;
|
|
||||||
case llvm::RoundingMode::TowardNegative:
|
|
||||||
OS << "FE_UPWARD";
|
|
||||||
break;
|
|
||||||
case llvm::RoundingMode::NearestTiesToAway:
|
|
||||||
OS << "FE_TONEARESTFROMZERO";
|
|
||||||
break;
|
|
||||||
case llvm::RoundingMode::Dynamic:
|
|
||||||
OS << "FE_DYNAMIC";
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
llvm_unreachable("Invalid rounding mode");
|
|
||||||
}
|
|
||||||
OS << NL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void StmtPrinter::PrintRawDecl(Decl *D) {
|
void StmtPrinter::PrintRawDecl(Decl *D) {
|
||||||
D->print(OS, Policy, IndentLevel);
|
D->print(OS, Policy, IndentLevel);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2371,9 +2371,3 @@ void TextNodeDumper::VisitBlockDecl(const BlockDecl *D) {
|
||||||
void TextNodeDumper::VisitConceptDecl(const ConceptDecl *D) {
|
void TextNodeDumper::VisitConceptDecl(const ConceptDecl *D) {
|
||||||
dumpName(D);
|
dumpName(D);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TextNodeDumper::VisitCompoundStmt(const CompoundStmt *S) {
|
|
||||||
VisitStmt(S);
|
|
||||||
if (S->hasStoredFPFeatures())
|
|
||||||
printFPOptions(S->getStoredFPFeatures());
|
|
||||||
}
|
|
||||||
|
|
|
@ -134,8 +134,7 @@ BinaryOperator *ASTMaker::makeComparison(const Expr *LHS, const Expr *RHS,
|
||||||
}
|
}
|
||||||
|
|
||||||
CompoundStmt *ASTMaker::makeCompound(ArrayRef<Stmt *> Stmts) {
|
CompoundStmt *ASTMaker::makeCompound(ArrayRef<Stmt *> Stmts) {
|
||||||
return CompoundStmt::Create(C, Stmts, FPOptionsOverride(), SourceLocation(),
|
return CompoundStmt::Create(C, Stmts, SourceLocation(), SourceLocation());
|
||||||
SourceLocation());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DeclRefExpr *ASTMaker::makeDeclRefExpr(
|
DeclRefExpr *ASTMaker::makeDeclRefExpr(
|
||||||
|
|
|
@ -204,15 +204,6 @@ FPOptions FPOptions::defaultWithoutTrailingStorage(const LangOptions &LO) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
FPOptionsOverride FPOptions::getChangesSlow(const FPOptions &Base) const {
|
|
||||||
FPOptions::storage_type OverrideMask = 0;
|
|
||||||
#define OPTION(NAME, TYPE, WIDTH, PREVIOUS) \
|
|
||||||
if (get##NAME() != Base.get##NAME()) \
|
|
||||||
OverrideMask |= NAME##Mask;
|
|
||||||
#include "clang/Basic/FPOptions.def"
|
|
||||||
return FPOptionsOverride(*this, OverrideMask);
|
|
||||||
}
|
|
||||||
|
|
||||||
LLVM_DUMP_METHOD void FPOptions::dump() {
|
LLVM_DUMP_METHOD void FPOptions::dump() {
|
||||||
#define OPTION(NAME, TYPE, WIDTH, PREVIOUS) \
|
#define OPTION(NAME, TYPE, WIDTH, PREVIOUS) \
|
||||||
llvm::errs() << "\n " #NAME " " << get##NAME();
|
llvm::errs() << "\n " #NAME " " << get##NAME();
|
||||||
|
|
|
@ -238,8 +238,8 @@ static LValueOrRValue emitSuspendExpression(CodeGenFunction &CGF, CGCoroData &Co
|
||||||
auto Loc = S.getResumeExpr()->getExprLoc();
|
auto Loc = S.getResumeExpr()->getExprLoc();
|
||||||
auto *Catch = new (CGF.getContext())
|
auto *Catch = new (CGF.getContext())
|
||||||
CXXCatchStmt(Loc, /*exDecl=*/nullptr, Coro.ExceptionHandler);
|
CXXCatchStmt(Loc, /*exDecl=*/nullptr, Coro.ExceptionHandler);
|
||||||
auto *TryBody = CompoundStmt::Create(CGF.getContext(), S.getResumeExpr(),
|
auto *TryBody =
|
||||||
FPOptionsOverride(), Loc, Loc);
|
CompoundStmt::Create(CGF.getContext(), S.getResumeExpr(), Loc, Loc);
|
||||||
TryStmt = CXXTryStmt::Create(CGF.getContext(), Loc, TryBody, Catch);
|
TryStmt = CXXTryStmt::Create(CGF.getContext(), Loc, TryBody, Catch);
|
||||||
CGF.EnterCXXTryStmt(*TryStmt);
|
CGF.EnterCXXTryStmt(*TryStmt);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2219,8 +2219,7 @@ operator()(sema::FunctionScopeInfo *Scope) const {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sema::PushCompoundScope(bool IsStmtExpr) {
|
void Sema::PushCompoundScope(bool IsStmtExpr) {
|
||||||
getCurFunction()->CompoundScopes.push_back(
|
getCurFunction()->CompoundScopes.push_back(CompoundScopeInfo(IsStmtExpr));
|
||||||
CompoundScopeInfo(IsStmtExpr, getCurFPFeatures()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sema::PopCompoundScope() {
|
void Sema::PopCompoundScope() {
|
||||||
|
|
|
@ -15353,8 +15353,8 @@ void Sema::DefineImplicitLambdaToFunctionPointerConversion(
|
||||||
VK_LValue, Conv->getLocation());
|
VK_LValue, Conv->getLocation());
|
||||||
assert(FunctionRef && "Can't refer to __invoke function?");
|
assert(FunctionRef && "Can't refer to __invoke function?");
|
||||||
Stmt *Return = BuildReturnStmt(Conv->getLocation(), FunctionRef).get();
|
Stmt *Return = BuildReturnStmt(Conv->getLocation(), FunctionRef).get();
|
||||||
Conv->setBody(CompoundStmt::Create(Context, Return, FPOptionsOverride(),
|
Conv->setBody(CompoundStmt::Create(Context, Return, Conv->getLocation(),
|
||||||
Conv->getLocation(), Conv->getLocation()));
|
Conv->getLocation()));
|
||||||
Conv->markUsed(Context);
|
Conv->markUsed(Context);
|
||||||
Conv->setReferenced();
|
Conv->setReferenced();
|
||||||
|
|
||||||
|
@ -15408,8 +15408,8 @@ void Sema::DefineImplicitLambdaToBlockPointerConversion(
|
||||||
|
|
||||||
// Set the body of the conversion function.
|
// Set the body of the conversion function.
|
||||||
Stmt *ReturnS = Return.get();
|
Stmt *ReturnS = Return.get();
|
||||||
Conv->setBody(CompoundStmt::Create(Context, ReturnS, FPOptionsOverride(),
|
Conv->setBody(CompoundStmt::Create(Context, ReturnS, Conv->getLocation(),
|
||||||
Conv->getLocation(), Conv->getLocation()));
|
Conv->getLocation()));
|
||||||
Conv->markUsed(Context);
|
Conv->markUsed(Context);
|
||||||
|
|
||||||
// We're done; notify the mutation listener, if any.
|
// We're done; notify the mutation listener, if any.
|
||||||
|
|
|
@ -7295,9 +7295,8 @@ Stmt *Sema::MaybeCreateStmtWithCleanups(Stmt *SubStmt) {
|
||||||
// a StmtExpr; currently this is only used for asm statements.
|
// a StmtExpr; currently this is only used for asm statements.
|
||||||
// This is hacky, either create a new CXXStmtWithTemporaries statement or
|
// This is hacky, either create a new CXXStmtWithTemporaries statement or
|
||||||
// a new AsmStmtWithTemporaries.
|
// a new AsmStmtWithTemporaries.
|
||||||
CompoundStmt *CompStmt =
|
CompoundStmt *CompStmt = CompoundStmt::Create(
|
||||||
CompoundStmt::Create(Context, SubStmt, FPOptionsOverride(),
|
Context, SubStmt, SourceLocation(), SourceLocation());
|
||||||
SourceLocation(), SourceLocation());
|
|
||||||
Expr *E = new (Context)
|
Expr *E = new (Context)
|
||||||
StmtExpr(CompStmt, Context.VoidTy, SourceLocation(), SourceLocation(),
|
StmtExpr(CompStmt, Context.VoidTy, SourceLocation(), SourceLocation(),
|
||||||
/*FIXME TemplateDepth=*/0);
|
/*FIXME TemplateDepth=*/0);
|
||||||
|
|
|
@ -14454,8 +14454,8 @@ StmtResult Sema::ActOnOpenMPTileDirective(ArrayRef<OMPClause *> Clauses,
|
||||||
SmallVector<Stmt *, 4> BodyParts;
|
SmallVector<Stmt *, 4> BodyParts;
|
||||||
BodyParts.append(LoopHelper.Updates.begin(), LoopHelper.Updates.end());
|
BodyParts.append(LoopHelper.Updates.begin(), LoopHelper.Updates.end());
|
||||||
BodyParts.push_back(Inner);
|
BodyParts.push_back(Inner);
|
||||||
Inner = CompoundStmt::Create(Context, BodyParts, FPOptionsOverride(),
|
Inner = CompoundStmt::Create(Context, BodyParts, Inner->getBeginLoc(),
|
||||||
Inner->getBeginLoc(), Inner->getEndLoc());
|
Inner->getEndLoc());
|
||||||
Inner = new (Context)
|
Inner = new (Context)
|
||||||
ForStmt(Context, InitStmt.get(), CondExpr.get(), nullptr,
|
ForStmt(Context, InitStmt.get(), CondExpr.get(), nullptr,
|
||||||
IncrStmt.get(), Inner, LoopHelper.Init->getBeginLoc(),
|
IncrStmt.get(), Inner, LoopHelper.Init->getBeginLoc(),
|
||||||
|
@ -14729,9 +14729,8 @@ StmtResult Sema::ActOnOpenMPUnrollDirective(ArrayRef<OMPClause *> Clauses,
|
||||||
SmallVector<Stmt *> InnerBodyStmts;
|
SmallVector<Stmt *> InnerBodyStmts;
|
||||||
InnerBodyStmts.append(LoopHelper.Updates.begin(), LoopHelper.Updates.end());
|
InnerBodyStmts.append(LoopHelper.Updates.begin(), LoopHelper.Updates.end());
|
||||||
InnerBodyStmts.push_back(Body);
|
InnerBodyStmts.push_back(Body);
|
||||||
CompoundStmt *InnerBody =
|
CompoundStmt *InnerBody = CompoundStmt::Create(
|
||||||
CompoundStmt::Create(Context, InnerBodyStmts, FPOptionsOverride(),
|
Context, InnerBodyStmts, Body->getBeginLoc(), Body->getEndLoc());
|
||||||
Body->getBeginLoc(), Body->getEndLoc());
|
|
||||||
ForStmt *InnerFor = new (Context)
|
ForStmt *InnerFor = new (Context)
|
||||||
ForStmt(Context, InnerInit.get(), InnerCond.get(), nullptr,
|
ForStmt(Context, InnerInit.get(), InnerCond.get(), nullptr,
|
||||||
InnerIncr.get(), InnerBody, LoopHelper.Init->getBeginLoc(),
|
InnerIncr.get(), InnerBody, LoopHelper.Init->getBeginLoc(),
|
||||||
|
|
|
@ -442,16 +442,7 @@ StmtResult Sema::ActOnCompoundStmt(SourceLocation L, SourceLocation R,
|
||||||
DiagnoseEmptyLoopBody(Elts[i], Elts[i + 1]);
|
DiagnoseEmptyLoopBody(Elts[i], Elts[i + 1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Calculate difference between FP options in this compound statement and in
|
return CompoundStmt::Create(Context, Elts, L, R);
|
||||||
// the enclosing one. If this is a function body, take the difference against
|
|
||||||
// default options. In this case the difference will indicate options that are
|
|
||||||
// changed upon entry to the statement.
|
|
||||||
FPOptions FPO = (getCurFunction()->CompoundScopes.size() == 1)
|
|
||||||
? FPOptions(getLangOpts())
|
|
||||||
: getCurCompoundScope().InitialFPFeatures;
|
|
||||||
FPOptionsOverride FPDiff = getCurFPFeatures().getChangesFrom(FPO);
|
|
||||||
|
|
||||||
return CompoundStmt::Create(Context, Elts, FPDiff, L, R);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ExprResult
|
ExprResult
|
||||||
|
|
|
@ -152,14 +152,9 @@ void ASTStmtReader::VisitCompoundStmt(CompoundStmt *S) {
|
||||||
VisitStmt(S);
|
VisitStmt(S);
|
||||||
SmallVector<Stmt *, 16> Stmts;
|
SmallVector<Stmt *, 16> Stmts;
|
||||||
unsigned NumStmts = Record.readInt();
|
unsigned NumStmts = Record.readInt();
|
||||||
unsigned HasFPFeatures = Record.readInt();
|
|
||||||
assert(S->hasStoredFPFeatures() == HasFPFeatures);
|
|
||||||
while (NumStmts--)
|
while (NumStmts--)
|
||||||
Stmts.push_back(Record.readSubStmt());
|
Stmts.push_back(Record.readSubStmt());
|
||||||
S->setStmts(Stmts);
|
S->setStmts(Stmts);
|
||||||
if (HasFPFeatures)
|
|
||||||
S->setStoredFPFeatures(
|
|
||||||
FPOptionsOverride::getFromOpaqueInt(Record.readInt()));
|
|
||||||
S->LBraceLoc = readSourceLocation();
|
S->LBraceLoc = readSourceLocation();
|
||||||
S->RBraceLoc = readSourceLocation();
|
S->RBraceLoc = readSourceLocation();
|
||||||
}
|
}
|
||||||
|
@ -2768,8 +2763,7 @@ Stmt *ASTReader::ReadStmtFromStream(ModuleFile &F) {
|
||||||
|
|
||||||
case STMT_COMPOUND:
|
case STMT_COMPOUND:
|
||||||
S = CompoundStmt::CreateEmpty(
|
S = CompoundStmt::CreateEmpty(
|
||||||
Context, /*NumStmts=*/Record[ASTStmtReader::NumStmtFields],
|
Context, /*NumStmts=*/Record[ASTStmtReader::NumStmtFields]);
|
||||||
/*HasFPFeatures=*/Record[ASTStmtReader::NumStmtFields + 1]);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case STMT_CASE:
|
case STMT_CASE:
|
||||||
|
|
|
@ -81,11 +81,8 @@ void ASTStmtWriter::VisitNullStmt(NullStmt *S) {
|
||||||
void ASTStmtWriter::VisitCompoundStmt(CompoundStmt *S) {
|
void ASTStmtWriter::VisitCompoundStmt(CompoundStmt *S) {
|
||||||
VisitStmt(S);
|
VisitStmt(S);
|
||||||
Record.push_back(S->size());
|
Record.push_back(S->size());
|
||||||
Record.push_back(S->hasStoredFPFeatures());
|
|
||||||
for (auto *CS : S->body())
|
for (auto *CS : S->body())
|
||||||
Record.AddStmt(CS);
|
Record.AddStmt(CS);
|
||||||
if (S->hasStoredFPFeatures())
|
|
||||||
Record.push_back(S->getStoredFPFeatures().getAsOpaqueInt());
|
|
||||||
Record.AddSourceLocation(S->getLBracLoc());
|
Record.AddSourceLocation(S->getLBracLoc());
|
||||||
Record.AddSourceLocation(S->getRBracLoc());
|
Record.AddSourceLocation(S->getRBracLoc());
|
||||||
Code = serialization::STMT_COMPOUND;
|
Code = serialization::STMT_COMPOUND;
|
||||||
|
|
|
@ -141,49 +141,3 @@ float func_15(float x, float y) {
|
||||||
// CHECK: CompoundStmt
|
// CHECK: CompoundStmt
|
||||||
// CHECK-NEXT: ReturnStmt
|
// CHECK-NEXT: ReturnStmt
|
||||||
// CHECK-NEXT: BinaryOperator {{.*}} 'float' '+' ConstRoundingMode=towardzero
|
// CHECK-NEXT: BinaryOperator {{.*}} 'float' '+' ConstRoundingMode=towardzero
|
||||||
|
|
||||||
float func_16(float x, float y) {
|
|
||||||
#pragma STDC FENV_ROUND FE_TOWARDZERO
|
|
||||||
if (x < 0) {
|
|
||||||
#pragma STDC FENV_ROUND FE_UPWARD
|
|
||||||
return x - y;
|
|
||||||
}
|
|
||||||
return x + y;
|
|
||||||
}
|
|
||||||
|
|
||||||
// CHECK-LABEL: FunctionDecl {{.*}} func_16 'float (float, float)'
|
|
||||||
// CHECK: CompoundStmt {{.*}} ConstRoundingMode=towardzero
|
|
||||||
// CHECK: IfStmt
|
|
||||||
// CHECK: CompoundStmt {{.*}} ConstRoundingMode=upward
|
|
||||||
// CHECK: ReturnStmt
|
|
||||||
// CHECK: BinaryOperator {{.*}} ConstRoundingMode=upward
|
|
||||||
// CHECK: ReturnStmt
|
|
||||||
// CHECK: BinaryOperator {{.*}} ConstRoundingMode=towardzero
|
|
||||||
|
|
||||||
float func_17(float x, float y) {
|
|
||||||
#pragma STDC FENV_ROUND FE_TOWARDZERO
|
|
||||||
if (x < 0) {
|
|
||||||
#pragma STDC FENV_ROUND FE_TOWARDZERO
|
|
||||||
return x - y;
|
|
||||||
}
|
|
||||||
return x + y;
|
|
||||||
}
|
|
||||||
|
|
||||||
// CHECK-LABEL: FunctionDecl {{.*}} func_17 'float (float, float)'
|
|
||||||
// CHECK: CompoundStmt {{.*}} ConstRoundingMode=towardzero
|
|
||||||
// CHECK: IfStmt
|
|
||||||
// CHECK: CompoundStmt {{.*}}
|
|
||||||
// CHECK: ReturnStmt
|
|
||||||
// CHECK: BinaryOperator {{.*}} ConstRoundingMode=towardzero
|
|
||||||
// CHECK: ReturnStmt
|
|
||||||
// CHECK: BinaryOperator {{.*}} ConstRoundingMode=towardzero
|
|
||||||
|
|
||||||
#pragma STDC FENV_ROUND FE_DOWNWARD
|
|
||||||
float func_18(float x, float y) {
|
|
||||||
return x + y;
|
|
||||||
}
|
|
||||||
|
|
||||||
// CHECK-LABEL: FunctionDecl {{.*}} func_18 'float (float, float)'
|
|
||||||
// CHECK: CompoundStmt {{.*}} ConstRoundingMode=downward
|
|
||||||
// CHECK: ReturnStmt
|
|
||||||
// CHECK: BinaryOperator {{.*}} ConstRoundingMode=downward
|
|
||||||
|
|
|
@ -1,485 +0,0 @@
|
||||||
// RUN: %clang_cc1 -triple x86_64-unknown-unknown -ast-dump=json %s | FileCheck %s
|
|
||||||
|
|
||||||
float func_16(float x, float y) {
|
|
||||||
#pragma STDC FENV_ROUND FE_TOWARDZERO
|
|
||||||
if (x < 0) {
|
|
||||||
#pragma STDC FENV_ROUND FE_UPWARD
|
|
||||||
return x - y;
|
|
||||||
}
|
|
||||||
return x + y;
|
|
||||||
}
|
|
||||||
|
|
||||||
// NOTE: CHECK lines have been autogenerated by gen_ast_dump_json_test.py
|
|
||||||
// using --filters=CompoundStmt
|
|
||||||
|
|
||||||
|
|
||||||
// CHECK-NOT: {{^}}Dumping
|
|
||||||
// CHECK: "kind": "CompoundStmt",
|
|
||||||
// CHECK-NEXT: "range": {
|
|
||||||
// CHECK-NEXT: "begin": {
|
|
||||||
// CHECK-NEXT: "offset": 116,
|
|
||||||
// CHECK-NEXT: "col": 33,
|
|
||||||
// CHECK-NEXT: "tokLen": 1
|
|
||||||
// CHECK-NEXT: },
|
|
||||||
// CHECK-NEXT: "end": {
|
|
||||||
// CHECK-NEXT: "offset": 249,
|
|
||||||
// CHECK-NEXT: "line": 10,
|
|
||||||
// CHECK-NEXT: "col": 1,
|
|
||||||
// CHECK-NEXT: "tokLen": 1
|
|
||||||
// CHECK-NEXT: }
|
|
||||||
// CHECK-NEXT: },
|
|
||||||
// CHECK-NEXT: "fpoptions": {
|
|
||||||
// CHECK-NEXT: "ConstRoundingMode": 0
|
|
||||||
// CHECK-NEXT: },
|
|
||||||
// CHECK-NEXT: "inner": [
|
|
||||||
// CHECK-NEXT: {
|
|
||||||
// CHECK-NEXT: "id": "0x{{.*}}",
|
|
||||||
// CHECK-NEXT: "kind": "IfStmt",
|
|
||||||
// CHECK-NEXT: "range": {
|
|
||||||
// CHECK-NEXT: "begin": {
|
|
||||||
// CHECK-NEXT: "offset": 160,
|
|
||||||
// CHECK-NEXT: "line": 5,
|
|
||||||
// CHECK-NEXT: "col": 3,
|
|
||||||
// CHECK-NEXT: "tokLen": 2
|
|
||||||
// CHECK-NEXT: },
|
|
||||||
// CHECK-NEXT: "end": {
|
|
||||||
// CHECK-NEXT: "offset": 231,
|
|
||||||
// CHECK-NEXT: "line": 8,
|
|
||||||
// CHECK-NEXT: "col": 3,
|
|
||||||
// CHECK-NEXT: "tokLen": 1
|
|
||||||
// CHECK-NEXT: }
|
|
||||||
// CHECK-NEXT: },
|
|
||||||
// CHECK-NEXT: "inner": [
|
|
||||||
// CHECK-NEXT: {
|
|
||||||
// CHECK-NEXT: "id": "0x{{.*}}",
|
|
||||||
// CHECK-NEXT: "kind": "BinaryOperator",
|
|
||||||
// CHECK-NEXT: "range": {
|
|
||||||
// CHECK-NEXT: "begin": {
|
|
||||||
// CHECK-NEXT: "offset": 164,
|
|
||||||
// CHECK-NEXT: "line": 5,
|
|
||||||
// CHECK-NEXT: "col": 7,
|
|
||||||
// CHECK-NEXT: "tokLen": 1
|
|
||||||
// CHECK-NEXT: },
|
|
||||||
// CHECK-NEXT: "end": {
|
|
||||||
// CHECK-NEXT: "offset": 168,
|
|
||||||
// CHECK-NEXT: "col": 11,
|
|
||||||
// CHECK-NEXT: "tokLen": 1
|
|
||||||
// CHECK-NEXT: }
|
|
||||||
// CHECK-NEXT: },
|
|
||||||
// CHECK-NEXT: "type": {
|
|
||||||
// CHECK-NEXT: "qualType": "int"
|
|
||||||
// CHECK-NEXT: },
|
|
||||||
// CHECK-NEXT: "valueCategory": "prvalue",
|
|
||||||
// CHECK-NEXT: "opcode": "<",
|
|
||||||
// CHECK-NEXT: "inner": [
|
|
||||||
// CHECK-NEXT: {
|
|
||||||
// CHECK-NEXT: "id": "0x{{.*}}",
|
|
||||||
// CHECK-NEXT: "kind": "ImplicitCastExpr",
|
|
||||||
// CHECK-NEXT: "range": {
|
|
||||||
// CHECK-NEXT: "begin": {
|
|
||||||
// CHECK-NEXT: "offset": 164,
|
|
||||||
// CHECK-NEXT: "col": 7,
|
|
||||||
// CHECK-NEXT: "tokLen": 1
|
|
||||||
// CHECK-NEXT: },
|
|
||||||
// CHECK-NEXT: "end": {
|
|
||||||
// CHECK-NEXT: "offset": 164,
|
|
||||||
// CHECK-NEXT: "col": 7,
|
|
||||||
// CHECK-NEXT: "tokLen": 1
|
|
||||||
// CHECK-NEXT: }
|
|
||||||
// CHECK-NEXT: },
|
|
||||||
// CHECK-NEXT: "type": {
|
|
||||||
// CHECK-NEXT: "qualType": "float"
|
|
||||||
// CHECK-NEXT: },
|
|
||||||
// CHECK-NEXT: "valueCategory": "prvalue",
|
|
||||||
// CHECK-NEXT: "castKind": "LValueToRValue",
|
|
||||||
// CHECK-NEXT: "inner": [
|
|
||||||
// CHECK-NEXT: {
|
|
||||||
// CHECK-NEXT: "id": "0x{{.*}}",
|
|
||||||
// CHECK-NEXT: "kind": "DeclRefExpr",
|
|
||||||
// CHECK-NEXT: "range": {
|
|
||||||
// CHECK-NEXT: "begin": {
|
|
||||||
// CHECK-NEXT: "offset": 164,
|
|
||||||
// CHECK-NEXT: "col": 7,
|
|
||||||
// CHECK-NEXT: "tokLen": 1
|
|
||||||
// CHECK-NEXT: },
|
|
||||||
// CHECK-NEXT: "end": {
|
|
||||||
// CHECK-NEXT: "offset": 164,
|
|
||||||
// CHECK-NEXT: "col": 7,
|
|
||||||
// CHECK-NEXT: "tokLen": 1
|
|
||||||
// CHECK-NEXT: }
|
|
||||||
// CHECK-NEXT: },
|
|
||||||
// CHECK-NEXT: "type": {
|
|
||||||
// CHECK-NEXT: "qualType": "float"
|
|
||||||
// CHECK-NEXT: },
|
|
||||||
// CHECK-NEXT: "valueCategory": "lvalue",
|
|
||||||
// CHECK-NEXT: "referencedDecl": {
|
|
||||||
// CHECK-NEXT: "id": "0x{{.*}}",
|
|
||||||
// CHECK-NEXT: "kind": "ParmVarDecl",
|
|
||||||
// CHECK-NEXT: "name": "x",
|
|
||||||
// CHECK-NEXT: "type": {
|
|
||||||
// CHECK-NEXT: "qualType": "float"
|
|
||||||
// CHECK-NEXT: }
|
|
||||||
// CHECK-NEXT: }
|
|
||||||
// CHECK-NEXT: }
|
|
||||||
// CHECK-NEXT: ]
|
|
||||||
// CHECK-NEXT: },
|
|
||||||
// CHECK-NEXT: {
|
|
||||||
// CHECK-NEXT: "id": "0x{{.*}}",
|
|
||||||
// CHECK-NEXT: "kind": "ImplicitCastExpr",
|
|
||||||
// CHECK-NEXT: "range": {
|
|
||||||
// CHECK-NEXT: "begin": {
|
|
||||||
// CHECK-NEXT: "offset": 168,
|
|
||||||
// CHECK-NEXT: "col": 11,
|
|
||||||
// CHECK-NEXT: "tokLen": 1
|
|
||||||
// CHECK-NEXT: },
|
|
||||||
// CHECK-NEXT: "end": {
|
|
||||||
// CHECK-NEXT: "offset": 168,
|
|
||||||
// CHECK-NEXT: "col": 11,
|
|
||||||
// CHECK-NEXT: "tokLen": 1
|
|
||||||
// CHECK-NEXT: }
|
|
||||||
// CHECK-NEXT: },
|
|
||||||
// CHECK-NEXT: "type": {
|
|
||||||
// CHECK-NEXT: "qualType": "float"
|
|
||||||
// CHECK-NEXT: },
|
|
||||||
// CHECK-NEXT: "valueCategory": "prvalue",
|
|
||||||
// CHECK-NEXT: "castKind": "IntegralToFloating",
|
|
||||||
// CHECK-NEXT: "inner": [
|
|
||||||
// CHECK-NEXT: {
|
|
||||||
// CHECK-NEXT: "id": "0x{{.*}}",
|
|
||||||
// CHECK-NEXT: "kind": "IntegerLiteral",
|
|
||||||
// CHECK-NEXT: "range": {
|
|
||||||
// CHECK-NEXT: "begin": {
|
|
||||||
// CHECK-NEXT: "offset": 168,
|
|
||||||
// CHECK-NEXT: "col": 11,
|
|
||||||
// CHECK-NEXT: "tokLen": 1
|
|
||||||
// CHECK-NEXT: },
|
|
||||||
// CHECK-NEXT: "end": {
|
|
||||||
// CHECK-NEXT: "offset": 168,
|
|
||||||
// CHECK-NEXT: "col": 11,
|
|
||||||
// CHECK-NEXT: "tokLen": 1
|
|
||||||
// CHECK-NEXT: }
|
|
||||||
// CHECK-NEXT: },
|
|
||||||
// CHECK-NEXT: "type": {
|
|
||||||
// CHECK-NEXT: "qualType": "int"
|
|
||||||
// CHECK-NEXT: },
|
|
||||||
// CHECK-NEXT: "valueCategory": "prvalue",
|
|
||||||
// CHECK-NEXT: "value": "0"
|
|
||||||
// CHECK-NEXT: }
|
|
||||||
// CHECK-NEXT: ]
|
|
||||||
// CHECK-NEXT: }
|
|
||||||
// CHECK-NEXT: ]
|
|
||||||
// CHECK-NEXT: },
|
|
||||||
// CHECK-NEXT: {
|
|
||||||
// CHECK-NEXT: "id": "0x{{.*}}",
|
|
||||||
// CHECK-NEXT: "kind": "CompoundStmt",
|
|
||||||
// CHECK-NEXT: "range": {
|
|
||||||
// CHECK-NEXT: "begin": {
|
|
||||||
// CHECK-NEXT: "offset": 171,
|
|
||||||
// CHECK-NEXT: "col": 14,
|
|
||||||
// CHECK-NEXT: "tokLen": 1
|
|
||||||
// CHECK-NEXT: },
|
|
||||||
// CHECK-NEXT: "end": {
|
|
||||||
// CHECK-NEXT: "offset": 231,
|
|
||||||
// CHECK-NEXT: "line": 8,
|
|
||||||
// CHECK-NEXT: "col": 3,
|
|
||||||
// CHECK-NEXT: "tokLen": 1
|
|
||||||
// CHECK-NEXT: }
|
|
||||||
// CHECK-NEXT: },
|
|
||||||
// CHECK-NEXT: "fpoptions": {
|
|
||||||
// CHECK-NEXT: "ConstRoundingMode": 2
|
|
||||||
// CHECK-NEXT: },
|
|
||||||
// CHECK-NEXT: "inner": [
|
|
||||||
// CHECK-NEXT: {
|
|
||||||
// CHECK-NEXT: "id": "0x{{.*}}",
|
|
||||||
// CHECK-NEXT: "kind": "ReturnStmt",
|
|
||||||
// CHECK-NEXT: "range": {
|
|
||||||
// CHECK-NEXT: "begin": {
|
|
||||||
// CHECK-NEXT: "offset": 215,
|
|
||||||
// CHECK-NEXT: "line": 7,
|
|
||||||
// CHECK-NEXT: "col": 5,
|
|
||||||
// CHECK-NEXT: "tokLen": 6
|
|
||||||
// CHECK-NEXT: },
|
|
||||||
// CHECK-NEXT: "end": {
|
|
||||||
// CHECK-NEXT: "offset": 226,
|
|
||||||
// CHECK-NEXT: "col": 16,
|
|
||||||
// CHECK-NEXT: "tokLen": 1
|
|
||||||
// CHECK-NEXT: }
|
|
||||||
// CHECK-NEXT: },
|
|
||||||
// CHECK-NEXT: "inner": [
|
|
||||||
// CHECK-NEXT: {
|
|
||||||
// CHECK-NEXT: "id": "0x{{.*}}",
|
|
||||||
// CHECK-NEXT: "kind": "BinaryOperator",
|
|
||||||
// CHECK-NEXT: "range": {
|
|
||||||
// CHECK-NEXT: "begin": {
|
|
||||||
// CHECK-NEXT: "offset": 222,
|
|
||||||
// CHECK-NEXT: "col": 12,
|
|
||||||
// CHECK-NEXT: "tokLen": 1
|
|
||||||
// CHECK-NEXT: },
|
|
||||||
// CHECK-NEXT: "end": {
|
|
||||||
// CHECK-NEXT: "offset": 226,
|
|
||||||
// CHECK-NEXT: "col": 16,
|
|
||||||
// CHECK-NEXT: "tokLen": 1
|
|
||||||
// CHECK-NEXT: }
|
|
||||||
// CHECK-NEXT: },
|
|
||||||
// CHECK-NEXT: "type": {
|
|
||||||
// CHECK-NEXT: "qualType": "float"
|
|
||||||
// CHECK-NEXT: },
|
|
||||||
// CHECK-NEXT: "valueCategory": "prvalue",
|
|
||||||
// CHECK-NEXT: "opcode": "-",
|
|
||||||
// CHECK-NEXT: "inner": [
|
|
||||||
// CHECK-NEXT: {
|
|
||||||
// CHECK-NEXT: "id": "0x{{.*}}",
|
|
||||||
// CHECK-NEXT: "kind": "ImplicitCastExpr",
|
|
||||||
// CHECK-NEXT: "range": {
|
|
||||||
// CHECK-NEXT: "begin": {
|
|
||||||
// CHECK-NEXT: "offset": 222,
|
|
||||||
// CHECK-NEXT: "col": 12,
|
|
||||||
// CHECK-NEXT: "tokLen": 1
|
|
||||||
// CHECK-NEXT: },
|
|
||||||
// CHECK-NEXT: "end": {
|
|
||||||
// CHECK-NEXT: "offset": 222,
|
|
||||||
// CHECK-NEXT: "col": 12,
|
|
||||||
// CHECK-NEXT: "tokLen": 1
|
|
||||||
// CHECK-NEXT: }
|
|
||||||
// CHECK-NEXT: },
|
|
||||||
// CHECK-NEXT: "type": {
|
|
||||||
// CHECK-NEXT: "qualType": "float"
|
|
||||||
// CHECK-NEXT: },
|
|
||||||
// CHECK-NEXT: "valueCategory": "prvalue",
|
|
||||||
// CHECK-NEXT: "castKind": "LValueToRValue",
|
|
||||||
// CHECK-NEXT: "inner": [
|
|
||||||
// CHECK-NEXT: {
|
|
||||||
// CHECK-NEXT: "id": "0x{{.*}}",
|
|
||||||
// CHECK-NEXT: "kind": "DeclRefExpr",
|
|
||||||
// CHECK-NEXT: "range": {
|
|
||||||
// CHECK-NEXT: "begin": {
|
|
||||||
// CHECK-NEXT: "offset": 222,
|
|
||||||
// CHECK-NEXT: "col": 12,
|
|
||||||
// CHECK-NEXT: "tokLen": 1
|
|
||||||
// CHECK-NEXT: },
|
|
||||||
// CHECK-NEXT: "end": {
|
|
||||||
// CHECK-NEXT: "offset": 222,
|
|
||||||
// CHECK-NEXT: "col": 12,
|
|
||||||
// CHECK-NEXT: "tokLen": 1
|
|
||||||
// CHECK-NEXT: }
|
|
||||||
// CHECK-NEXT: },
|
|
||||||
// CHECK-NEXT: "type": {
|
|
||||||
// CHECK-NEXT: "qualType": "float"
|
|
||||||
// CHECK-NEXT: },
|
|
||||||
// CHECK-NEXT: "valueCategory": "lvalue",
|
|
||||||
// CHECK-NEXT: "referencedDecl": {
|
|
||||||
// CHECK-NEXT: "id": "0x{{.*}}",
|
|
||||||
// CHECK-NEXT: "kind": "ParmVarDecl",
|
|
||||||
// CHECK-NEXT: "name": "x",
|
|
||||||
// CHECK-NEXT: "type": {
|
|
||||||
// CHECK-NEXT: "qualType": "float"
|
|
||||||
// CHECK-NEXT: }
|
|
||||||
// CHECK-NEXT: }
|
|
||||||
// CHECK-NEXT: }
|
|
||||||
// CHECK-NEXT: ]
|
|
||||||
// CHECK-NEXT: },
|
|
||||||
// CHECK-NEXT: {
|
|
||||||
// CHECK-NEXT: "id": "0x{{.*}}",
|
|
||||||
// CHECK-NEXT: "kind": "ImplicitCastExpr",
|
|
||||||
// CHECK-NEXT: "range": {
|
|
||||||
// CHECK-NEXT: "begin": {
|
|
||||||
// CHECK-NEXT: "offset": 226,
|
|
||||||
// CHECK-NEXT: "col": 16,
|
|
||||||
// CHECK-NEXT: "tokLen": 1
|
|
||||||
// CHECK-NEXT: },
|
|
||||||
// CHECK-NEXT: "end": {
|
|
||||||
// CHECK-NEXT: "offset": 226,
|
|
||||||
// CHECK-NEXT: "col": 16,
|
|
||||||
// CHECK-NEXT: "tokLen": 1
|
|
||||||
// CHECK-NEXT: }
|
|
||||||
// CHECK-NEXT: },
|
|
||||||
// CHECK-NEXT: "type": {
|
|
||||||
// CHECK-NEXT: "qualType": "float"
|
|
||||||
// CHECK-NEXT: },
|
|
||||||
// CHECK-NEXT: "valueCategory": "prvalue",
|
|
||||||
// CHECK-NEXT: "castKind": "LValueToRValue",
|
|
||||||
// CHECK-NEXT: "inner": [
|
|
||||||
// CHECK-NEXT: {
|
|
||||||
// CHECK-NEXT: "id": "0x{{.*}}",
|
|
||||||
// CHECK-NEXT: "kind": "DeclRefExpr",
|
|
||||||
// CHECK-NEXT: "range": {
|
|
||||||
// CHECK-NEXT: "begin": {
|
|
||||||
// CHECK-NEXT: "offset": 226,
|
|
||||||
// CHECK-NEXT: "col": 16,
|
|
||||||
// CHECK-NEXT: "tokLen": 1
|
|
||||||
// CHECK-NEXT: },
|
|
||||||
// CHECK-NEXT: "end": {
|
|
||||||
// CHECK-NEXT: "offset": 226,
|
|
||||||
// CHECK-NEXT: "col": 16,
|
|
||||||
// CHECK-NEXT: "tokLen": 1
|
|
||||||
// CHECK-NEXT: }
|
|
||||||
// CHECK-NEXT: },
|
|
||||||
// CHECK-NEXT: "type": {
|
|
||||||
// CHECK-NEXT: "qualType": "float"
|
|
||||||
// CHECK-NEXT: },
|
|
||||||
// CHECK-NEXT: "valueCategory": "lvalue",
|
|
||||||
// CHECK-NEXT: "referencedDecl": {
|
|
||||||
// CHECK-NEXT: "id": "0x{{.*}}",
|
|
||||||
// CHECK-NEXT: "kind": "ParmVarDecl",
|
|
||||||
// CHECK-NEXT: "name": "y",
|
|
||||||
// CHECK-NEXT: "type": {
|
|
||||||
// CHECK-NEXT: "qualType": "float"
|
|
||||||
// CHECK-NEXT: }
|
|
||||||
// CHECK-NEXT: }
|
|
||||||
// CHECK-NEXT: }
|
|
||||||
// CHECK-NEXT: ]
|
|
||||||
// CHECK-NEXT: }
|
|
||||||
// CHECK-NEXT: ]
|
|
||||||
// CHECK-NEXT: }
|
|
||||||
// CHECK-NEXT: ]
|
|
||||||
// CHECK-NEXT: }
|
|
||||||
// CHECK-NEXT: ]
|
|
||||||
// CHECK-NEXT: }
|
|
||||||
// CHECK-NEXT: ]
|
|
||||||
// CHECK-NEXT: },
|
|
||||||
// CHECK-NEXT: {
|
|
||||||
// CHECK-NEXT: "id": "0x{{.*}}",
|
|
||||||
// CHECK-NEXT: "kind": "ReturnStmt",
|
|
||||||
// CHECK-NEXT: "range": {
|
|
||||||
// CHECK-NEXT: "begin": {
|
|
||||||
// CHECK-NEXT: "offset": 235,
|
|
||||||
// CHECK-NEXT: "line": 9,
|
|
||||||
// CHECK-NEXT: "col": 3,
|
|
||||||
// CHECK-NEXT: "tokLen": 6
|
|
||||||
// CHECK-NEXT: },
|
|
||||||
// CHECK-NEXT: "end": {
|
|
||||||
// CHECK-NEXT: "offset": 246,
|
|
||||||
// CHECK-NEXT: "col": 14,
|
|
||||||
// CHECK-NEXT: "tokLen": 1
|
|
||||||
// CHECK-NEXT: }
|
|
||||||
// CHECK-NEXT: },
|
|
||||||
// CHECK-NEXT: "inner": [
|
|
||||||
// CHECK-NEXT: {
|
|
||||||
// CHECK-NEXT: "id": "0x{{.*}}",
|
|
||||||
// CHECK-NEXT: "kind": "BinaryOperator",
|
|
||||||
// CHECK-NEXT: "range": {
|
|
||||||
// CHECK-NEXT: "begin": {
|
|
||||||
// CHECK-NEXT: "offset": 242,
|
|
||||||
// CHECK-NEXT: "col": 10,
|
|
||||||
// CHECK-NEXT: "tokLen": 1
|
|
||||||
// CHECK-NEXT: },
|
|
||||||
// CHECK-NEXT: "end": {
|
|
||||||
// CHECK-NEXT: "offset": 246,
|
|
||||||
// CHECK-NEXT: "col": 14,
|
|
||||||
// CHECK-NEXT: "tokLen": 1
|
|
||||||
// CHECK-NEXT: }
|
|
||||||
// CHECK-NEXT: },
|
|
||||||
// CHECK-NEXT: "type": {
|
|
||||||
// CHECK-NEXT: "qualType": "float"
|
|
||||||
// CHECK-NEXT: },
|
|
||||||
// CHECK-NEXT: "valueCategory": "prvalue",
|
|
||||||
// CHECK-NEXT: "opcode": "+",
|
|
||||||
// CHECK-NEXT: "inner": [
|
|
||||||
// CHECK-NEXT: {
|
|
||||||
// CHECK-NEXT: "id": "0x{{.*}}",
|
|
||||||
// CHECK-NEXT: "kind": "ImplicitCastExpr",
|
|
||||||
// CHECK-NEXT: "range": {
|
|
||||||
// CHECK-NEXT: "begin": {
|
|
||||||
// CHECK-NEXT: "offset": 242,
|
|
||||||
// CHECK-NEXT: "col": 10,
|
|
||||||
// CHECK-NEXT: "tokLen": 1
|
|
||||||
// CHECK-NEXT: },
|
|
||||||
// CHECK-NEXT: "end": {
|
|
||||||
// CHECK-NEXT: "offset": 242,
|
|
||||||
// CHECK-NEXT: "col": 10,
|
|
||||||
// CHECK-NEXT: "tokLen": 1
|
|
||||||
// CHECK-NEXT: }
|
|
||||||
// CHECK-NEXT: },
|
|
||||||
// CHECK-NEXT: "type": {
|
|
||||||
// CHECK-NEXT: "qualType": "float"
|
|
||||||
// CHECK-NEXT: },
|
|
||||||
// CHECK-NEXT: "valueCategory": "prvalue",
|
|
||||||
// CHECK-NEXT: "castKind": "LValueToRValue",
|
|
||||||
// CHECK-NEXT: "inner": [
|
|
||||||
// CHECK-NEXT: {
|
|
||||||
// CHECK-NEXT: "id": "0x{{.*}}",
|
|
||||||
// CHECK-NEXT: "kind": "DeclRefExpr",
|
|
||||||
// CHECK-NEXT: "range": {
|
|
||||||
// CHECK-NEXT: "begin": {
|
|
||||||
// CHECK-NEXT: "offset": 242,
|
|
||||||
// CHECK-NEXT: "col": 10,
|
|
||||||
// CHECK-NEXT: "tokLen": 1
|
|
||||||
// CHECK-NEXT: },
|
|
||||||
// CHECK-NEXT: "end": {
|
|
||||||
// CHECK-NEXT: "offset": 242,
|
|
||||||
// CHECK-NEXT: "col": 10,
|
|
||||||
// CHECK-NEXT: "tokLen": 1
|
|
||||||
// CHECK-NEXT: }
|
|
||||||
// CHECK-NEXT: },
|
|
||||||
// CHECK-NEXT: "type": {
|
|
||||||
// CHECK-NEXT: "qualType": "float"
|
|
||||||
// CHECK-NEXT: },
|
|
||||||
// CHECK-NEXT: "valueCategory": "lvalue",
|
|
||||||
// CHECK-NEXT: "referencedDecl": {
|
|
||||||
// CHECK-NEXT: "id": "0x{{.*}}",
|
|
||||||
// CHECK-NEXT: "kind": "ParmVarDecl",
|
|
||||||
// CHECK-NEXT: "name": "x",
|
|
||||||
// CHECK-NEXT: "type": {
|
|
||||||
// CHECK-NEXT: "qualType": "float"
|
|
||||||
// CHECK-NEXT: }
|
|
||||||
// CHECK-NEXT: }
|
|
||||||
// CHECK-NEXT: }
|
|
||||||
// CHECK-NEXT: ]
|
|
||||||
// CHECK-NEXT: },
|
|
||||||
// CHECK-NEXT: {
|
|
||||||
// CHECK-NEXT: "id": "0x{{.*}}",
|
|
||||||
// CHECK-NEXT: "kind": "ImplicitCastExpr",
|
|
||||||
// CHECK-NEXT: "range": {
|
|
||||||
// CHECK-NEXT: "begin": {
|
|
||||||
// CHECK-NEXT: "offset": 246,
|
|
||||||
// CHECK-NEXT: "col": 14,
|
|
||||||
// CHECK-NEXT: "tokLen": 1
|
|
||||||
// CHECK-NEXT: },
|
|
||||||
// CHECK-NEXT: "end": {
|
|
||||||
// CHECK-NEXT: "offset": 246,
|
|
||||||
// CHECK-NEXT: "col": 14,
|
|
||||||
// CHECK-NEXT: "tokLen": 1
|
|
||||||
// CHECK-NEXT: }
|
|
||||||
// CHECK-NEXT: },
|
|
||||||
// CHECK-NEXT: "type": {
|
|
||||||
// CHECK-NEXT: "qualType": "float"
|
|
||||||
// CHECK-NEXT: },
|
|
||||||
// CHECK-NEXT: "valueCategory": "prvalue",
|
|
||||||
// CHECK-NEXT: "castKind": "LValueToRValue",
|
|
||||||
// CHECK-NEXT: "inner": [
|
|
||||||
// CHECK-NEXT: {
|
|
||||||
// CHECK-NEXT: "id": "0x{{.*}}",
|
|
||||||
// CHECK-NEXT: "kind": "DeclRefExpr",
|
|
||||||
// CHECK-NEXT: "range": {
|
|
||||||
// CHECK-NEXT: "begin": {
|
|
||||||
// CHECK-NEXT: "offset": 246,
|
|
||||||
// CHECK-NEXT: "col": 14,
|
|
||||||
// CHECK-NEXT: "tokLen": 1
|
|
||||||
// CHECK-NEXT: },
|
|
||||||
// CHECK-NEXT: "end": {
|
|
||||||
// CHECK-NEXT: "offset": 246,
|
|
||||||
// CHECK-NEXT: "col": 14,
|
|
||||||
// CHECK-NEXT: "tokLen": 1
|
|
||||||
// CHECK-NEXT: }
|
|
||||||
// CHECK-NEXT: },
|
|
||||||
// CHECK-NEXT: "type": {
|
|
||||||
// CHECK-NEXT: "qualType": "float"
|
|
||||||
// CHECK-NEXT: },
|
|
||||||
// CHECK-NEXT: "valueCategory": "lvalue",
|
|
||||||
// CHECK-NEXT: "referencedDecl": {
|
|
||||||
// CHECK-NEXT: "id": "0x{{.*}}",
|
|
||||||
// CHECK-NEXT: "kind": "ParmVarDecl",
|
|
||||||
// CHECK-NEXT: "name": "y",
|
|
||||||
// CHECK-NEXT: "type": {
|
|
||||||
// CHECK-NEXT: "qualType": "float"
|
|
||||||
// CHECK-NEXT: }
|
|
||||||
// CHECK-NEXT: }
|
|
||||||
// CHECK-NEXT: }
|
|
||||||
// CHECK-NEXT: ]
|
|
||||||
// CHECK-NEXT: }
|
|
||||||
// CHECK-NEXT: ]
|
|
||||||
// CHECK-NEXT: }
|
|
||||||
// CHECK-NEXT: ]
|
|
||||||
// CHECK-NEXT: }
|
|
||||||
// CHECK-NEXT: ]
|
|
||||||
// CHECK-NEXT: }
|
|
|
@ -1,69 +0,0 @@
|
||||||
// RUN: %clang_cc1 -ast-print %s -o - | FileCheck %s
|
|
||||||
|
|
||||||
float func_1(float x, float y) {
|
|
||||||
#pragma STDC FENV_ACCESS ON
|
|
||||||
if (x != 0) {
|
|
||||||
return y;
|
|
||||||
}
|
|
||||||
return x + y;
|
|
||||||
}
|
|
||||||
|
|
||||||
// CHECK-LABEL: float func_1(float x, float y) {
|
|
||||||
// CHECK-NEXT: #pragma STDC FENV_ACCESS ON
|
|
||||||
// CHECK-NEXT: if (x != 0) {
|
|
||||||
// CHECK-NEXT: return y;
|
|
||||||
// CHECK-NEXT: }
|
|
||||||
// CHECK-NEXT: return x + y;
|
|
||||||
// CHECK-NEXT: }
|
|
||||||
|
|
||||||
float func_2(float x, float y) {
|
|
||||||
#pragma STDC FENV_ACCESS ON
|
|
||||||
if (x != 0) {
|
|
||||||
#pragma STDC FENV_ACCESS OFF
|
|
||||||
return y;
|
|
||||||
}
|
|
||||||
return x + y;
|
|
||||||
}
|
|
||||||
|
|
||||||
// CHECK-LABEL: float func_2(float x, float y) {
|
|
||||||
// CHECK-NEXT: #pragma STDC FENV_ACCESS ON
|
|
||||||
// CHECK-NEXT: if (x != 0) {
|
|
||||||
// CHECK-NEXT: #pragma STDC FENV_ACCESS OFF
|
|
||||||
// CHECK-NEXT: return y;
|
|
||||||
// CHECK-NEXT: }
|
|
||||||
// CHECK-NEXT: return x + y;
|
|
||||||
// CHECK-NEXT: }
|
|
||||||
|
|
||||||
float func_3(float x, float y) {
|
|
||||||
#pragma STDC FENV_ROUND FE_DOWNWARD
|
|
||||||
return x + y;
|
|
||||||
}
|
|
||||||
|
|
||||||
// CHECK-LABEL: float func_3(float x, float y) {
|
|
||||||
// CHECK-NEXT: #pragma STDC FENV_ROUND FE_UPWARD
|
|
||||||
// CHECK-NEXT: return x + y;
|
|
||||||
// CHECK-NEXT: }
|
|
||||||
|
|
||||||
float func_4(float x, float y, float z) {
|
|
||||||
#pragma STDC FENV_ACCESS ON
|
|
||||||
#pragma clang fp exceptions(maytrap)
|
|
||||||
#pragma STDC FENV_ROUND FE_UPWARD
|
|
||||||
if (z != 0) {
|
|
||||||
#pragma STDC FENV_ACCESS OFF
|
|
||||||
#pragma STDC FENV_ROUND FE_TOWARDZERO
|
|
||||||
return z + x;
|
|
||||||
}
|
|
||||||
return x + y;
|
|
||||||
}
|
|
||||||
|
|
||||||
// CHECK-LABEL: float func_4(float x, float y, float z) {
|
|
||||||
// CHECK-NEXT: #pragma STDC FENV_ACCESS ON
|
|
||||||
// CHECK-NEXT: #pragma clang fp exceptions(maytrap)
|
|
||||||
// CHECK-NEXT: #pragma STDC FENV_ROUND FE_DOWNWARD
|
|
||||||
// CHECK-NEXT: if (z != 0) {
|
|
||||||
// CHECK-NEXT: #pragma STDC FENV_ACCESS OFF
|
|
||||||
// CHECK-NEXT: #pragma STDC FENV_ROUND FE_TOWARDZERO
|
|
||||||
// CHECK-NEXT: return z + x;
|
|
||||||
// CHECK-NEXT: }
|
|
||||||
// CHECK-NEXT: return x + y;
|
|
||||||
// CHECK-NEXT: }
|
|
Loading…
Reference in New Issue