Title: [124579] trunk/Tools
Revision
124579
Author
[email protected]
Date
2012-08-03 01:04:39 -0700 (Fri, 03 Aug 2012)

Log Message

Web Inspector: clang plugin for checking native memory instrumentation coverage.
https://bugs.webkit.org/show_bug.cgi?id=92650

Reviewed by Yury Semikhatsky.

This is the clang plugin for checking native memory instrumentation coverage.
The idea: InspectorMemoryAgent traverses through instrumented objects and collects pointers and their sizes and types.
It is doing that with help of reportMemoryUsage function that needs to be implemented in each, significant
from native memory footprint point of view, WebCore class.
This plugin checks that the list of class members is matching with the list of members reported in reportMemoryUsage function
and makes a warning for the each member that needs to be reported.

* clang/ReportMemoryUsagePlugin/CMakeLists.txt: Added.
* clang/ReportMemoryUsagePlugin/Makefile: Added.
* clang/ReportMemoryUsagePlugin/ReportMemoryUsage.cpp: Added.
(clang):
(AddMemberCallVisitor):
(clang::AddMemberCallVisitor::VisitCallExpr):
(clang::AddMemberCallVisitor::instrumentedMembers):
(ReportMemoryUsageVisitor):
(clang::ReportMemoryUsageVisitor::ReportMemoryUsageVisitor):
(clang::ReportMemoryUsageVisitor::VisitCXXMethodDecl):
(clang::ReportMemoryUsageVisitor::emitWarning):
(clang::ReportMemoryUsageVisitor::findInstrumentationMethod):
(clang::ReportMemoryUsageVisitor::needsToBeInstrumented):
(clang::ReportMemoryUsageVisitor::CheckMembersCoverage):
(ReportMemoryUsageConsumer):
(clang::ReportMemoryUsageConsumer::ReportMemoryUsageConsumer):
(clang::ReportMemoryUsageConsumer::HandleTranslationUnit):
(ReportMemoryUsageAction):
(clang::ReportMemoryUsageAction::CreateASTConsumer):
(clang::ReportMemoryUsageAction::ParseArgs):
* clang/ReportMemoryUsagePlugin/tests/Source/WebCore/Test.cpp: Added.
(aNamespace):
(MemoryInstrumentation):
(MemoryClassInfo):
(aNamespace::MemoryClassInfo::MemoryClassInfo):
(aNamespace::MemoryClassInfo::addMember):
(aNamespace::MemoryClassInfo::addInstrumentedMember):
(OwnPtr):
(aNamespace::OwnPtr::OwnPtr):
(RefPtr):
(aNamespace::RefPtr::RefPtr):
(Vector):
(String):
(NotInstrumentedClass):
(InstrumentedClass):
(aNamespace::InstrumentedClass::reportMemoryUsage):
(InstrumentedChildClass):
(aNamespace::InstrumentedChildClass::reportMemoryUsage):
(InstrumentedChildChildClass):
(InstrumentedChildChildClass::reportMemoryUsage):
(main):

Modified Paths

Added Paths

Diff

Modified: trunk/Tools/ChangeLog (124578 => 124579)


