ronantakizawa/codereview-bench huggingface dataset:
Repository: llvm/llvm-project
File: clang/test/SemaCXX/typeid-incomplete-local-crash.cpp (C++)

Code before:
// RUN: %clang_cc1 -std=c++17 -fsyntax-only -verify %s

namespace std {
class type_info;
}

namespace gh176397 {
auto recursiveLambda = [](auto, int) {
  struct S; // expected-note {{forward declaration of 'S'}}
  typeid(*static_cast<S *>(nullptr)); // expected-error {{'typeid' of incomplete type 'S'}}
};

void test() {
  recursiveLambda(recursiveLambda, 10); // expected-note {{in instantiation of function template specialization}}
}
} // namespace gh176397

namespace gh63242 {
struct scoped {
  enum class scoped2 {
    RED,
    YELLOW,
    GREEN
  };
};

template <auto N>
struct scoped_struct {
  void f() {
    class scoped2 e = scoped::scoped2::RED; // expected-error {{implicit instantiation of undefined member 'scoped2'}} expected-note {{member is declared here}} expected-note {{forward declaration of 'scoped2'}}
    (void)typeid(e); // expected-error {{'typeid' of incomplete type 'class scoped2'}}
  }
};

void test() {
  scoped_struct<scoped::scoped2::RED> s;
  s.f(); // expected-note {{in instantiation of member function 'gh63242::scoped_struct<gh63242::scoped::scoped2::RED>::f' requested here}}
}
} // namespace gh63242

