r199949 - Thread safety analysis: handle duplicate assert_lock attributes.

Aaron Ballman aaron at aaronballman.com
Thu Jan 23 14:42:54 PST 2014


Thank you for taking care of this!

~Aaron

On Thu, Jan 23, 2014 at 5:35 PM, DeLesley Hutchins <delesley at google.com> wrote:
> Author: delesley
> Date: Thu Jan 23 16:35:26 2014
> New Revision: 199949
>
> URL: http://llvm.org/viewvc/llvm-project?rev=199949&view=rev
> Log:
> Thread safety analysis: handle duplicate assert_lock attributes.
>
> Modified:
>     cfe/trunk/include/clang/Basic/Attr.td
>     cfe/trunk/test/SemaCXX/warn-thread-safety-analysis.cpp
>
> Modified: cfe/trunk/include/clang/Basic/Attr.td
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Attr.td?rev=199949&r1=199948&r2=199949&view=diff
> ==============================================================================
> --- cfe/trunk/include/clang/Basic/Attr.td (original)
> +++ cfe/trunk/include/clang/Basic/Attr.td Thu Jan 23 16:35:26 2014
> @@ -1180,6 +1180,7 @@ def AssertExclusiveLock : InheritableAtt
>    let LateParsed = 1;
>    let TemplateDependent = 1;
>    let ParseArgumentsAsUnevaluated = 1;
> +  let DuplicatesAllowedWhileMerging = 1;
>    let Subjects = SubjectList<[FunctionDefinition, FunctionTemplate]>;
>  }
>
> @@ -1189,6 +1190,7 @@ def AssertSharedLock : InheritableAttr {
>    let LateParsed = 1;
>    let TemplateDependent = 1;
>    let ParseArgumentsAsUnevaluated = 1;
> +  let DuplicatesAllowedWhileMerging = 1;
>    let Subjects = SubjectList<[FunctionDefinition, FunctionTemplate]>;
>  }
>
>
> Modified: cfe/trunk/test/SemaCXX/warn-thread-safety-analysis.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/warn-thread-safety-analysis.cpp?rev=199949&r1=199948&r2=199949&view=diff
> ==============================================================================
> --- cfe/trunk/test/SemaCXX/warn-thread-safety-analysis.cpp (original)
> +++ cfe/trunk/test/SemaCXX/warn-thread-safety-analysis.cpp Thu Jan 23 16:35:26 2014
> @@ -3616,8 +3616,14 @@ class Foo {
>                         EXCLUSIVE_TRYLOCK_FUNCTION(true, mu2_);
>    bool readertrylock() SHARED_TRYLOCK_FUNCTION(true, mu1_)
>                         SHARED_TRYLOCK_FUNCTION(true, mu2_);
> +  void assertBoth() ASSERT_EXCLUSIVE_LOCK(mu1_)
> +                    ASSERT_EXCLUSIVE_LOCK(mu2_);
> +  void assertShared() ASSERT_SHARED_LOCK(mu1_)
> +                      ASSERT_SHARED_LOCK(mu2_);
>
>    void test();
> +  void testAssert();
> +  void testAssertShared();
>  };
>
>
> @@ -3676,6 +3682,21 @@ void Foo::test() {
>    }
>  }
>
> +// Force duplication of attributes
> +void Foo::assertBoth() { }
> +void Foo::assertShared() { }
> +
> +void Foo::testAssert() {
> +  assertBoth();
> +  a = 0;
> +  b = 0;
> +}
> +
> +void Foo::testAssertShared() {
> +  assertShared();
> +  int zz = a + b;
> +}
> +
>
>  }  // end namespace MultipleAttributeTest
>
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits



More information about the cfe-commits mailing list