--- trunk/Tools/ChangeLog	2012-08-03 08:03:51 UTC (rev 124578)
+++ trunk/Tools/ChangeLog	2012-08-03 08:04:39 UTC (rev 124579)
@@ -1,3 +1,59 @@
+2012-08-03  Ilya Tikhonovsky  <[email protected]>
+
+        Web Inspector: clang plugin for checking native memory instrumentation coverage.
+        https://bugs.webkit.org/show_bug.cgi?id=92650
+
+        Reviewed by Yury Semikhatsky.
+
+        This is the clang plugin for checking native memory instrumentation coverage.
+        The idea: InspectorMemoryAgent traverses through instrumented objects and collects pointers and their sizes and types.
+        It is doing that with help of reportMemoryUsage function that needs to be implemented in each, significant
+        from native memory footprint point of view, WebCore class.
+        This plugin checks that the list of class members is matching with the list of members reported in reportMemoryUsage function
+        and makes a warning for the each member that needs to be reported.
+
+        * clang/ReportMemoryUsagePlugin/CMakeLists.txt: Added.
+        * clang/ReportMemoryUsagePlugin/Makefile: Added.
+        * clang/ReportMemoryUsagePlugin/ReportMemoryUsage.cpp: Added.
+        (clang):
+        (AddMemberCallVisitor):
+        (clang::AddMemberCallVisitor::VisitCallExpr):
+        (clang::AddMemberCallVisitor::instrumentedMembers):
+        (ReportMemoryUsageVisitor):
+        (clang::ReportMemoryUsageVisitor::ReportMemoryUsageVisitor):
+        (clang::ReportMemoryUsageVisitor::VisitCXXMethodDecl):
+        (clang::ReportMemoryUsageVisitor::emitWarning):
+        (clang::ReportMemoryUsageVisitor::findInstrumentationMethod):
+        (clang::ReportMemoryUsageVisitor::needsToBeInstrumented):
+        (clang::ReportMemoryUsageVisitor::CheckMembersCoverage):
+        (ReportMemoryUsageConsumer):
+        (clang::ReportMemoryUsageConsumer::ReportMemoryUsageConsumer):
+        (clang::ReportMemoryUsageConsumer::HandleTranslationUnit):
+        (ReportMemoryUsageAction):
+        (clang::ReportMemoryUsageAction::CreateASTConsumer):
+        (clang::ReportMemoryUsageAction::ParseArgs):
+        * clang/ReportMemoryUsagePlugin/tests/Source/WebCore/Test.cpp: Added.
+        (aNamespace):
+        (MemoryInstrumentation):
+        (MemoryClassInfo):
+        (aNamespace::MemoryClassInfo::MemoryClassInfo):
+        (aNamespace::MemoryClassInfo::addMember):
+        (aNamespace::MemoryClassInfo::addInstrumentedMember):
+        (OwnPtr):
+        (aNamespace::OwnPtr::OwnPtr):
+        (RefPtr):
+        (aNamespace::RefPtr::RefPtr):
+        (Vector):
+        (String):
+        (NotInstrumentedClass):
+        (InstrumentedClass):
+        (aNamespace::InstrumentedClass::reportMemoryUsage):
+        (InstrumentedChildClass):
+        (aNamespace::InstrumentedChildClass::reportMemoryUsage):
+        (InstrumentedChildChildClass):
+        (InstrumentedChildChildClass::reportMemoryUsage):
+        (main):
+
 2012-08-03  Joone Hur  <[email protected]>
 
         [EFL][DRT] WebKitAnimation API compile-time disabled

Added: trunk/Tools/clang/ReportMemoryUsagePlugin/CMakeLists.txt (0 => 124579)


--- trunk/Tools/clang/ReportMemoryUsagePlugin/CMakeLists.txt	                        (rev 0)
+++ trunk/Tools/clang/ReportMemoryUsagePlugin/CMakeLists.txt	2012-08-03 08:04:39 UTC (rev 124579)
@@ -0,0 +1,15 @@
+set(MODULE TRUE)
+
+set( LLVM_LINK_COMPONENTS support mc)
+
+add_clang_library(ReportMemoryUsage ReportMemoryUsage.cpp)
+
+target_link_libraries(ReportMemoryUsage
+  clangFrontend
+  clangAST
+  )
+
+set_target_properties(ReportMemoryUsage
+  PROPERTIES
+  LINKER_LANGUAGE CXX
+  PREFIX "")
Property changes on: trunk/Tools/clang/ReportMemoryUsagePlugin/CMakeLists.txt
___________________________________________________________________

Added: svn:eol-style

