r205915 - Thread Safety Analysis: some minor cleanups to the latest thread safety changes. No functional changes intended.

Aaron Ballman aaron at aaronballman.com
Wed Apr 9 14:47:03 PDT 2014


On Wed, Apr 9, 2014 at 5:33 PM, Justin Bogner <mail at justinbogner.com> wrote:
> Aaron Ballman <aaron at aaronballman.com> writes:
>> Thread Safety Analysis: some minor cleanups to the latest thread
>> safety changes. No functional changes intended.
>>
>> * Adds an iterator_range interface to CallExpr to get the arguments
>> * Modifies SExpr such that it must be allocated in the Arena, and
>> cannot be deleted
>> * Minor const-correctness and nullptr updates
>> * Adds some operator!= implementations to complement operator==
>> * Removes unused functionality
>>
>> Modified:
>>     cfe/trunk/include/clang/AST/Expr.h
>>     cfe/trunk/include/clang/Analysis/Analyses/ThreadSafetyCommon.h
>>     cfe/trunk/include/clang/Analysis/Analyses/ThreadSafetyTIL.h
>>     cfe/trunk/lib/Analysis/ThreadSafetyCommon.cpp
>  ...
>> Modified: cfe/trunk/include/clang/Analysis/Analyses/ThreadSafetyTIL.h
>> URL:
>>     http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Analysis/Analyses/ThreadSafetyTIL.h?rev=205915&r1=205914&r2=205915&view=diff
>> ==============================================================================
>> --- cfe/trunk/include/clang/Analysis/Analyses/ThreadSafetyTIL.h (original)
>> +++ cfe/trunk/include/clang/Analysis/Analyses/ThreadSafetyTIL.h Wed Apr  9 12:45:44 2014
>  ...
>>  // Contains various helper functions for SExprs.
>> -class ThreadSafetyTIL {
>> -public:
>> -  static const int MaxOpcode = COP_MAX;
>> -
>> -  static inline bool isTrivial(SExpr *E) {
>> -    unsigned Op = E->opcode();
>> -    return Op == COP_Variable || Op == COP_Literal || Op == COP_LiteralPtr;
>> -  }
>> -
>> -  static inline bool isLargeValue(SExpr *E) {
>> -    unsigned Op = E->opcode();
>> -    return (Op >= COP_Function && Op <= COP_Code);
>> -  }
>> -};
>> -
>> +namespace ThreadSafetyTIL {
>> +static bool isTrivial(SExpr *E) {
>> +  unsigned Op = E->opcode();
>> +  return Op == COP_Variable || Op == COP_Literal || Op == COP_LiteralPtr;
>> +}
>> +}
>
> I don't think isTrivial should be static. I'm getting a warning about
> this being an unused function during the compile of ThreadSafety.cpp
> after this change.

I agree -- I guess MSVC doesn't warn about this. I've switched back to
a class-scope static in r205931 -- thank you for the heads up!

~Aaron



More information about the cfe-commits mailing list