summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema
diff options
context:
space:
mode:
authorAlp Toker <alp@nuanti.com>2013-11-27 03:18:17 +0000
committerAlp Toker <alp@nuanti.com>2013-11-27 03:18:17 +0000
commitc7c1ebe660498779773f8932bab640d12a7c93ea (patch)
tree53ad3bf6b5903ec77f0a7561c47f14a97c835307 /clang/lib/Sema
parent8081ae913451f26153fa4eb459eb51a485c2910b (diff)
downloadbcm5719-llvm-c7c1ebe660498779773f8932bab640d12a7c93ea.tar.gz
bcm5719-llvm-c7c1ebe660498779773f8932bab640d12a7c93ea.zip
Implement -Wold-style-cast
Based on a patch by Ondřej Hošek! llvm-svn: 195808
Diffstat (limited to 'clang/lib/Sema')
-rw-r--r--clang/lib/Sema/SemaExpr.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index 55f9d6f8a08..b2bff51cd95 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/lib/Sema/SemaExpr.cpp
@@ -5138,6 +5138,10 @@ Sema::ActOnCastExpr(Scope *S, SourceLocation LParenLoc,
CastExpr = Result.take();
}
+ if (getLangOpts().CPlusPlus && !castType->isVoidType())
+ Diag(CastExpr->getLocStart(), diag::warn_old_style_cast)
+ << SourceRange(LParenLoc, RParenLoc);
+
return BuildCStyleCastExpr(LParenLoc, castTInfo, RParenLoc, CastExpr);
}
OpenPOWER on IntegriCloud