Added: trunk/Tools/clang/ReportMemoryUsagePlugin/Makefile (0 => 124579)


--- trunk/Tools/clang/ReportMemoryUsagePlugin/Makefile	                        (rev 0)
+++ trunk/Tools/clang/ReportMemoryUsagePlugin/Makefile	2012-08-03 08:04:39 UTC (rev 124579)
@@ -0,0 +1,51 @@
+# This file is building the plugin for clang in chromium checkout.
+
+# This file requires the clang build system, at least for now. So to use this
+# Makefile, you should execute the following commands to copy this directory
+# into a clang checkout:
+#
+#   cp -R <this directory> chromium/src/third_party/llvm/tools/clang/tools/report-memory-usage-plugin
+#   cd chromium/src/third_party/llvm/tools/clang/tools/report-memory-usage-plugin
+#   make
+#
+# It can be run with clang build with help of these clang flags:
+#
+#       -Xclang -load \
+#	-Xclang <plugin-libs-dir>/libReportMemoryUsage.so \
+#	-Xclang -plugin \
+#	-Xclang report-memory-usage
+
+CLANG_LEVEL := ../..
+LIBRARYNAME = ReportMemoryUsage
+
+LINK_LIBS_IN_SHARED = 0
+SHARED_LIBRARY = 1
+
+include $(CLANG_LEVEL)/Makefile
+
+ifeq ($(OS),Darwin)
+  LDFLAGS=-Wl,-undefined,dynamic_lookup
+endif
+
+BD=../../../../Release+Asserts
+SRC_DIR=../../../../../llvm/tools/clang/tools/report-memory-usage-plugin
+
+test: all
+	@${BD}/bin/clang++ \
+	-D_GNU_SOURCE \
+	-D_DEBUG \
+	-D__STDC_CONSTANT_MACROS \
+        -D__STDC_FORMAT_MACROS \
+	-D__STDC_LIMIT_MACROS \
+	-D_GNU_SOURCE \
+        -I${BD}/tools/clang/include \
+	-Itools/clang/include \
+	-I${BD}/include \
+	-Iinclude \
+        ${SRC_DIR}/tests/Source/WebCore/Test.cpp \
+	-fsyntax-only \
+        -Xclang -load \
+	-Xclang ${BD}/lib/lib${LIBRARYNAME}.so \
+	-Xclang -plugin \
+	-Xclang report-memory-usage
+
Property changes on: trunk/Tools/clang/ReportMemoryUsagePlugin/Makefile
___________________________________________________________________

Added: svn:eol-style

Added: trunk/Tools/clang/ReportMemoryUsagePlugin/ReportMemoryUsage.cpp (0 => 124579)


