diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/clang/Basic/Attr.td | 14 | ||||
-rw-r--r-- | include/clang/Basic/DiagnosticSemaKinds.td | 19 | ||||
-rw-r--r-- | include/clang/Sema/AnalysisBasedWarnings.h | 1 |
3 files changed, 33 insertions, 1 deletions
diff --git a/include/clang/Basic/Attr.td b/include/clang/Basic/Attr.td index 2b0ed3d669..fb3ba02575 100644 --- a/include/clang/Basic/Attr.td +++ b/include/clang/Basic/Attr.td @@ -55,6 +55,7 @@ class FunctionArgument<string name> : Argument<name>; class TypeArgument<string name> : Argument<name>; class UnsignedArgument<string name> : Argument<name>; class VariadicUnsignedArgument<string name> : Argument<name>; +class VariadicExprArgument<string name> : Argument<name>; // A version of the form major.minor[.subminor]. class VersionArgument<string name> : Argument<name>; @@ -564,52 +565,65 @@ def NoThreadSafetyAnalysis : InheritableAttr { def GuardedBy : InheritableAttr { let Spellings = ["guarded_by"]; + let Args = [ExprArgument<"Arg">]; } def PtGuardedBy : InheritableAttr { let Spellings = ["pt_guarded_by"]; + let Args = [ExprArgument<"Arg">]; } def AcquiredAfter : InheritableAttr { let Spellings = ["acquired_after"]; + let Args = [VariadicExprArgument<"Args">]; } def AcquiredBefore : InheritableAttr { let Spellings = ["acquired_before"]; + let Args = [VariadicExprArgument<"Args">]; } def ExclusiveLockFunction : InheritableAttr { let Spellings = ["exclusive_lock_function"]; + let Args = [VariadicExprArgument<"Args">]; } def SharedLockFunction : InheritableAttr { let Spellings = ["shared_lock_function"]; + let Args = [VariadicExprArgument<"Args">]; } def ExclusiveTrylockFunction : InheritableAttr { let Spellings = ["exclusive_trylock_function"]; + let Args = [VariadicExprArgument<"Args">]; } def SharedTrylockFunction : InheritableAttr { let Spellings = ["shared_trylock_function"]; + let Args = [VariadicExprArgument<"Args">]; } def UnlockFunction : InheritableAttr { let Spellings = ["unlock_function"]; + let Args = [VariadicExprArgument<"Args">]; } def LockReturned : InheritableAttr { let Spellings = ["lock_returned"]; + let Args = [ExprArgument<"Arg">]; } def LocksExcluded : InheritableAttr { let Spellings = ["locks_excluded"]; + let Args = [VariadicExprArgument<"Args">]; } def ExclusiveLocksRequired : InheritableAttr { let Spellings = ["exclusive_locks_required"]; + let Args = [VariadicExprArgument<"Args">]; } def SharedLocksRequired : InheritableAttr { let Spellings = ["shared_locks_required"]; + let Args = [VariadicExprArgument<"Args">]; } diff --git a/include/clang/Basic/DiagnosticSemaKinds.td b/include/clang/Basic/DiagnosticSemaKinds.td index 89ffebbbab..0ded2fb3e4 100644 --- a/include/clang/Basic/DiagnosticSemaKinds.td +++ b/include/clang/Basic/DiagnosticSemaKinds.td @@ -1383,7 +1383,24 @@ def err_attribute_argument_not_lockable : Error< def err_attribute_decl_not_lockable : Error< "%0 attribute can only be applied in a context annotated " "with 'lockable' attribute">; - +def warn_unlock_but_no_acquire : Warning< + "unlocking '%0' that was not acquired">, + InGroup<DiagGroup<"thread-safety">>, DefaultIgnore; +def warn_double_lock : Warning< + "locking '%0' that is already acquired">, + InGroup<DiagGroup<"thread-safety">>, DefaultIgnore; +def warn_function_requires_lock : Warning< + "calling function '%0' requires lock '%0'">, + InGroup<DiagGroup<"thread-safety">>, DefaultIgnore; +def warn_locks_not_released : Warning< + "lock '%0' is not released at the end of function '%1'">, + InGroup<DiagGroup<"thread-safety">>, DefaultIgnore; +def warn_lock_not_released_in_scope : Warning< + "lock '%0' is not released at the end of its scope">, + InGroup<DiagGroup<"thread-safety">>, DefaultIgnore; +def warn_expecting_lock_held_on_loop : Warning< + "expecting lock '%0' to be held at start of each loop">, + InGroup<DiagGroup<"thread-safety">>, DefaultIgnore; def warn_impcast_vector_scalar : Warning< "implicit conversion turns vector to scalar: %0 to %1">, diff --git a/include/clang/Sema/AnalysisBasedWarnings.h b/include/clang/Sema/AnalysisBasedWarnings.h index 8e781cd521..eeac97332d 100644 --- a/include/clang/Sema/AnalysisBasedWarnings.h +++ b/include/clang/Sema/AnalysisBasedWarnings.h @@ -37,6 +37,7 @@ public: // The warnings to run. unsigned enableCheckFallThrough : 1; unsigned enableCheckUnreachable : 1; + unsigned enableThreadSafetyAnalysis : 1; public: Policy(); void disableCheckFallThrough() { enableCheckFallThrough = 0; } |