forked from OSchip/llvm-project
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:
parent
183875f671
commit
472f85d86b
|
@ -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";
|
||||
|
|
Loading…
Reference in New Issue