--- trunk/Tools/clang/ReportMemoryUsagePlugin/ReportMemoryUsage.cpp	                        (rev 0)
+++ trunk/Tools/clang/ReportMemoryUsagePlugin/ReportMemoryUsage.cpp	2012-08-03 08:04:39 UTC (rev 124579)
@@ -0,0 +1,218 @@
+/*
+ * Copyright (C) 2012 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *     * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "clang/AST/AST.h"
+#include "clang/AST/ASTConsumer.h"
+#include "clang/AST/RecursiveASTVisitor.h"
+#include "clang/Frontend/CompilerInstance.h"
+#include "clang/Frontend/FrontendPluginRegistry.h"
+#include "llvm/Support/raw_ostream.h"
+
+using namespace clang;
+
+namespace {
+
+typedef std::vector<std::string> Strings;
+
+Strings instrumentationMethods;
+const std::string instrimentingMethodName("reportMemoryUsage");
+
+class AddMemberCallVisitor : public RecursiveASTVisitor<AddMemberCallVisitor> {
+public:
+    bool VisitCallExpr(CallExpr* callExpr)
+    {
+        CXXMemberCallExpr* methodCallExpr = dyn_cast<CXXMemberCallExpr>(callExpr);
+        bool instrumented = false;
+        if (methodCallExpr) {
+            std::string methodName = methodCallExpr->getMethodDecl()->getNameAsString();
+            Strings::iterator i = find(instrumentationMethods.begin(), instrumentationMethods.end(), methodName);
+            instrumented = i != instrumentationMethods.end();
+        }
+        if (instrumented || !methodCallExpr) {
+            for (CallExpr::arg_iterator i = callExpr->arg_begin(); i != callExpr->arg_end(); ++i) {
+                if (MemberExpr* memberExpr = dyn_cast<MemberExpr>(*i))
+                    m_instrumentedMembers.push_back(memberExpr->getMemberNameInfo().getAsString());
+            }
+        }
+        return true;
+    }
+
+    const Strings& instrumentedMembers() const { return m_instrumentedMembers; }
+
+private:
+    Strings m_instrumentedMembers;
+};
+
+class ReportMemoryUsageVisitor : public RecursiveASTVisitor<ReportMemoryUsageVisitor> {
+public:
+    explicit ReportMemoryUsageVisitor(CompilerInstance& instance, ASTContext* context)
+        : m_instance(instance)
+        , m_context(context) { }
+
+    bool VisitCXXMethodDecl(clang::CXXMethodDecl* decl)
+    {
+        if (decl->doesThisDeclarationHaveABody() && decl->getNameAsString() == instrimentingMethodName) {
+            FullSourceLoc fullLocation = m_context->getFullLoc(decl->getLocStart());
+            if (fullLocation.isValid()) {
+                AddMemberCallVisitor visitor;
+                visitor.TraverseStmt(decl->getBody());
+                CheckMembersCoverage(decl->getParent(), visitor.instrumentedMembers(), decl->getLocStart());
+            }
+        }
+        return true;
+    }
+
+private:
+    void emitWarning(SourceLocation loc, const char* rawError)
+    {
+        FullSourceLoc full(loc, m_instance.getSourceManager());
+        std::string err("[webkit-style] ");
+        err += rawError;
+        DiagnosticsEngine& diagnostic = m_instance.getDiagnostics();
+        DiagnosticsEngine::Level level = diagnostic.getWarningsAsErrors() ? DiagnosticsEngine::Error : DiagnosticsEngine::Warning;
+        unsigned id = diagnostic.getCustomDiagID(level, err);
+        DiagnosticBuilder builder = diagnostic.Report(full, id);
+    }
+
+    CXXMethodDecl* findInstrumentationMethod(CXXRecordDecl* record)
+    {
+        for (CXXRecordDecl::method_iterator m = record->method_begin(); m != record->method_end(); ++m) {
+            if (m->getNameInfo().getAsString() == instrimentingMethodName)
+                return *m;
+        }
+        return 0;
+    }
+
+    bool needsToBeInstrumented(const Type* type)
+    {
+        if (type->isBuiltinType())
+            return false;
+        if (type->isEnumeralType())
+            return false;
+        if (type->isClassType()) {
+            const RecordType* recordType = dyn_cast<RecordType>(type);
+            if (recordType) {
+                CXXRecordDecl* decl = dyn_cast<CXXRecordDecl>(recordType->getDecl());
+                if (decl->getNameAsString() == "String")
+                    return true;
+                if (!decl || !findInstrumentationMethod(decl))
+                    return false;
+            }
+        }
+        if (type->isArrayType()) {
+            const ArrayType* arrayType = dyn_cast<const ArrayType>(type);
+            return needsToBeInstrumented(arrayType->getElementType().getTypePtr());
+        }
+        return true;
+    }
+
+    void CheckMembersCoverage(const CXXRecordDecl* instrumentedClass, const Strings& instrumentedMembers, SourceLocation location)
+    {
+        for (CXXRecordDecl::field_iterator i = instrumentedClass->field_begin(); i != instrumentedClass->field_end(); ++i) {
+            std::string fieldName = i->getNameAsString();
+            if (find(instrumentedMembers.begin(), instrumentedMembers.end(), fieldName) == instrumentedMembers.end()) {
+                if (!needsToBeInstrumented(i->getType().getTypePtr()))
+                    continue;
+                emitWarning(i->getSourceRange().getBegin(), "class member needs to be instrumented in reportMemoryUsage function");
+                emitWarning(location, "located here");
+            }
+        }
+    }
+
+    CompilerInstance& m_instance;
+    ASTContext* m_context;
+};
+
+class ReportMemoryUsageConsumer : public ASTConsumer {
+public:
+    explicit ReportMemoryUsageConsumer(CompilerInstance& instance, ASTContext* context)
+        : m_visitor(instance, context)
+    {
+        instrumentationMethods.push_back("addMember");
+        instrumentationMethods.push_back("addInstrumentedMember");
+        instrumentationMethods.push_back("addVector");
+        instrumentationMethods.push_back("addInstrumentedVector");
+        instrumentationMethods.push_back("addHashSet");
+        instrumentationMethods.push_back("addInstrumentedHashSet");
+        instrumentationMethods.push_back("addHashMap");
+        instrumentationMethods.push_back("addInstrumentedHashMap");
+        instrumentationMethods.push_back("addListHashSet");
+        instrumentationMethods.push_back("addRawBuffer");
+    }
+
+    virtual void HandleTranslationUnit(clang::ASTContext& context)
+    {
+        m_visitor.TraverseDecl(context.getTranslationUnitDecl());
+    }
+
+private:
+    ReportMemoryUsageVisitor m_visitor;
+};
+
+class ReportMemoryUsageAction : public PluginASTAction {
+protected:
+    ASTConsumer* CreateASTConsumer(CompilerInstance& CI, llvm::StringRef)
+    {
+        return new ReportMemoryUsageConsumer(CI, &CI.getASTContext());
+    }
+
+    bool ParseArgs(const CompilerInstance& CI, const std::vector<std::string>& args)
+    {
+        if (args.size() && args[0] == "help")
+            llvm::errs() << m_helpText;
+        return true;
+    }
+
+    static const char* m_helpText;
+};
+
+const char* ReportMemoryUsageAction::m_helpText =
+    "This plugin is checking native memory instrumentation code.\n"
+    "The class is instrumented if it has reportMemoryUsage member function.\n"
+    "Sample:\n"
+    "class InstrumentedClass {\n"
+    "public:\n"
+    "    void reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const\n"
+    "    {\n"
+    "        MemoryClassInfo<InstrumentedClass> info(memoryObjectInfo, this, MemoryInstrumentation::DOM);\n"
+    "        info.addMember(m_notInstrumentedPtr);\n"
+    "        info.addInstrumentedMember(m_instrumentedObject);\n"
+    "    }\n"
+    "\n"
+    "private:\n"
+    "    NotInstrumentedClass* m_notInstrumentedPtr;\n"
+    "    InstrumentedClass m_instrumentedObject;\n"
+    "}\n";
+
+}
+
+static FrontendPluginRegistry::Add<ReportMemoryUsageAction>
+X("report-memory-usage", "Checks reportMemoryUsage function consistency");
+
Property changes on: trunk/Tools/clang/ReportMemoryUsagePlugin/ReportMemoryUsage.cpp
___________________________________________________________________

Added: svn:eol-style

Added: trunk/Tools/clang/ReportMemoryUsagePlugin/tests/Source/WebCore/Test.cpp (0 => 124579)


--- trunk/Tools/clang/ReportMemoryUsagePlugin/tests/Source/WebCore/Test.cpp	                        (rev 0)
+++ trunk/Tools/clang/ReportMemoryUsagePlugin/tests/Source/WebCore/Test.cpp	2012-08-03 08:04:39 UTC (rev 124579)
@@ -0,0 +1,151 @@
+/*
+ * Copyright (C) 2012 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *     * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+namespace aNamespace {
+
+class MemoryInstrumentation {
+public:
+    enum ObjectType {
+        DOM
+    };
+};
+
+class MemoryObjectInfo {
+};
+
+template <typename T>
+class MemoryClassInfo {
+public:
+    MemoryClassInfo(MemoryObjectInfo*, const T*, MemoryInstrumentation::ObjectType) { }
+    template <typename M> void addMember(M&) { }
+    template <typename M> void addInstrumentedMember(M&) { }
+};
+
+// ------ Mocked types
+template <typename T>
+class OwnPtr {
+public:
+    OwnPtr(T* ptr) : m_ptr(ptr) { }
+private:
+    T* m_ptr;
+};
+
+template <typename T>
+class RefPtr {
+public:
+    RefPtr(T* ptr) : m_ptr(ptr) { }
+private:
+    T* m_ptr;
+};
+
+template <typename T>
+class Vector {
+private:
+    T* m_data;
+};
+
+class String {
+private:
+    char* m_data;
+};
+
+// ------ User defined types
+class NotInstrumentedClass {
+public:
+    int m_array[10];
+};
+
+class InstrumentedClass {
+public:
+    virtual void reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
+    {
+        MemoryClassInfo<InstrumentedClass> info(memoryObjectInfo, this, MemoryInstrumentation::DOM);
+        info.addMember(m_notInstrumentedPtrReportedNoWarning);
+        info.addInstrumentedMember(m_instrumentedPtrReportedNoWarning);
+    }
+
+private:
+
+    // have to be skipped even if not reported
+    int m_PODNotReportedNoWarning;
+    int m_arrayNotReportedNoWarning[10];
+    NotInstrumentedClass m_notInstrumentedNotReportedNoWarning;
+    NotInstrumentedClass m_notInstrumentedArrayNotReportedNoWarning[10];
+    enum { None } m_enumNotReportedNoWarning;
+    bool m_boolNotReportedNoWarning;
+
+    // reported
+    NotInstrumentedClass* m_notInstrumentedPtrReportedNoWarning;
+    InstrumentedClass* m_instrumentedPtrReportedNoWarning;
+
+    // reported
+    InstrumentedClass* m_instrumentedPtrNotReportedWarning;
+    int* m_rawBufferNotReportedWarning;
+    int* m_intPtrArrayNotReportedWarning[10];
+    NotInstrumentedClass* m_objPtrArrayNotReportedWarning[10];
+    OwnPtr<NotInstrumentedClass> m_ownPtrNotReportedWarning;
+    RefPtr<NotInstrumentedClass> m_refPtrNotReportedWarning;
+    String m_stringNotReportedWarning;
+    Vector<NotInstrumentedClass> m_vectorNotReportedWarning;
+};
+
+}
+
+using namespace aNamespace;
+
+namespace {
+
+class InstrumentedChildClass : public aNamespace::InstrumentedClass {
+public:
+    virtual void reportMemoryUsage(MemoryObjectInfo*) const;
+};
+
+void InstrumentedChildClass::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
+{
+    MemoryClassInfo<InstrumentedChildClass> info(memoryObjectInfo, this, MemoryInstrumentation::DOM);
+}
+
+}
+
+class InstrumentedChildChildClass : public InstrumentedChildClass {
+public:
+    virtual void reportMemoryUsage(MemoryObjectInfo*) const;
+};
+
+void InstrumentedChildChildClass::reportMemoryUsage(MemoryObjectInfo*) const
+{
+}
+
+int aGlobalVariable = 0;
+
+int main(int argc, char** argv)
+{
+    return 0;
+}
Property changes on: trunk/Tools/clang/ReportMemoryUsagePlugin/tests/Source/WebCore/Test.cpp
___________________________________________________________________

Added: svn:eol-style

_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to