diff options
| author | Douglas Gregor <dgregor@apple.com> | 2011-08-27 00:18:50 +0000 |
|---|---|---|
| committer | Douglas Gregor <dgregor@apple.com> | 2011-08-27 00:18:50 +0000 |
| commit | 472f85d86b0e18493ee99c72a0a60eebe05b3c12 (patch) | |
| tree | f474867056cf5a24dd516636f97060eb32034dd2 /clang/lib | |
| parent | 183875f67197e0a7654e1bf216085d2e883e7a3d (diff) | |
| download | bcm5719-llvm-472f85d86b0e18493ee99c72a0a60eebe05b3c12.tar.gz bcm5719-llvm-472f85d86b0e18493ee99c72a0a60eebe05b3c12.zip | |
In C++0x mode, suggest nullptr as the initializer for an uninitialized
pointer variable. Patch by David Blaikie!
llvm-svn: 138687
Diffstat (limited to 'clang/lib')
| -rw-r--r-- | clang/lib/Sema/AnalysisBasedWarnings.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/clang/lib/Sema/AnalysisBasedWarnings.cpp b/clang/lib/Sema/AnalysisBasedWarnings.cpp index 51b04a72f12..6c074188b34 100644 --- a/clang/lib/Sema/AnalysisBasedWarnings.cpp +++ b/clang/lib/Sema/AnalysisBasedWarnings.cpp @@ -508,8 +508,10 @@ static void SuggestInitializationFixit(Sema &S, const VarDecl *VD) { else if (VariableTy->isEnumeralType()) return; else if (VariableTy->isPointerType() || VariableTy->isMemberPointerType()) { + if (S.Context.getLangOptions().CPlusPlus0x) + initialization = " = nullptr"; // Check if 'NULL' is defined. - if (S.PP.getMacroInfo(&S.getASTContext().Idents.get("NULL"))) + else if (S.PP.getMacroInfo(&S.getASTContext().Idents.get("NULL"))) initialization = " = NULL"; else initialization = " = 0"; |

