diff options
| author | Rafael Espindola <rafael.espindola@gmail.com> | 2013-10-19 16:55:03 +0000 |
|---|---|---|
| committer | Rafael Espindola <rafael.espindola@gmail.com> | 2013-10-19 16:55:03 +0000 |
| commit | 87bcee88d9b49de8214aa23d07c96f7bec3198e0 (patch) | |
| tree | 9881213fce950b290c585c965a5dc5665487a311 /lib/Analysis/ThreadSafety.cpp | |
| parent | e6ddd7f610cf6caf3b5691b0f3d60e00e8c95741 (diff) | |
| download | clang-87bcee88d9b49de8214aa23d07c96f7bec3198e0.tar.gz clang-87bcee88d9b49de8214aa23d07c96f7bec3198e0.tar.bz2 clang-87bcee88d9b49de8214aa23d07c96f7bec3198e0.tar.xz | |
Simplify some implementations of get*Decl.
* NamedDecl and CXXMethodDecl were missing getMostRecentDecl.
* The const version can just forward to the non const.
* getMostRecentDecl can use cast instead of cast_or_null.
This then removes some casts from the callers.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@193039 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/ThreadSafety.cpp')
| -rw-r--r-- | lib/Analysis/ThreadSafety.cpp | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/lib/Analysis/ThreadSafety.cpp b/lib/Analysis/ThreadSafety.cpp index d0655878c7..e5e5f18b51 100644 --- a/lib/Analysis/ThreadSafety.cpp +++ b/lib/Analysis/ThreadSafety.cpp @@ -323,8 +323,7 @@ private: } else if (const CXXMemberCallExpr *CMCE = dyn_cast<CXXMemberCallExpr>(Exp)) { // When calling a function with a lock_returned attribute, replace // the function call with the expression in lock_returned. - const CXXMethodDecl* MD = - cast<CXXMethodDecl>(CMCE->getMethodDecl()->getMostRecentDecl()); + const CXXMethodDecl *MD = CMCE->getMethodDecl()->getMostRecentDecl(); if (LockReturnedAttr* At = MD->getAttr<LockReturnedAttr>()) { CallingContext LRCallCtx(CMCE->getMethodDecl()); LRCallCtx.SelfArg = CMCE->getImplicitObjectArgument(); @@ -353,8 +352,7 @@ private: NodeVec[Root].setSize(Sz + 1); return Sz + 1; } else if (const CallExpr *CE = dyn_cast<CallExpr>(Exp)) { - const FunctionDecl* FD = - cast<FunctionDecl>(CE->getDirectCallee()->getMostRecentDecl()); + const FunctionDecl *FD = CE->getDirectCallee()->getMostRecentDecl(); if (LockReturnedAttr* At = FD->getAttr<LockReturnedAttr>()) { CallingContext LRCallCtx(CE->getDirectCallee()); LRCallCtx.NumArgs = CE->getNumArgs(); |
