[cfe-commits] r138687 - /cfe/trunk/lib/Sema/AnalysisBasedWarnings.cpp
Douglas Gregor
dgregor at apple.com
Fri Aug 26 17:18:51 PDT 2011
Author: dgregor
Date: Fri Aug 26 19:18:50 2011
New Revision: 138687
URL: http://llvm.org/viewvc/llvm-project?rev=138687&view=rev
Log:
In C++0x mode, suggest nullptr as the initializer for an uninitialized
pointer variable. Patch by David Blaikie!
Modified:
cfe/trunk/lib/Sema/AnalysisBasedWarnings.cpp
Modified: cfe/trunk/lib/Sema/AnalysisBasedWarnings.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/AnalysisBasedWarnings.cpp?rev=138687&r1=138686&r2=138687&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/AnalysisBasedWarnings.cpp (original)
+++ cfe/trunk/lib/Sema/AnalysisBasedWarnings.cpp Fri Aug 26 19:18:50 2011
@@ -508,8 +508,10 @@
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";
More information about the cfe-commits
mailing list