summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaExpr.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2012-09-14 04:35:37 +0000
committerDouglas Gregor <dgregor@apple.com>2012-09-14 04:35:37 +0000
commit0064c5968f3866b891b34045b3c90fbcf67ec392 (patch)
tree7459d27814e544c92318821669e3a82c420dc5fa /clang/lib/Sema/SemaExpr.cpp
parent45d849c4bddc54105f61e6f8864341664d0433ed (diff)
downloadbcm5719-llvm-0064c5968f3866b891b34045b3c90fbcf67ec392.tar.gz
bcm5719-llvm-0064c5968f3866b891b34045b3c90fbcf67ec392.zip
In debugger mode, allow comparisons between pointers and integers
without a cast. Fixes <rdar://problem/11830912>. llvm-svn: 163873
Diffstat (limited to 'clang/lib/Sema/SemaExpr.cpp')
-rw-r--r--clang/lib/Sema/SemaExpr.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index cfa9ccbfc33..3d143c8097f 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/lib/Sema/SemaExpr.cpp
@@ -7214,7 +7214,10 @@ QualType Sema::CheckCompareOperands(ExprResult &LHS, ExprResult &RHS,
(LHSType->isIntegerType() && RHSType->isAnyPointerType())) {
unsigned DiagID = 0;
bool isError = false;
- if ((LHSIsNull && LHSType->isIntegerType()) ||
+ if (LangOpts.DebuggerSupport) {
+ // Under a debugger, allow the comparison of pointers to integers,
+ // since users tend to want to compare addresses.
+ } else if ((LHSIsNull && LHSType->isIntegerType()) ||
(RHSIsNull && RHSType->isIntegerType())) {
if (IsRelational && !getLangOpts().CPlusPlus)
DiagID = diag::ext_typecheck_ordered_comparison_of_pointer_and_zero;
OpenPOWER on IntegriCloud