Title: [138563] trunk/Tools
Revision
138563
Author
[email protected]
Date
2012-12-29 03:38:05 -0800 (Sat, 29 Dec 2012)

Log Message

Web Inspector: Native Memory Instrumentation plugin: do not generate 'not instrumented' warning for instrumented mutable members.
https://bugs.webkit.org/show_bug.cgi?id=105855

Reviewed by Vsevolod Vlasov.

Extract MemberExpr from ImplicitCastExpr. It happens when we instrument a mutable member because
addMember expects const T& and the mutable ref to member implicitly converts into const ref to member.

* clang/ReportMemoryUsagePlugin/ReportMemoryUsage.cpp:
(ReportMemoryUsageVisitor):
(clang::AddMemberCallVisitor::VisitCallExpr):
(clang::ReportMemoryUsageVisitor::VisitCXXMethodDecl):
(clang::ReportMemoryUsageVisitor::checkMembersCoverage):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (138562 => 138563)


--- trunk/Tools/ChangeLog	2012-12-29 10:53:10 UTC (rev 138562)
+++ trunk/Tools/ChangeLog	2012-12-29 11:38:05 UTC (rev 138563)
@@ -1,5 +1,21 @@
 2012-12-29  Ilya Tikhonovsky  <[email protected]>
 
+        Web Inspector: Native Memory Instrumentation plugin: do not generate 'not instrumented' warning for instrumented mutable members.
+        https://bugs.webkit.org/show_bug.cgi?id=105855
+
+        Reviewed by Vsevolod Vlasov.
+
+        Extract MemberExpr from ImplicitCastExpr. It happens when we instrument a mutable member because
+        addMember expects const T& and the mutable ref to member implicitly converts into const ref to member.
+
+        * clang/ReportMemoryUsagePlugin/ReportMemoryUsage.cpp:
+        (ReportMemoryUsageVisitor):
+        (clang::AddMemberCallVisitor::VisitCallExpr):
+        (clang::ReportMemoryUsageVisitor::VisitCXXMethodDecl):
+        (clang::ReportMemoryUsageVisitor::checkMembersCoverage):
+
+2012-12-29  Ilya Tikhonovsky  <[email protected]>
+
         Web Inspector: Native Memory Instrumentation plugin: move function bodies out of class declarations.
         https://bugs.webkit.org/show_bug.cgi?id=105852
 

Modified: trunk/Tools/clang/ReportMemoryUsagePlugin/ReportMemoryUsage.cpp (138562 => 138563)


--- trunk/Tools/clang/ReportMemoryUsagePlugin/ReportMemoryUsage.cpp	2012-12-29 10:53:10 UTC (rev 138562)
+++ trunk/Tools/clang/ReportMemoryUsagePlugin/ReportMemoryUsage.cpp	2012-12-29 11:38:05 UTC (rev 138563)
@@ -67,7 +67,7 @@
     void emitWarning(SourceLocation, const char* rawError);
     CXXMethodDecl* findInstrumentationMethod(CXXRecordDecl*);
     bool needsToBeInstrumented(const Type*);
-    void CheckMembersCoverage(const CXXRecordDecl* instrumentedClass, const Strings& instrumentedMembers, SourceLocation);
+    void checkMembersCoverage(const CXXRecordDecl* instrumentedClass, const Strings& instrumentedMembers, SourceLocation);
 
     CompilerInstance& m_instance;
     ASTContext* m_context;
@@ -145,7 +145,10 @@
     }
     if (instrumented || !methodCallExpr) {
         for (CallExpr::arg_iterator i = callExpr->arg_begin(); i != callExpr->arg_end(); ++i) {
-            if (MemberExpr* memberExpr = dyn_cast<MemberExpr>(*i))
+            Expr* expr = *i;
+            while (ImplicitCastExpr::classof(expr))
+                expr = static_cast<ImplicitCastExpr*>(expr)->getSubExpr();
+            if (MemberExpr* memberExpr = dyn_cast<MemberExpr>(expr))
                 m_instrumentedMembers.push_back(memberExpr->getMemberNameInfo().getAsString());
         }
     }
@@ -159,7 +162,7 @@
         if (fullLocation.isValid()) {
             AddMemberCallVisitor visitor;
             visitor.TraverseStmt(decl->getBody());
-            CheckMembersCoverage(decl->getParent(), visitor.instrumentedMembers(), decl->getLocStart());
+            checkMembersCoverage(decl->getParent(), visitor.instrumentedMembers(), decl->getLocStart());
         }
     }
     return true;
@@ -208,7 +211,7 @@
     return true;
 }
 
-void ReportMemoryUsageVisitor::CheckMembersCoverage(const CXXRecordDecl* instrumentedClass, const Strings& instrumentedMembers, SourceLocation location)
+void ReportMemoryUsageVisitor::checkMembersCoverage(const CXXRecordDecl* instrumentedClass, const Strings& instrumentedMembers, SourceLocation location)
 {
     for (CXXRecordDecl::field_iterator i = instrumentedClass->field_begin(); i != instrumentedClass->field_end(); ++i) {
         string fieldName = i->getNameAsString();
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to