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 | 7b56f6c3c28ac5e1c2aee2a21effa18562868d49 (patch) | |
tree | 2b025780021c8d0d16b176ce763d2cc766467414 /clang/lib/Analysis/ThreadSafety.cpp | |
parent | 6ddca57327ca65fdbc9dd55ef59d14f59c566f79 (diff) | |
download | bcm5719-llvm-7b56f6c3c28ac5e1c2aee2a21effa18562868d49.tar.gz bcm5719-llvm-7b56f6c3c28ac5e1c2aee2a21effa18562868d49.zip |
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.
llvm-svn: 193039
Diffstat (limited to 'clang/lib/Analysis/ThreadSafety.cpp')
-rw-r--r-- | clang/lib/Analysis/ThreadSafety.cpp | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/clang/lib/Analysis/ThreadSafety.cpp b/clang/lib/Analysis/ThreadSafety.cpp index d0655878c7c..e5e5f18b515 100644 --- a/clang/lib/Analysis/ThreadSafety.cpp +++ b/clang/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(); |