From: Ted Kremenek Date: Tue, 15 Mar 2011 05:22:28 +0000 (+0000) Subject: Split warnings from -Wuninitialized-experimental into "must-be-initialized" and ... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=76709bf816e5e1b70b859bb607cf3ee91db12b76;p=clang Split warnings from -Wuninitialized-experimental into "must-be-initialized" and "may-be-initialized" warnings, each controlled by different flags. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127669 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/Basic/DiagnosticGroups.td b/include/clang/Basic/DiagnosticGroups.td index 31d9ef389d..4d3eec0f84 100644 --- a/include/clang/Basic/DiagnosticGroups.td +++ b/include/clang/Basic/DiagnosticGroups.td @@ -136,7 +136,7 @@ def Switch : DiagGroup<"switch", [SwitchEnum]>; 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">; diff --git a/lib/Analysis/UninitializedValues.cpp b/lib/Analysis/UninitializedValues.cpp index f651b474a0..31ee412815 100644 --- a/lib/Analysis/UninitializedValues.cpp +++ b/lib/Analysis/UninitializedValues.cpp @@ -198,6 +198,9 @@ static BinaryOperator *getLogicalOperatorInChain(const CFGBlock *block) { return 0; const CFGStmt *cstmt = block->front().getAs(); + if (!cstmt) + return 0; + BinaryOperator *b = llvm::dyn_cast_or_null(cstmt->getStmt()); if (!b || !b->isLogicalOp()) diff --git a/lib/Sema/AnalysisBasedWarnings.cpp b/lib/Sema/AnalysisBasedWarnings.cpp index e71f2dfb86..3d00c7fe7e 100644 --- a/lib/Sema/AnalysisBasedWarnings.cpp +++ b/lib/Sema/AnalysisBasedWarnings.cpp @@ -608,6 +608,8 @@ AnalysisBasedWarnings::IssueWarnings(sema::AnalysisBasedWarnings::Policy P, 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 tmpCFG;