Propagate SourceLocations through to get a Loc on float_cast_overflow
Summary:
float_cast_overflow is the only UBSan check without a source location attached.
This patch propagates SourceLocations where necessary to get them to the
EmitCheck() call.
Reviewers: rsmith, ABataev, rjmccall
Subscribers: cfe-commits
Differential Revision: http://reviews.llvm.org/D11757
llvm-svn: 244568
diff --git a/clang/lib/CodeGen/CGExpr.cpp b/clang/lib/CodeGen/CGExpr.cpp
index 0ee144c..a0d004d 100644
--- a/clang/lib/CodeGen/CGExpr.cpp
+++ b/clang/lib/CodeGen/CGExpr.cpp
@@ -96,10 +96,12 @@
}
QualType BoolTy = getContext().BoolTy;
+ SourceLocation Loc = E->getExprLoc();
if (!E->getType()->isAnyComplexType())
- return EmitScalarConversion(EmitScalarExpr(E), E->getType(), BoolTy);
+ return EmitScalarConversion(EmitScalarExpr(E), E->getType(), BoolTy, Loc);
- return EmitComplexToScalarConversion(EmitComplexExpr(E), E->getType(),BoolTy);
+ return EmitComplexToScalarConversion(EmitComplexExpr(E), E->getType(), BoolTy,
+ Loc);
}
/// EmitIgnoredExpr - Emit code to compute the specified expression,