Aliasing.h 972 B

1234567891011121314151617181920212223242526272829303132
  1. //===------------- Aliasing.h - clang-tidy --------------------------------===//
  2. //
  3. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  4. // See https://llvm.org/LICENSE.txt for license information.
  5. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  6. //
  7. //===----------------------------------------------------------------------===//
  8. #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_UTILS_ALIASING_H
  9. #define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_UTILS_ALIASING_H
  10. #include "clang/AST/Decl.h"
  11. namespace clang::tidy::utils {
  12. /// Returns whether \p Var has a pointer or reference in \p Func.
  13. ///
  14. /// Example:
  15. /// void f() {
  16. /// int n;
  17. /// ...
  18. /// int *p = &n;
  19. /// }
  20. ///
  21. /// For `f()` and `n` the function returns ``true`` because `p` is a
  22. /// pointer to `n` created in `f()`.
  23. bool hasPtrOrReferenceInFunc(const Decl *Func, const VarDecl *Var);
  24. } // namespace clang::tidy::utils
  25. #endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_UTILS_ALIASING_H