forked from OSchip/llvm-project
parent
de9e976468
commit
cc6a908c39
|
@ -530,45 +530,45 @@ Sema::ActOnStartOfSwitchStmt(SourceLocation SwitchLoc, Expr *Cond,
|
|||
|
||||
class SwitchConvertDiagnoser : public ICEConvertDiagnoser {
|
||||
Expr *Cond;
|
||||
|
||||
|
||||
public:
|
||||
SwitchConvertDiagnoser(Expr *Cond)
|
||||
: ICEConvertDiagnoser(false, true), Cond(Cond) { }
|
||||
|
||||
|
||||
virtual DiagnosticBuilder diagnoseNotInt(Sema &S, SourceLocation Loc,
|
||||
QualType T) {
|
||||
return S.Diag(Loc, diag::err_typecheck_statement_requires_integer) << T;
|
||||
}
|
||||
|
||||
|
||||
virtual DiagnosticBuilder diagnoseIncomplete(Sema &S, SourceLocation Loc,
|
||||
QualType T) {
|
||||
return S.Diag(Loc, diag::err_switch_incomplete_class_type)
|
||||
<< T << Cond->getSourceRange();
|
||||
}
|
||||
|
||||
|
||||
virtual DiagnosticBuilder diagnoseExplicitConv(Sema &S, SourceLocation Loc,
|
||||
QualType T,
|
||||
QualType ConvTy) {
|
||||
return S.Diag(Loc, diag::err_switch_explicit_conversion) << T << ConvTy;
|
||||
}
|
||||
|
||||
|
||||
virtual DiagnosticBuilder noteExplicitConv(Sema &S, CXXConversionDecl *Conv,
|
||||
QualType ConvTy) {
|
||||
return S.Diag(Conv->getLocation(), diag::note_switch_conversion)
|
||||
<< ConvTy->isEnumeralType() << ConvTy;
|
||||
}
|
||||
|
||||
|
||||
virtual DiagnosticBuilder diagnoseAmbiguous(Sema &S, SourceLocation Loc,
|
||||
QualType T) {
|
||||
return S.Diag(Loc, diag::err_switch_multiple_conversions) << T;
|
||||
}
|
||||
|
||||
|
||||
virtual DiagnosticBuilder noteAmbiguous(Sema &S, CXXConversionDecl *Conv,
|
||||
QualType ConvTy) {
|
||||
return S.Diag(Conv->getLocation(), diag::note_switch_conversion)
|
||||
<< ConvTy->isEnumeralType() << ConvTy;
|
||||
}
|
||||
|
||||
|
||||
virtual DiagnosticBuilder diagnoseConversion(Sema &S, SourceLocation Loc,
|
||||
QualType T,
|
||||
QualType ConvTy) {
|
||||
|
@ -2344,7 +2344,7 @@ Sema::ActOnReturnStmt(SourceLocation ReturnLoc, Expr *RetValExp) {
|
|||
// FIXME: The diagnostics here don't really describe what is happening.
|
||||
InitializedEntity Entity =
|
||||
InitializedEntity::InitializeTemporary(RelatedRetType);
|
||||
|
||||
|
||||
ExprResult Res = PerformCopyInitialization(Entity, SourceLocation(),
|
||||
RetValExp);
|
||||
if (Res.isInvalid()) {
|
||||
|
@ -2388,7 +2388,7 @@ Sema::ActOnReturnStmt(SourceLocation ReturnLoc, Expr *RetValExp) {
|
|||
if (getLangOpts().CPlusPlus && FnRetType->isRecordType() &&
|
||||
!CurContext->isDependentContext())
|
||||
FunctionScopes.back()->Returns.push_back(Result);
|
||||
|
||||
|
||||
return Owned(Result);
|
||||
}
|
||||
|
||||
|
@ -2432,13 +2432,12 @@ static bool isOperandMentioned(unsigned OpNo,
|
|||
for (unsigned p = 0, e = AsmStrPieces.size(); p != e; ++p) {
|
||||
const AsmStmt::AsmStringPiece &Piece = AsmStrPieces[p];
|
||||
if (!Piece.isOperand()) continue;
|
||||
|
||||
|
||||
// If this is a reference to the input and if the input was the smaller
|
||||
// one, then we have to reject this asm.
|
||||
if (Piece.getOperandNo() == OpNo)
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -2623,7 +2622,7 @@ StmtResult Sema::ActOnAsmStmt(SourceLocation AsmLoc, bool IsSimple,
|
|||
// then we can promote the smaller one to a larger input and the asm string
|
||||
// won't notice.
|
||||
bool SmallerValueMentioned = false;
|
||||
|
||||
|
||||
// If this is a reference to the input and if the input was the smaller
|
||||
// one, then we have to reject this asm.
|
||||
if (isOperandMentioned(InputOpNo, Pieces)) {
|
||||
|
@ -2644,7 +2643,7 @@ StmtResult Sema::ActOnAsmStmt(SourceLocation AsmLoc, bool IsSimple,
|
|||
if (!SmallerValueMentioned && InputDomain != AD_Other &&
|
||||
OutputConstraintInfos[TiedTo].allowsRegister())
|
||||
continue;
|
||||
|
||||
|
||||
// Either both of the operands were mentioned or the smaller one was
|
||||
// mentioned. One more special case that we'll allow: if the tied input is
|
||||
// integer, unmentioned, and is a constant, then we'll allow truncating it
|
||||
|
@ -2659,7 +2658,7 @@ StmtResult Sema::ActOnAsmStmt(SourceLocation AsmLoc, bool IsSimple,
|
|||
NS->setInputExpr(i, InputExpr);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
Diag(InputExpr->getLocStart(),
|
||||
diag::err_asm_tying_incompatible_types)
|
||||
<< InTy << OutTy << OutputExpr->getSourceRange()
|
||||
|
@ -2748,7 +2747,6 @@ Sema::ActOnObjCAtThrowStmt(SourceLocation AtLoc, Expr *Throw,
|
|||
if (!AtCatchParent)
|
||||
return StmtError(Diag(AtLoc, diag::error_rethrow_used_outside_catch));
|
||||
}
|
||||
|
||||
return BuildObjCAtThrowStmt(AtLoc, Throw);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue