This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[thread-annotations] [patch] Fix an issue in handling lockables wrapped in smart pointers


I checked in this patch to the thread-annotations branch to fix an
issue in handling lockable objects wrapped in smart pointers after
merging from the trunk (on which a call to an overloaded 'operator->'
is now represented as an 'operator.' in tree IR). The patch was
bootstrapped and tested on i686-linux-gnu.

Le-chun

2008-12-18  Le-Chun Wu  <lcwu@google.com>

        * tree-threadsafe-analyze.c (get_canonical_expr): Fix an issue in
        handling lockable objects wrapped in smart pointers.


Index: gcc/tree-threadsafe-analyze.c
===================================================================
--- gcc/tree-threadsafe-analyze.c       (revision 142822)
+++ gcc/tree-threadsafe-analyze.c       (working copy)
@@ -780,13 +780,15 @@ get_canonical_expr (tree lock, tree base
                        auto_ptr<Mutex> mu;
                        mu->Lock();

-                     We would like to ignore the "operator->" and simply
-                     return mu. We also treat the "get" method of a smart
-                     pointer the same as operator->.  */
+                     We would like to ignore the "operator->" (or "operator.")
+                     and simply return mu. We also treat the "get" method of
+                     a smart pointer the same as operator->.  */
                   else if (fdecl
                            && ((DECL_NAME (fdecl)
                                 == maybe_get_identifier ("operator->"))
                                || (DECL_NAME (fdecl)
+                                   == maybe_get_identifier ("operator."))
+                               || (DECL_NAME (fdecl)
                                    == maybe_get_identifier ("get")))
                            && POINTER_TYPE_P (TREE_TYPE (lock))
                            && lookup_attribute ("lockable", TYPE_ATTRIBUTES (


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]