[cfe-commits] r127669 - in /cfe/trunk: include/clang/Basic/DiagnosticGroups.td lib/Analysis/UninitializedValues.cpp lib/Sema/AnalysisBasedWarnings.cpp

Ted Kremenek kremenek at apple.com
Mon Mar 14 22:22:28 PDT 2011


Author: kremenek
Date: Tue Mar 15 00:22:28 2011
New Revision: 127669

URL: http://llvm.org/viewvc/llvm-project?rev=127669&view=rev
Log:
Split warnings from -Wuninitialized-experimental into "must-be-initialized" and "may-be-initialized" warnings, each controlled by different flags.

Modified:
    cfe/trunk/include/clang/Basic/DiagnosticGroups.td
    cfe/trunk/lib/Analysis/UninitializedValues.cpp
    cfe/trunk/lib/Sema/AnalysisBasedWarnings.cpp

Modified: cfe/trunk/include/clang/Basic/DiagnosticGroups.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticGroups.td?rev=127669&r1=127668&r2=127669&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticGroups.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticGroups.td Tue Mar 15 00:22:28 2011
@@ -136,7 +136,7 @@
 def Trigraphs      : DiagGroup<"trigraphs">;
 
 def : DiagGroup<"type-limits">;
-
+def Uninitialized  : DiagGroup<"uninitialized">;
 def UninitializedMaybe : DiagGroup<"uninitialized-maybe">;
 def UnknownPragmas : DiagGroup<"unknown-pragmas">;
 def UnknownAttributes : DiagGroup<"unknown-attributes">;

Modified: cfe/trunk/lib/Analysis/UninitializedValues.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/UninitializedValues.cpp?rev=127669&r1=127668&r2=127669&view=diff
==============================================================================
--- cfe/trunk/lib/Analysis/UninitializedValues.cpp (original)
+++ cfe/trunk/lib/Analysis/UninitializedValues.cpp Tue Mar 15 00:22:28 2011
@@ -198,6 +198,9 @@
     return 0;
 
   const CFGStmt *cstmt = block->front().getAs<CFGStmt>();
+  if (!cstmt)
+    return 0;
+
   BinaryOperator *b = llvm::dyn_cast_or_null<BinaryOperator>(cstmt->getStmt());
   
   if (!b || !b->isLogicalOp())

Modified: cfe/trunk/lib/Sema/AnalysisBasedWarnings.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/AnalysisBasedWarnings.cpp?rev=127669&r1=127668&r2=127669&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/AnalysisBasedWarnings.cpp (original)
+++ cfe/trunk/lib/Sema/AnalysisBasedWarnings.cpp Tue Mar 15 00:22:28 2011
@@ -608,6 +608,8 @@
     CheckUnreachable(S, AC);
   
   if (Diags.getDiagnosticLevel(diag::warn_uninit_var, D->getLocStart())
+      != Diagnostic::Ignored ||
+      Diags.getDiagnosticLevel(diag::warn_maybe_uninit_var, D->getLocStart())
       != Diagnostic::Ignored) {
     ASTContext &ctx = D->getASTContext();
     llvm::OwningPtr<CFG> tmpCFG;





More information about the cfe-commits mailing list