Review comment (suggestion):
Put the  notes (using bookmarks, see [VerifyDiagnostic](https://clang.llvm.org/docs/InternalsManual.html#verifying-diagnostics)) next to the errors they are associated with, not on the actual line.

Code after:
// RUN: %clang_cc1 -std=c++17 -fsyntax-only -verify %s

namespace std {
class type_info;
}

namespace gh176397 {
auto recursiveLambda = [](auto, int) {
  struct S; // #S-fwd
  typeid(*static_cast<S *>(nullptr));
  // expected-error@-1 {{'typeid' of incomplete type 'S'}}
  // expected-note@#S-fwd {{forward declaration of 'S'}}
  // expected-note@#call {{in instantiation of function template specialization}}
};

void test() {
  recursiveLambda(recursiveLambda, 10); // #call
}
} // namespace gh176397

namespace gh63242 {
struct scoped {
  enum class scoped2 {
    RED,
    YELLOW,
    GREEN
  };
};

template <auto N>
struct scoped_struct {
  void f() {
    class scoped2 e = scoped::scoped2::RED; // #scoped2-fwd
    // expected-error@-1 {{implicit instantiation of undefined member 'scoped2'}}
    // expected-note@#scoped2-fwd {{member is declared here}}
    // expected-note@#f-call {{in instantiation of member function 'gh63242::scoped_struct<gh63242::scoped::scoped2::RED>::f' requested here}}

    (void)typeid(e);
    // expected-error@-1 {{'typeid' of incomplete type 'class scoped2'}}
Repository: llvm/llvm-project
File: clang/test/SemaCXX/vector.cpp (C++)

Code before:
struct DiagTruncDependentType {
  float4 f(float4 x) {
    // expected-error@+1{{as implicit conversion would cause truncation}}
    return k * x;
  }
  static constexpr T k = 1340282346638528859811704183484516925443.000000;
};

template <typename T>
struct PR45298 {
    T k1 = T(0);
};

// Ensure this no longer asserts.
template <typename T>
struct PR45298Consumer {
  float4 f(float4 x) {
    return (float)s.k1 * x;
  }

  PR45298<T> s;
};

constexpr int PR180563(int __attribute__((vector_size(8))) v) {
  return v[~0UL];
}
#endif // __cplusplus >= 201103L

void use() {
  float4 theFloat4;
  NormalMember<double>().f(theFloat4);
#if __cplusplus >= 201103L
  ConstantValueNoDiag<double>().f(theFloat4);
  ConstantValueNoDiagDependentValue<double, 1>().f(theFloat4);
  DiagTrunc<double>().f(theFloat4);
  // expected-note@+1{{in instantiation of member function}}
  DiagTruncDependentValue<double, 0>().f(theFloat4);
  // expected-note@+1{{in instantiation of member function}}
  DiagTruncDependentType<double>().f(theFloat4);
  PR45298Consumer<double>().f(theFloat4);
#endif // __cplusplus >= 201103L
}
}

namespace rdar60092165 {
template <class T> void f() {
  typedef T first_type __attribute__((vector_size(sizeof(T) * 4)));
  typedef T second_type __attribute__((vector_size(sizeof(T) * 4)));

  second_type st;
}

Review comment (suggestion):
You should add a call to the constexpr function so that the constexpr engine is definitely run on it; a `static_assert` would work. I'd expect to still get a diagnostic: https://godbolt.org/z/Yhv6qKss4

Code after:
struct DiagTruncDependentType {
  float4 f(float4 x) {
    // expected-error@+1{{as implicit conversion would cause truncation}}
    return k * x;
  }
  static constexpr T k = 1340282346638528859811704183484516925443.000000;
};

template <typename T>
struct PR45298 {
    T k1 = T(0);
};

// Ensure this no longer asserts.
template <typename T>
struct PR45298Consumer {
  float4 f(float4 x) {
    return (float)s.k1 * x;
  }

  PR45298<T> s;
};
#endif // __cplusplus >= 201103L

void use() {
  float4 theFloat4;
  NormalMember<double>().f(theFloat4);
#if __cplusplus >= 201103L
  ConstantValueNoDiag<double>().f(theFloat4);
  ConstantValueNoDiagDependentValue<double, 1>().f(theFloat4);
  DiagTrunc<double>().f(theFloat4);
  // expected-note@+1{{in instantiation of member function}}
  DiagTruncDependentValue<double, 0>().f(theFloat4);
  // expected-note@+1{{in instantiation of member function}}
  DiagTruncDependentType<double>().f(theFloat4);
  PR45298Consumer<double>().f(theFloat4);
#endif // __cplusplus >= 201103L
}
}

namespace rdar60092165 {
template <class T> void f() {
  typedef T first_type __attribute__((vector_size(sizeof(T) * 4)));
  typedef T second_type __attribute__((vector_size(sizeof(T) * 4)));

  second_type st;
}
}

namespace PR45780 {
enum E { Value = 15 };
Repository: llvm/llvm-project
File: libc/src/__support/math/tanpif16.h (C/C++)

Code before:
  //   k = round(x * 32)
  //   y = x * 32 - k
  //
  // Once k and y are computed, we then deduce the answer by the formula:
  // tan(x) = sin(x) / cos(x)
  //        = (sin_y * cos_k + cos_y * sin_k) / (cos_y * cos_k - sin_y * sin_k)
  float xf = x;
  float sin_k = 0, cos_k = 0, sin_y = 0, cosm1_y = 0;
  sincospif16_eval(xf, sin_k, cos_k, sin_y, cosm1_y);

  if (LIBC_UNLIKELY(sin_y == 0 && cos_k == 0)) {
    fputil::set_errno_if_required(EDOM);
    fputil::raise_except_if_required(FE_DIVBYZERO);

    int16_t x_mp5_u = static_cast<int16_t>(x - 0.5);
    return ((x_mp5_u & 0x1) ? -1 : 1) * FPBits::inf().get_val();
  }

  using fputil::multiply_add;
  return fputil::cast<float16>(
      multiply_add(sin_y, cos_k, multiply_add(cosm1_y, sin_k, sin_k)) /
      multiply_add(sin_y, -sin_k, multiply_add(cosm1_y, cos_k, cos_k)));
}
} // namespace math
} // namespace LIBC_NAMESPACE_DECL

#endif // LIBC_TYPES_HAS_FLOAT16
#endif // LLVM_LIBC_SRC___SUPPORT_MATH_TANPIF16_H


Review comment (suggestion):
```suggestion
}

} // namespace math
} // namespace LIBC_NAMESPACE_DECL
```

Code after:
  //   k = round(x * 32)
  //   y = x * 32 - k
  //
  // Once k and y are computed, we then deduce the answer by the formula:
  // tan(x) = sin(x) / cos(x)
  //        = (sin_y * cos_k + cos_y * sin_k) / (cos_y * cos_k - sin_y * sin_k)
  float xf = x;
  float sin_k = 0, cos_k = 0, sin_y = 0, cosm1_y = 0;
  sincospif16_eval(xf, sin_k, cos_k, sin_y, cosm1_y);

  if (LIBC_UNLIKELY(sin_y == 0 && cos_k == 0)) {
    fputil::set_errno_if_required(EDOM);
    fputil::raise_except_if_required(FE_DIVBYZERO);

    int16_t x_mp5_u = static_cast<int16_t>(x - 0.5);
    return ((x_mp5_u & 0x1) ? -1 : 1) * FPBits::inf().get_val();
  }

  using fputil::multiply_add;
  return fputil::cast<float16>(
      multiply_add(sin_y, cos_k, multiply_add(cosm1_y, sin_k, sin_k)) /
      multiply_add(sin_y, -sin_k, multiply_add(cosm1_y, cos_k, cos_k)));
}

} // namespace math
} // namespace LIBC_NAMESPACE_DECL

