[cfe-commits] r165040 - in /cfe/trunk: include/clang/StaticAnalyzer/Core/AnalyzerOptions.h lib/StaticAnalyzer/Core/AnalyzerOptions.cpp test/Analysis/analyzer-config.cpp

Ted Kremenek kremenek at apple.com
Tue Oct 2 13:31:52 PDT 2012


Author: kremenek
Date: Tue Oct  2 15:31:52 2012
New Revision: 165040

URL: http://llvm.org/viewvc/llvm-project?rev=165040&view=rev
Log:
Change AnalyzerOptions::mayInlineCXXMemberFunction to default populate
the config string table.  Also setup a test for dumping the analyzer
configuration for C++.

Added:
    cfe/trunk/test/Analysis/analyzer-config.cpp
Modified:
    cfe/trunk/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h
    cfe/trunk/lib/StaticAnalyzer/Core/AnalyzerOptions.cpp

Modified: cfe/trunk/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h?rev=165040&r1=165039&r2=165040&view=diff
==============================================================================
--- cfe/trunk/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h (original)
+++ cfe/trunk/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h Tue Oct  2 15:31:52 2012
@@ -204,7 +204,7 @@
   /// This is controlled by the 'c++-inlining' config option.
   ///
   /// \sa CXXMemberInliningMode
-  bool mayInlineCXXMemberFunction(CXXInlineableMemberKind K) const;
+  bool mayInlineCXXMemberFunction(CXXInlineableMemberKind K);
 
   /// Returns true if ObjectiveC inlining is enabled, false otherwise.
   bool mayInlineObjCMethod();

Modified: cfe/trunk/lib/StaticAnalyzer/Core/AnalyzerOptions.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/AnalyzerOptions.cpp?rev=165040&r1=165039&r2=165040&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Core/AnalyzerOptions.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Core/AnalyzerOptions.cpp Tue Oct  2 15:31:52 2012
@@ -19,19 +19,20 @@
 using namespace llvm;
 
 bool
-AnalyzerOptions::mayInlineCXXMemberFunction(CXXInlineableMemberKind K) const {
+AnalyzerOptions::mayInlineCXXMemberFunction(CXXInlineableMemberKind K) {
   if (IPAMode < Inlining)
     return false;
 
   if (!CXXMemberInliningMode) {
     static const char *ModeKey = "c++-inlining";
-    std::string ModeStr = Config.lookup(ModeKey);
+    
+    StringRef ModeStr(Config.GetOrCreateValue(ModeKey,
+                                              "methods").getValue());
 
     CXXInlineableMemberKind &MutableMode =
       const_cast<CXXInlineableMemberKind &>(CXXMemberInliningMode);
 
     MutableMode = llvm::StringSwitch<CXXInlineableMemberKind>(ModeStr)
-      .Case("", CIMK_MemberFunctions)
       .Case("constructors", CIMK_Constructors)
       .Case("destructors", CIMK_Destructors)
       .Case("none", CIMK_None)

Added: cfe/trunk/test/Analysis/analyzer-config.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/analyzer-config.cpp?rev=165040&view=auto
==============================================================================
--- cfe/trunk/test/Analysis/analyzer-config.cpp (added)
+++ cfe/trunk/test/Analysis/analyzer-config.cpp Tue Oct  2 15:31:52 2012
@@ -0,0 +1,20 @@
+// RUN: %clang --analyze %s -o /dev/null -Xclang -analyzer-checker=debug.ConfigDumper > %t 2>&1
+// RUN: FileCheck --input-file=%t %s
+
+void bar() {}
+void foo() { bar(); }
+
+class Foo {
+public:
+	void bar() {}
+	void foo() { bar(); }
+};
+
+// CHECK: [config]
+// CHECK-NEXT: c++-inlining = methods
+// CHECK-NEXT: c++-stdlib-inlining = true
+// CHECK-NEXT: c++-template-inlining = true
+// CHECK-NEXT: cfg-temporary-dtors = false
+// CHECK-NEXT: faux-bodies = true
+// CHECK-NEXT: [stats]
+// CHECK-NEXT: num-entries = 5





More information about the cfe-commits mailing list