From 68c7fcdaf1e694f4d1c6f6e9246d53cc12813fb6 Mon Sep 17 00:00:00 2001 From: Aaron Puchert Date: Thu, 23 Aug 2018 21:13:32 +0000 Subject: [PATCH] Remove unnecessary const_cast [NFC] This required adding a few const specifiers on functions. Also a minor formatting fix suggested in D49885. llvm-svn: 340575 --- clang/lib/Analysis/ThreadSafety.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/clang/lib/Analysis/ThreadSafety.cpp b/clang/lib/Analysis/ThreadSafety.cpp index 67eb626..b9dc0dd 100644 --- a/clang/lib/Analysis/ThreadSafety.cpp +++ b/clang/lib/Analysis/ThreadSafety.cpp @@ -929,9 +929,9 @@ public: CapabilityExpr UnderCp(UnderlyingMutex, false); // We're relocking the underlying mutexes. Warn on double locking. - if (FSet.findLock(FactMan, UnderCp)) + if (FSet.findLock(FactMan, UnderCp)) { Handler.handleDoubleLock(DiagKind, UnderCp.toString(), entry.loc()); - else { + } else { FSet.removeLock(FactMan, !UnderCp); FSet.addLock(FactMan, llvm::make_unique( UnderCp, entry.kind(), entry.loc())); @@ -1002,11 +1002,11 @@ public: StringRef DiagKind); template - void getMutexIDs(CapExprSet &Mtxs, AttrType *Attr, Expr *Exp, + void getMutexIDs(CapExprSet &Mtxs, AttrType *Attr, const Expr *Exp, const NamedDecl *D, VarDecl *SelfDecl = nullptr); template - void getMutexIDs(CapExprSet &Mtxs, AttrType *Attr, Expr *Exp, + void getMutexIDs(CapExprSet &Mtxs, AttrType *Attr, const Expr *Exp, const NamedDecl *D, const CFGBlock *PredBlock, const CFGBlock *CurrBlock, Expr *BrE, bool Neg); @@ -1315,7 +1315,7 @@ void ThreadSafetyAnalyzer::removeLock(FactSet &FSet, const CapabilityExpr &Cp, /// and push them onto Mtxs, discarding any duplicates. template void ThreadSafetyAnalyzer::getMutexIDs(CapExprSet &Mtxs, AttrType *Attr, - Expr *Exp, const NamedDecl *D, + const Expr *Exp, const NamedDecl *D, VarDecl *SelfDecl) { if (Attr->args_size() == 0) { // The mutex held is the "this" object. @@ -1347,7 +1347,7 @@ void ThreadSafetyAnalyzer::getMutexIDs(CapExprSet &Mtxs, AttrType *Attr, /// any duplicates. template void ThreadSafetyAnalyzer::getMutexIDs(CapExprSet &Mtxs, AttrType *Attr, - Expr *Exp, const NamedDecl *D, + const Expr *Exp, const NamedDecl *D, const CFGBlock *PredBlock, const CFGBlock *CurrBlock, Expr *BrE, bool Neg) { @@ -1460,7 +1460,7 @@ void ThreadSafetyAnalyzer::getEdgeLockset(FactSet& Result, const LocalVarContext &LVarCtx = PredBlockInfo->ExitContext; StringRef CapDiagKind = "mutex"; - auto *Exp = const_cast(getTrylockCallExpr(Cond, LVarCtx, Negate)); + const auto *Exp = getTrylockCallExpr(Cond, LVarCtx, Negate); if (!Exp) return; -- 2.7.4