#endif // LIBC_TYPES_HAS_FLOAT16

#endif // LLVM_LIBC_SRC___SUPPORT_MATH_TANPIF16_H
Repository: llvm/llvm-project
File: libc/src/__support/math/tanpif16.h (C/C++)

Code before:
//===-- Implementation header for tanpif16 ----------------------*- C++ -*-===//
//
// 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
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_LIBC_SRC___SUPPORT_MATH_TANPIF16_H
#define LLVM_LIBC_SRC___SUPPORT_MATH_TANPIF16_H

#include "include/llvm-libc-macros/float16-macros.h"

#ifdef LIBC_TYPES_HAS_FLOAT16

#include "hdr/errno_macros.h"
#include "hdr/fenv_macros.h"
#include "sincosf16_utils.h"
#include "src/__support/FPUtil/FEnvImpl.h"
#include "src/__support/FPUtil/FPBits.h"
#include "src/__support/FPUtil/cast.h"
#include "src/__support/FPUtil/except_value_utils.h"
#include "src/__support/FPUtil/multiply_add.h"
#include "src/__support/macros/optimization.h"

namespace LIBC_NAMESPACE_DECL {
namespace math {

LIBC_INLINE float16 tanpif16(float16 x) {
  using namespace sincosf16_internal;
  using FPBits = typename fputil::FPBits<float16>;
  FPBits xbits(x);

  uint16_t x_u = xbits.uintval();
  uint16_t x_abs = x_u & 0x7fff;

Review comment (suggestion):
```suggestion

#ifndef LLVM_LIBC_SRC___SUPPORT_MATH_TANPIF16_H
```

Code after:
//===-- Implementation header for tanpif16 ----------------------*- C++ -*-===//
//
// 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
//
//===----------------------------------------------------------------------===//

#ifndef LLVM_LIBC_SRC___SUPPORT_MATH_TANPIF16_H
#define LLVM_LIBC_SRC___SUPPORT_MATH_TANPIF16_H

#include "include/llvm-libc-macros/float16-macros.h"

#ifdef LIBC_TYPES_HAS_FLOAT16

#include "hdr/errno_macros.h"
#include "hdr/fenv_macros.h"
#include "sincosf16_utils.h"
#include "src/__support/FPUtil/FEnvImpl.h"
#include "src/__support/FPUtil/FPBits.h"
#include "src/__support/FPUtil/cast.h"
#include "src/__support/FPUtil/except_value_utils.h"
#include "src/__support/FPUtil/multiply_add.h"
#include "src/__support/macros/optimization.h"

namespace LIBC_NAMESPACE_DECL {
namespace math {

LIBC_INLINE float16 tanpif16(float16 x) {
  using namespace sincosf16_internal;
  using FPBits = typename fputil::FPBits<float16>;
  FPBits xbits(x);

  uint16_t x_u = xbits.uintval();
Repository: llvm/llvm-project
File: lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm.cpp (C++)

Code before:
  src += GetRegisterInfoInterface().GetGPRSize();
  ::memcpy(&m_fpr, src, sizeof(m_fpr));

  error = WriteFPR();
  if (error.Fail())
    return error;

  return error;
}

bool NativeRegisterContextLinux_arm::IsGPR(unsigned reg) const {
  if (GetRegisterInfo().GetRegisterSetFromRegisterIndex(reg) ==
      RegisterInfoPOSIX_arm::GPRegSet)
    return true;
  return false;
}

bool NativeRegisterContextLinux_arm::IsFPR(unsigned reg) const {
  if (GetRegisterInfo().GetRegisterSetFromRegisterIndex(reg) ==
      RegisterInfoPOSIX_arm::FPRegSet)
    return true;
  return false;
}

bool NativeRegisterContextLinux_arm::IsTLS(unsigned reg) const {
  if (GetRegisterInfo().GetRegisterSetFromRegisterIndex(reg) ==
      RegisterInfoPOSIX_arm::TLSRegSet)
    return true;
  return false;
}

llvm::Error NativeRegisterContextLinux_arm::ReadHardwareDebugInfo() {
  if (!m_refresh_hwdebug_info)
    return llvm::Error::success();

#ifdef __arm__
  unsigned int cap_val;
  Status error = NativeProcessLinux::PtraceWrapper(
      PTRACE_GETHBPREGS, m_thread.GetID(), nullptr, &cap_val,
      sizeof(unsigned int));

  if (error.Fail())
    return error.ToError();

  m_max_hwp_supported = (cap_val >> 8) & 0xff;
  m_max_hbp_supported = cap_val & 0xff;
  m_refresh_hwdebug_info = false;

  return error.ToError();
#else  // __aarch64__
  return arm64::ReadHardwareDebugInfo(m_thread.GetID(), m_max_hwp_supported,

Review comment (suggestion):
```
return GetRegisterInfo().GetRegisterSetFromRegisterIndex(reg) == RegisterInfoPOSIX_arm::TLSRegSet;
```

Code after:
  ::memcpy(&m_gpr_arm, src, GetRegisterInfoInterface().GetGPRSize());

  error = WriteGPR();
  if (error.Fail())
    return error;

  src += GetRegisterInfoInterface().GetGPRSize();
  ::memcpy(&m_fpr, src, sizeof(m_fpr));

  error = WriteFPR();
  if (error.Fail())
    return error;

  // Note: writing to a thread pointer register is not implemented.

  return error;
}

bool NativeRegisterContextLinux_arm::IsGPR(unsigned reg) const {
  if (GetRegisterInfo().GetRegisterSetFromRegisterIndex(reg) ==
      RegisterInfoPOSIX_arm::GPRegSet)
    return true;
  return false;
}

bool NativeRegisterContextLinux_arm::IsFPR(unsigned reg) const {
  if (GetRegisterInfo().GetRegisterSetFromRegisterIndex(reg) ==
      RegisterInfoPOSIX_arm::FPRegSet)
    return true;
  return false;
}

bool NativeRegisterContextLinux_arm::IsTLS(unsigned reg) const {
  return GetRegisterInfo().GetRegisterSetFromRegisterIndex(reg) ==
         RegisterInfoPOSIX_arm::TLSRegSet;
}

llvm::Error NativeRegisterContextLinux_arm::ReadHardwareDebugInfo() {
  if (!m_refresh_hwdebug_info)
    return llvm::Error::success();

#ifdef __arm__
  unsigned int cap_val;
  Status error = NativeProcessLinux::PtraceWrapper(
      PTRACE_GETHBPREGS, m_thread.GetID(), nullptr, &cap_val,
      sizeof(unsigned int));

  if (error.Fail())
    return error.ToError();

  m_max_hwp_supported = (cap_val >> 8) & 0xff;
Repository: llvm/llvm-project
File: lldb/source/Plugins/Process/Utility/RegisterInfos_arm.h (C/C++)

Code before:
    FPU_QREG(q3, 12),
    FPU_QREG(q4, 16),
    FPU_QREG(q5, 20),
    FPU_QREG(q6, 24),
    FPU_QREG(q7, 28),
    FPU_QREG(q8, 32),
    FPU_QREG(q9, 36),
    FPU_QREG(q10, 40),
    FPU_QREG(q11, 44),
    FPU_QREG(q12, 48),
    FPU_QREG(q13, 52),
    FPU_QREG(q14, 56),
    FPU_QREG(q15, 60),

    {
        "tpidruro",
        nullptr,
        4,
        0,
        eEncodingUint,
        eFormatHex,
        {LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_REGNUM_GENERIC_TP,
         LLDB_INVALID_REGNUM, tls_tpidruro},
        nullptr,
        nullptr,
        nullptr,
    },

    {
        "exception",
        nullptr,
        4,
        EXC_OFFSET(0),
        eEncodingUint,
        eFormatHex,
        {LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM,
         LLDB_INVALID_REGNUM, exc_exception},
        nullptr,
        nullptr,
        nullptr,
    },
    {
        "fsr",
        nullptr,
        4,
        EXC_OFFSET(1),
        eEncodingUint,
        eFormatHex,
        {LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM,
         LLDB_INVALID_REGNUM, exc_fsr},
        nullptr,

Review comment (suggestion):
I don't know too much about TLS on Arm but the gcc docs refer to 3 different registers that can be used (https://gcc.gnu.org/onlinedocs/gcc/ARM-Options.html, search for "-mtp=").

https://github.com/torvalds/linux/blob/9702969978695d9a699a1f34771580cdbb153b33/arch/arm/include/asm/tls.h#L96 uses coprocessor numbers that match https://developer.arm.com/documentation/ddi0487/maa/-Part-G-The-AArch32-System-Level-Architecture/-Chapter-G8-AArch32-System-Register-Descriptions/-G8-2-General-system-control-registers/-G8-2-163-TPIDRURO--PL0-Read-Only-Software-Thread-ID-Register.

And if it is working for you, that confirms it.


Code after:

    FPU_QREG(q0, 0),
    FPU_QREG(q1, 4),
    FPU_QREG(q2, 8),
    FPU_QREG(q3, 12),
    FPU_QREG(q4, 16),
    FPU_QREG(q5, 20),
    FPU_QREG(q6, 24),
    FPU_QREG(q7, 28),
    FPU_QREG(q8, 32),
    FPU_QREG(q9, 36),
    FPU_QREG(q10, 40),
    FPU_QREG(q11, 44),
    FPU_QREG(q12, 48),
    FPU_QREG(q13, 52),
    FPU_QREG(q14, 56),
    FPU_QREG(q15, 60),

    {
        "tpidruro",
        nullptr,
        4,
        TLS_OFFSET,
        eEncodingUint,
        eFormatHex,
        {LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_REGNUM_GENERIC_TP,
         LLDB_INVALID_REGNUM, tls_tpidruro},
        nullptr,
        nullptr,
        nullptr,
    },

    {
        "exception",
        nullptr,
        4,
        EXC_OFFSET(0),
        eEncodingUint,
        eFormatHex,
        {LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM,
         LLDB_INVALID_REGNUM, exc_exception},
        nullptr,
        nullptr,
        nullptr,
    },
    {
        "fsr",
        nullptr,
        4,
        EXC_OFFSET(1),
        eEncodingUint,
Repository: llvm/llvm-project
File: llvm/lib/Target/WebAssembly/WebAssemblyFixIrreducibleControlFlow.cpp (C++)

Code before:
    return N->Succs.begin();
  }

  static inline ChildIteratorType child_end(NodeRef N) {
    return N->Succs.end();
  }
};
} // end namespace llvm

namespace {

void ReachabilityGraph::calculate() {
  auto NumBlocks = Blocks.size();
  Nodes.assign(NumBlocks, {});

  MBBToNodeMap.clear();
  MBBToNodeMap.reserve(NumBlocks);

  // Initialize mappings.
  unsigned MBBIdx = 0;
  for (auto *MBB : Blocks) {
    auto &Node = Nodes[MBBIdx++];

    Node.MBB = MBB;
    MBBToNodeMap[MBB] = &Node;
  }

  // Add all relevant direct branches.
  MBBIdx = 0;
  for (auto *MBB : Blocks) {
    auto &Node = Nodes[MBBIdx++];

    for (auto *Succ : MBB->successors()) {
      if (Succ != Entry && inRegion(Succ)) {
        Node.Succs.push_back(getNode(Succ));
      }
    }
  }

  unsigned CurrSCCIdx = 0;
  for (auto &SCC : make_range(scc_begin(this), scc_end(this))) {
    LoopEntriesBySCC.push_back({});
    auto &SCCLoopEntries = LoopEntriesBySCC[CurrSCCIdx];

    for (auto *Node : SCC) {
      // Make sure nodes are only ever assigned one SCC
      assert(Node->SCCId == std::numeric_limits<unsigned>::max());

      Node->SCCId = CurrSCCIdx;
    }


Review comment (suggestion):
Since the underlying type is a ReachabilityNode*, I think it would be better to use `auto*` and use it as a pointer type explicitly here.

Code after:
  }
};
} // end namespace llvm

namespace {

void ReachabilityGraph::calculate() {
  auto NumBlocks = Blocks.size();
  Nodes.assign(NumBlocks, {});

  MBBToNodeMap.clear();
  MBBToNodeMap.reserve(NumBlocks);

  // Initialize mappings.
  unsigned MBBIdx = 0;
  for (auto *MBB : Blocks) {
    auto &Node = Nodes[MBBIdx++];

    Node.MBB = MBB;
    MBBToNodeMap[MBB] = &Node;
  }

  // Add all relevant direct branches.
  MBBIdx = 0;
  for (auto *MBB : Blocks) {
    auto &Node = Nodes[MBBIdx++];

    for (auto *Succ : MBB->successors()) {
      if (Succ != Entry && inRegion(Succ)) {
        Node.Succs.push_back(getNode(Succ));
      }
    }
  }

  unsigned CurrSCCIdx = 0;
  for (auto &SCC : make_range(scc_begin(this), scc_end(this))) {
    LoopEntriesBySCC.push_back({});
    auto &SCCLoopEntries = LoopEntriesBySCC.back();

    for (auto *Node : SCC) {
      // Make sure nodes are only ever assigned one SCC
      assert(Node->SCCId == std::numeric_limits<unsigned>::max());

      Node->SCCId = CurrSCCIdx;
    }

    bool SelfLoop = false;
    if (SCC.size() == 1) {
      auto &Node = SCC[0];

      for (auto *Succ : Node->Succs) {
Repository: llvm/llvm-project
File: clang-tools-extra/clang-tidy/modernize/UseEqualsDeleteCheck.cpp (C++)

Code before:
//===----------------------------------------------------------------------===//
//
// 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
//
//===----------------------------------------------------------------------===//

#include "UseEqualsDeleteCheck.h"
#include "clang/AST/ASTContext.h"
#include "clang/ASTMatchers/ASTMatchFinder.h"
#include "clang/Basic/Specifiers.h"
#include "clang/Lex/Lexer.h"

using namespace clang::ast_matchers;

namespace clang::tidy::modernize {

namespace {
AST_MATCHER(FunctionDecl, hasAnyDefinition) {
  if (Node.hasBody() || Node.isPureVirtual() || Node.isDefaulted() ||
      Node.isDeleted())
    return true;

  if (const FunctionDecl *Definition = Node.getDefinition())
    if (Definition->hasBody() || Definition->isPureVirtual() ||
        Definition->isDefaulted() || Definition->isDeleted())
      return true;

  return false;
}

AST_MATCHER(Decl, isUsed) { return Node.isUsed(); }

AST_MATCHER(CXXMethodDecl, isSpecialFunction) {
  if (const auto *Constructor = dyn_cast<CXXConstructorDecl>(&Node))
    return Constructor->isDefaultConstructor() ||

Review comment (suggestion):
We generally rely on the transitive include
```suggestion
```


Code after:
//===----------------------------------------------------------------------===//
//
// 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
//
//===----------------------------------------------------------------------===//

#include "UseEqualsDeleteCheck.h"
#include "clang/AST/ASTContext.h"
#include "clang/ASTMatchers/ASTMatchFinder.h"
#include "clang/Lex/Lexer.h"

using namespace clang::ast_matchers;

namespace clang::tidy::modernize {

namespace {
AST_MATCHER(FunctionDecl, hasAnyDefinition) {
  if (Node.hasBody() || Node.isPureVirtual() || Node.isDefaulted() ||
      Node.isDeleted())
    return true;

  if (const FunctionDecl *Definition = Node.getDefinition())
    if (Definition->hasBody() || Definition->isPureVirtual() ||
        Definition->isDefaulted() || Definition->isDeleted())
      return true;

  return false;
}

AST_MATCHER(Decl, isUsed) { return Node.isUsed(); }

AST_MATCHER(CXXMethodDecl, isSpecialFunction) {
  if (const auto *Constructor = dyn_cast<CXXConstructorDecl>(&Node))
    return Constructor->isDefaultConstructor() ||
           Constructor->isCopyOrMoveConstructor();
Repository: llvm/llvm-project
File: clang-tools-extra/clang-doc/benchmarks/ClangDocBenchmark.cpp (C++)

Code before:
#include "../BitcodeReader.h"
#include "../BitcodeWriter.h"
#include "../ClangDoc.h"
#include "../Generators.h"
#include "../Representation.h"
#include "../Serialize.h"
#include "benchmark/benchmark.h"
#include "clang/AST/ASTContext.h"
#include "clang/AST/RecursiveASTVisitor.h"
#include "clang/Tooling/Execution.h"
#include "clang/Tooling/Tooling.h"
#include "llvm/Bitstream/BitstreamWriter.h"
#include <string>
#include <vector>

namespace clang {
namespace doc {

class BenchmarkVisitor : public RecursiveASTVisitor<BenchmarkVisitor> {
public:
  explicit BenchmarkVisitor(const FunctionDecl *&Func) : Func(Func) {}

  bool VisitFunctionDecl(const FunctionDecl *D) {
    if (D->getName() == "f") {
      Func = D;
      return false;

Review comment (suggestion):
If this target is getting linked to the `clangDoc` library target in CMake, do these still have to be relative? Not sure if a big deal but odd to me since I don't see many relative includes.

Code after:
//===----------------------------------------------------------------------===//
//
// 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
//
//===----------------------------------------------------------------------===//
///
/// \file
/// This file contains basic benchmarks for clang-doc's implementation and
/// library components.
///
//===----------------------------------------------------------------------===//

#include "BitcodeReader.h"
#include "BitcodeWriter.h"
#include "ClangDoc.h"
#include "Generators.h"
#include "Representation.h"
#include "Serialize.h"
#include "benchmark/benchmark.h"
#include "clang/AST/ASTContext.h"
#include "clang/AST/RecursiveASTVisitor.h"
#include "clang/Tooling/Execution.h"
#include "clang/Tooling/Tooling.h"
#include "llvm/Bitstream/BitstreamWriter.h"