diff options
author | Alp Toker <alp@nuanti.com> | 2013-11-27 03:18:17 +0000 |
---|---|---|
committer | Alp Toker <alp@nuanti.com> | 2013-11-27 03:18:17 +0000 |
commit | c7c1ebe660498779773f8932bab640d12a7c93ea (patch) | |
tree | 53ad3bf6b5903ec77f0a7561c47f14a97c835307 /clang/lib | |
parent | 8081ae913451f26153fa4eb459eb51a485c2910b (diff) | |
download | bcm5719-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')
-rw-r--r-- | clang/lib/Sema/SemaExpr.cpp | 4 |
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); } |