r215704 - Adding const-qualifiers to auto declarations. NFC.
David Blaikie
dblaikie at gmail.com
Fri Aug 15 08:56:24 PDT 2014
On Fri, Aug 15, 2014 at 5:29 AM, Aaron Ballman <aaron at aaronballman.com> wrote:
> Author: aaronballman
> Date: Fri Aug 15 07:29:39 2014
> New Revision: 215704
>
> URL: http://llvm.org/viewvc/llvm-project?rev=215704&view=rev
> Log:
> Adding const-qualifiers to auto declarations. NFC.
Could be interesting to see if we could get a clang-tidy check for
'const' and '*' on auto whenever possible - though I wonder how
careful we'd have to be about false positives (you don't really want
to write a vector iterator as 'auto *', for example)
- David
>
> Modified:
> cfe/trunk/lib/Analysis/ThreadSafety.cpp
>
> Modified: cfe/trunk/lib/Analysis/ThreadSafety.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/ThreadSafety.cpp?rev=215704&r1=215703&r2=215704&view=diff
> ==============================================================================
> --- cfe/trunk/lib/Analysis/ThreadSafety.cpp (original)
> +++ cfe/trunk/lib/Analysis/ThreadSafety.cpp Fri Aug 15 07:29:39 2014
> @@ -1337,10 +1337,10 @@ void BuildLockset::checkAccess(const Exp
> if (Analyzer->Handler.issueBetaWarnings()) {
> // Local variables of reference type cannot be re-assigned;
> // map them to their initializer.
> - while (auto *DRE = dyn_cast<DeclRefExpr>(Exp)) {
> - auto *VD = dyn_cast<VarDecl>(DRE->getDecl()->getCanonicalDecl());
> + while (const auto *DRE = dyn_cast<DeclRefExpr>(Exp)) {
> + const auto *VD = dyn_cast<VarDecl>(DRE->getDecl()->getCanonicalDecl());
> if (VD && VD->isLocalVarDecl() && VD->getType()->isReferenceType()) {
> - if (auto *E = VD->getInit()) {
> + if (const auto *E = VD->getInit()) {
> Exp = E;
> continue;
> }
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
More information about the cfe-commits
mailing list