зеркало из https://github.com/microsoft/clang.git
Thread Safety: adding basic no thread safety analysis option
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139310 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
978191e090
Коммит
af37061fea
|
@ -1305,6 +1305,8 @@ static void warnBackEdgeUnequalLocksets(Sema &S, const Lockset LoopReentrySet,
|
|||
static void checkThreadSafety(Sema &S, AnalysisContext &AC) {
|
||||
CFG *CFGraph = AC.getCFG();
|
||||
if (!CFGraph) return;
|
||||
const Decl *D = AC.getDecl();
|
||||
if (D && D->getAttr<NoThreadSafetyAnalysisAttr>()) return;
|
||||
|
||||
Lockset::Factory LocksetFactory;
|
||||
|
||||
|
|
|
@ -314,6 +314,10 @@ class GBFoo {
|
|||
gb_field = 0; // \
|
||||
// expected-warning {{writing variable 'gb_field' requires lock 'sls_mu' to be held exclusively}}
|
||||
}
|
||||
|
||||
void testNoAnal() __attribute__((no_thread_safety_analysis)) {
|
||||
gb_field = 0;
|
||||
}
|
||||
};
|
||||
|
||||
GBFoo GlobalGBFoo __attribute__((guarded_by(sls_mu)));
|
||||
|
@ -570,6 +574,12 @@ void es_fun_7() {
|
|||
sls_mu.Unlock();
|
||||
}
|
||||
|
||||
void es_fun_8() __attribute__((no_thread_safety_analysis));
|
||||
|
||||
void es_fun_8() {
|
||||
Bar.aa_elr_fun_s();
|
||||
}
|
||||
|
||||
void es_bad_0() {
|
||||
Bar.aa_elr_fun(); // \
|
||||
// expected-warning {{calling function 'aa_elr_fun' requires exclusive lock 'aa_mu'}}
|
||||
|
|
Загрузка…
Ссылка в новой задаче