[llvm-branch-commits] [cfe-branch] r111410 - in /cfe/branches/Apple/williamson: include/clang/Driver/ include/clang/Frontend/ lib/Checker/ lib/Frontend/ test/Analysis/

Daniel Dunbar daniel at zuster.org
Wed Aug 18 13:33:32 PDT 2010


Author: ddunbar
Date: Wed Aug 18 15:33:32 2010
New Revision: 111410

URL: http://llvm.org/viewvc/llvm-project?rev=111410&view=rev
Log:
Merge r110482:
--
Author: Tom Care <tcare at apple.com>
Date:   Fri Aug 6 22:23:07 2010 +0000

    Removed IdempotentOperationChecker from default analysis and returned back to a flag (-analyzer-check-idempotent-operations)
    - Added IdempotentOperationChecker to experimental analyses for testing purposes
    - Updated test cases to explictly call the checker

Added:
    cfe/branches/Apple/williamson/include/clang/Driver/CC1Options.td.orig
      - copied, changed from r111409, cfe/branches/Apple/williamson/include/clang/Driver/CC1Options.td
    cfe/branches/Apple/williamson/lib/Checker/AnalysisConsumer.cpp.orig
      - copied, changed from r111409, cfe/branches/Apple/williamson/lib/Checker/AnalysisConsumer.cpp
    cfe/branches/Apple/williamson/lib/Checker/GRExprEngine.cpp.orig
      - copied, changed from r111409, cfe/branches/Apple/williamson/lib/Checker/GRExprEngine.cpp
    cfe/branches/Apple/williamson/lib/Frontend/CompilerInvocation.cpp.orig
      - copied, changed from r111409, cfe/branches/Apple/williamson/lib/Frontend/CompilerInvocation.cpp
Modified:
    cfe/branches/Apple/williamson/include/clang/Driver/CC1Options.td
    cfe/branches/Apple/williamson/include/clang/Frontend/AnalyzerOptions.h
    cfe/branches/Apple/williamson/lib/Checker/AnalysisConsumer.cpp
    cfe/branches/Apple/williamson/lib/Checker/GRExprEngine.cpp
    cfe/branches/Apple/williamson/lib/Checker/GRExprEngineExperimentalChecks.h
    cfe/branches/Apple/williamson/lib/Checker/GRExprEngineInternalChecks.h
    cfe/branches/Apple/williamson/lib/Checker/IdempotentOperationChecker.cpp
    cfe/branches/Apple/williamson/lib/Frontend/CompilerInvocation.cpp
    cfe/branches/Apple/williamson/test/Analysis/idempotent-operations.c
    cfe/branches/Apple/williamson/test/Analysis/uninit-vals-ps-region.m

Modified: cfe/branches/Apple/williamson/include/clang/Driver/CC1Options.td
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/williamson/include/clang/Driver/CC1Options.td?rev=111410&r1=111409&r2=111410&view=diff
==============================================================================
--- cfe/branches/Apple/williamson/include/clang/Driver/CC1Options.td (original)
+++ cfe/branches/Apple/williamson/include/clang/Driver/CC1Options.td Wed Aug 18 15:33:32 2010
@@ -58,6 +58,8 @@
   HelpText<"Run the [Core] Foundation reference count checker">;
 def analysis_WarnSizeofPointer : Flag<"-warn-sizeof-pointer">,
   HelpText<"Warn about unintended use of sizeof() on pointer expressions">;
+def analysis_WarnIdempotentOps : Flag<"-analyzer-check-idempotent-operations">,
+  HelpText<"Warn about idempotent operations">;
 
 def analyzer_store : Separate<"-analyzer-store">,
   HelpText<"Source Code Analysis - Abstract Memory Store Models">;

Copied: cfe/branches/Apple/williamson/include/clang/Driver/CC1Options.td.orig (from r111409, cfe/branches/Apple/williamson/include/clang/Driver/CC1Options.td)
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/williamson/include/clang/Driver/CC1Options.td.orig?p2=cfe/branches/Apple/williamson/include/clang/Driver/CC1Options.td.orig&p1=cfe/branches/Apple/williamson/include/clang/Driver/CC1Options.td&r1=111409&r2=111410&rev=111410&view=diff
==============================================================================
    (empty)

Modified: cfe/branches/Apple/williamson/include/clang/Frontend/AnalyzerOptions.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/williamson/include/clang/Frontend/AnalyzerOptions.h?rev=111410&r1=111409&r2=111410&view=diff
==============================================================================
--- cfe/branches/Apple/williamson/include/clang/Frontend/AnalyzerOptions.h (original)
+++ cfe/branches/Apple/williamson/include/clang/Frontend/AnalyzerOptions.h Wed Aug 18 15:33:32 2010
@@ -66,6 +66,7 @@
   unsigned AnalyzerDisplayProgress : 1;
   unsigned AnalyzeNestedBlocks : 1;
   unsigned EagerlyAssume : 1;
+  unsigned IdempotentOps : 1;
   unsigned PurgeDead : 1;
   unsigned TrimGraph : 1;
   unsigned VisualizeEGDot : 1;

