In C++0x mode, suggest nullptr as the initializer for an uninitialized

pointer variable. Patch by David Blaikie!

llvm-svn: 138687
This commit is contained in:
Douglas Gregor 2011-08-27 00:18:50 +00:00
parent 183875f671
commit 472f85d86b
1 changed files with 3 additions and 1 deletions

View File

@ -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";