2016-03-06 05:17:58 +08:00
|
|
|
//===--- DeclRefExprUtils.h - clang-tidy-------------------------*- C++ -*-===//
|
|
|
|
//
|
2019-01-19 16:50:56 +08:00
|
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
2016-03-06 05:17:58 +08:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_UTILS_DECLREFEXPRUTILS_H
|
|
|
|
#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_UTILS_DECLREFEXPRUTILS_H
|
|
|
|
|
|
|
|
#include "clang/AST/ASTContext.h"
|
|
|
|
#include "clang/AST/Type.h"
|
2016-07-02 04:12:15 +08:00
|
|
|
#include "llvm/ADT/SmallPtrSet.h"
|
2016-03-06 05:17:58 +08:00
|
|
|
|
|
|
|
namespace clang {
|
|
|
|
namespace tidy {
|
2016-05-03 10:54:05 +08:00
|
|
|
namespace utils {
|
|
|
|
namespace decl_ref_expr {
|
2016-03-06 05:17:58 +08:00
|
|
|
|
Remove \brief commands from doxygen comments.
Summary:
We've been running doxygen with the autobrief option for a couple of
years now. This makes the \brief markers into our comments
redundant. Since they are a visual distraction and we don't want to
encourage more \brief markers in new code either, this patch removes
them all.
Patch produced by
for i in $(git grep -l '\\brief'); do perl -pi -e 's/\\brief //g' $i & done
[This is analogous to LLVM r331272 and CFE r331834]
Subscribers: srhines, nemanjai, javed.absar, kbarton, MaskRay, jkorous, arphaman, jfb, kadircet, jsji, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D66578
llvm-svn: 369643
2019-08-22 19:32:57 +08:00
|
|
|
/// Returns true if all ``DeclRefExpr`` to the variable within ``Stmt``
|
2016-06-17 19:43:33 +08:00
|
|
|
/// do not modify it.
|
2016-03-06 05:17:58 +08:00
|
|
|
///
|
2016-06-17 19:43:33 +08:00
|
|
|
/// Returns ``true`` if only const methods or operators are called on the
|
|
|
|
/// variable or the variable is a const reference or value argument to a
|
|
|
|
/// ``callExpr()``.
|
2016-03-06 05:17:58 +08:00
|
|
|
bool isOnlyUsedAsConst(const VarDecl &Var, const Stmt &Stmt,
|
|
|
|
ASTContext &Context);
|
|
|
|
|
2017-01-03 20:10:44 +08:00
|
|
|
/// Returns set of all ``DeclRefExprs`` to ``VarDecl`` within ``Stmt``.
|
2016-07-02 04:12:15 +08:00
|
|
|
llvm::SmallPtrSet<const DeclRefExpr *, 16>
|
|
|
|
allDeclRefExprs(const VarDecl &VarDecl, const Stmt &Stmt, ASTContext &Context);
|
|
|
|
|
2017-01-03 20:10:44 +08:00
|
|
|
/// Returns set of all ``DeclRefExprs`` to ``VarDecl`` within ``Decl``.
|
|
|
|
llvm::SmallPtrSet<const DeclRefExpr *, 16>
|
|
|
|
allDeclRefExprs(const VarDecl &VarDecl, const Decl &Decl, ASTContext &Context);
|
|
|
|
|
|
|
|
/// Returns set of all ``DeclRefExprs`` to ``VarDecl`` within ``Stmt`` where
|
|
|
|
/// ``VarDecl`` is guaranteed to be accessed in a const fashion.
|
2016-07-02 04:12:15 +08:00
|
|
|
llvm::SmallPtrSet<const DeclRefExpr *, 16>
|
|
|
|
constReferenceDeclRefExprs(const VarDecl &VarDecl, const Stmt &Stmt,
|
|
|
|
ASTContext &Context);
|
|
|
|
|
2017-01-03 20:10:44 +08:00
|
|
|
/// Returns ``true`` if ``DeclRefExpr`` is the argument of a copy-constructor
|
|
|
|
/// call expression within ``Decl``.
|
|
|
|
bool isCopyConstructorArgument(const DeclRefExpr &DeclRef, const Decl &Decl,
|
2016-07-02 04:12:15 +08:00
|
|
|
ASTContext &Context);
|
|
|
|
|
2017-01-03 20:10:44 +08:00
|
|
|
/// Returns ``true`` if ``DeclRefExpr`` is the argument of a copy-assignment
|
|
|
|
/// operator CallExpr within ``Decl``.
|
|
|
|
bool isCopyAssignmentArgument(const DeclRefExpr &DeclRef, const Decl &Decl,
|
2016-07-02 04:12:15 +08:00
|
|
|
ASTContext &Context);
|
|
|
|
|
2016-05-03 10:54:05 +08:00
|
|
|
} // namespace decl_ref_expr
|
|
|
|
} // namespace utils
|
2016-03-06 05:17:58 +08:00
|
|
|
} // namespace tidy
|
|
|
|
} // namespace clang
|
|
|
|
|
|
|
|
#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_UTILS_DECLREFEXPRUTILS_H
|