Modified: cfe/branches/Apple/williamson/lib/Checker/AnalysisConsumer.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/williamson/lib/Checker/AnalysisConsumer.cpp?rev=111410&r1=111409&r2=111410&view=diff
==============================================================================
--- cfe/branches/Apple/williamson/lib/Checker/AnalysisConsumer.cpp (original)
+++ cfe/branches/Apple/williamson/lib/Checker/AnalysisConsumer.cpp Wed Aug 18 15:33:32 2010
@@ -29,6 +29,7 @@
 #include "clang/Checker/PathSensitive/GRTransferFuncs.h"
 #include "clang/Checker/PathDiagnosticClients.h"
 #include "GRExprEngineExperimentalChecks.h"
+#include "GRExprEngineInternalChecks.h"
 #include "clang/Basic/FileManager.h"
 #include "clang/Basic/SourceManager.h"
 #include "clang/Frontend/AnalyzerOptions.h"
@@ -342,6 +343,12 @@
   if (C.Opts.EnableExperimentalChecks)
     RegisterExperimentalChecks(Eng);
 
+  // Enable idempotent operation checking if it was explicitly turned on, or if
+  // we are running experimental checks (i.e. everything)
+  if (C.Opts.IdempotentOps || C.Opts.EnableExperimentalChecks
+      || C.Opts.EnableExperimentalInternalChecks)
+    RegisterIdempotentOperationChecker(Eng);
+
   // Set the graph auditor.
   llvm::OwningPtr<ExplodedNode::Auditor> Auditor;
   if (mgr.shouldVisualizeUbigraph()) {

Copied: cfe/branches/Apple/williamson/lib/Checker/AnalysisConsumer.cpp.orig (from r111409, cfe/branches/Apple/williamson/lib/Checker/AnalysisConsumer.cpp)
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/williamson/lib/Checker/AnalysisConsumer.cpp.orig?p2=cfe/branches/Apple/williamson/lib/Checker/AnalysisConsumer.cpp.orig&p1=cfe/branches/Apple/williamson/lib/Checker/AnalysisConsumer.cpp&r1=111409&r2=111410&rev=111410&view=diff
==============================================================================
    (empty)

Modified: cfe/branches/Apple/williamson/lib/Checker/GRExprEngine.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/williamson/lib/Checker/GRExprEngine.cpp?rev=111410&r1=111409&r2=111410&view=diff
==============================================================================
--- cfe/branches/Apple/williamson/lib/Checker/GRExprEngine.cpp (original)
+++ cfe/branches/Apple/williamson/lib/Checker/GRExprEngine.cpp Wed Aug 18 15:33:32 2010
@@ -361,7 +361,6 @@
   RegisterDereferenceChecker(Eng);
   RegisterVLASizeChecker(Eng);
   RegisterDivZeroChecker(Eng);
-  RegisterIdempotentOperationChecker(Eng);
   RegisterReturnUndefChecker(Eng);
   RegisterUndefinedArraySubscriptChecker(Eng);
   RegisterUndefinedAssignmentChecker(Eng);

Copied: cfe/branches/Apple/williamson/lib/Checker/GRExprEngine.cpp.orig (from r111409, cfe/branches/Apple/williamson/lib/Checker/GRExprEngine.cpp)
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/williamson/lib/Checker/GRExprEngine.cpp.orig?p2=cfe/branches/Apple/williamson/lib/Checker/GRExprEngine.cpp.orig&p1=cfe/branches/Apple/williamson/lib/Checker/GRExprEngine.cpp&r1=111409&r2=111410&rev=111410&view=diff
==============================================================================
    (empty)

Modified: cfe/branches/Apple/williamson/lib/Checker/GRExprEngineExperimentalChecks.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/williamson/lib/Checker/GRExprEngineExperimentalChecks.h?rev=111410&r1=111409&r2=111410&view=diff
==============================================================================
--- cfe/branches/Apple/williamson/lib/Checker/GRExprEngineExperimentalChecks.h (original)
+++ cfe/branches/Apple/williamson/lib/Checker/GRExprEngineExperimentalChecks.h Wed Aug 18 15:33:32 2010
@@ -20,6 +20,7 @@
 class GRExprEngine;
 
 void RegisterCStringChecker(GRExprEngine &Eng);
+void RegisterIdempotentOperationChecker(GRExprEngine &Eng);
 void RegisterMallocChecker(GRExprEngine &Eng);
 void RegisterPthreadLockChecker(GRExprEngine &Eng);
 void RegisterStreamChecker(GRExprEngine &Eng);

Modified: cfe/branches/Apple/williamson/lib/Checker/GRExprEngineInternalChecks.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/williamson/lib/Checker/GRExprEngineInternalChecks.h?rev=111410&r1=111409&r2=111410&view=diff
==============================================================================
--- cfe/branches/Apple/williamson/lib/Checker/GRExprEngineInternalChecks.h (original)
+++ cfe/branches/Apple/williamson/lib/Checker/GRExprEngineInternalChecks.h Wed Aug 18 15:33:32 2010
@@ -30,7 +30,6 @@
 void RegisterDereferenceChecker(GRExprEngine &Eng);
 void RegisterDivZeroChecker(GRExprEngine &Eng);
 void RegisterFixedAddressChecker(GRExprEngine &Eng);
-void RegisterIdempotentOperationChecker(GRExprEngine &Eng);
 void RegisterNoReturnFunctionChecker(GRExprEngine &Eng);
 void RegisterPointerArithChecker(GRExprEngine &Eng);
 void RegisterPointerSubChecker(GRExprEngine &Eng);

Modified: cfe/branches/Apple/williamson/lib/Checker/IdempotentOperationChecker.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/williamson/lib/Checker/IdempotentOperationChecker.cpp?rev=111410&r1=111409&r2=111410&view=diff
==============================================================================
--- cfe/branches/Apple/williamson/lib/Checker/IdempotentOperationChecker.cpp (original)
+++ cfe/branches/Apple/williamson/lib/Checker/IdempotentOperationChecker.cpp Wed Aug 18 15:33:32 2010
@@ -48,7 +48,7 @@
 // - Handle mixed assumptions (which assumptions can belong together?)
 // - Finer grained false positive control (levels)
 
-#include "GRExprEngineInternalChecks.h"
+#include "GRExprEngineExperimentalChecks.h"
 #include "clang/Checker/BugReporter/BugType.h"
 #include "clang/Checker/PathSensitive/CheckerHelpers.h"
 #include "clang/Checker/PathSensitive/CheckerVisitor.h"

Modified: cfe/branches/Apple/williamson/lib/Frontend/CompilerInvocation.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/williamson/lib/Frontend/CompilerInvocation.cpp?rev=111410&r1=111409&r2=111410&view=diff
==============================================================================
--- cfe/branches/Apple/williamson/lib/Frontend/CompilerInvocation.cpp (original)
+++ cfe/branches/Apple/williamson/lib/Frontend/CompilerInvocation.cpp Wed Aug 18 15:33:32 2010
@@ -112,6 +112,8 @@
     Res.push_back("-analyzer-experimental-checks");
   if (Opts.EnableExperimentalInternalChecks)
     Res.push_back("-analyzer-experimental-internal-checks");
+  if (Opts.IdempotentOps)
+      Res.push_back("-analyzer-check-idempotent-operations");
 }
 
 static void CodeGenOptsToArgs(const CodeGenOptions &Opts,
@@ -793,6 +795,7 @@
   Opts.MaxNodes = Args.getLastArgIntValue(OPT_analyzer_max_nodes, 150000,Diags);
   Opts.MaxLoop = Args.getLastArgIntValue(OPT_analyzer_max_loop, 3, Diags);
   Opts.InlineCall = Args.hasArg(OPT_analyzer_inline_call);
+  Opts.IdempotentOps = Args.hasArg(OPT_analysis_WarnIdempotentOps);
 }
 
 static void ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args,

Copied: cfe/branches/Apple/williamson/lib/Frontend/CompilerInvocation.cpp.orig (from r111409, cfe/branches/Apple/williamson/lib/Frontend/CompilerInvocation.cpp)
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/williamson/lib/Frontend/CompilerInvocation.cpp.orig?p2=cfe/branches/Apple/williamson/lib/Frontend/CompilerInvocation.cpp.orig&p1=cfe/branches/Apple/williamson/lib/Frontend/CompilerInvocation.cpp&r1=111409&r2=111410&rev=111410&view=diff
==============================================================================
    (empty)

Modified: cfe/branches/Apple/williamson/test/Analysis/idempotent-operations.c
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/williamson/test/Analysis/idempotent-operations.c?rev=111410&r1=111409&r2=111410&view=diff
==============================================================================
--- cfe/branches/Apple/williamson/test/Analysis/idempotent-operations.c (original)
+++ cfe/branches/Apple/williamson/test/Analysis/idempotent-operations.c Wed Aug 18 15:33:32 2010
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -analyze -analyzer-store=region -analyzer-constraints=range -fblocks -verify -analyzer-opt-analyze-nested-blocks -analyzer-check-objc-mem -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-store=region -analyzer-constraints=range -fblocks -verify -analyzer-opt-analyze-nested-blocks -analyzer-check-objc-mem -analyzer-check-idempotent-operations -verify %s
 
 // Basic tests
 

Modified: cfe/branches/Apple/williamson/test/Analysis/uninit-vals-ps-region.m
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/williamson/test/Analysis/uninit-vals-ps-region.m?rev=111410&r1=111409&r2=111410&view=diff
==============================================================================
--- cfe/branches/Apple/williamson/test/Analysis/uninit-vals-ps-region.m (original)
+++ cfe/branches/Apple/williamson/test/Analysis/uninit-vals-ps-region.m Wed Aug 18 15:33:32 2010
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -analyze -analyzer-check-objc-mem -analyzer-store=region -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-check-objc-mem -analyzer-store=region -analyzer-check-idempotent-operations -verify %s
 
 struct s {
   int data;





More information about the llvm-branch-commits mailing list