<commit_before>//===--- TypeLoc.h - Type Source Info Wrapper -------------------*- C++ -*-===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
//  This file defines the TypeLoc interface and subclasses.
//
//===----------------------------------------------------------------------===//

#ifndef LLVM_CLANG_AST_TYPELOC_H
#define LLVM_CLANG_AST_TYPELOC_H

#include "clang/AST/Type.h"
#include "clang/AST/TypeVisitor.h"

namespace clang {
  class ParmVarDecl;
  class TypeSpecLoc;
  class DeclaratorInfo;

/// \brief Base wrapper for a particular "section" of type source info.
///
/// A client should use the TypeLoc subclasses through cast/dyn_cast in order to
/// get at the actual information.
class TypeLoc {
protected:
  QualType Ty;
  void *Data;
  
  TypeLoc(QualType ty, void *data) : Ty(ty), Data(data) { }
  static TypeLoc Create(QualType ty, void *data) { return TypeLoc(ty,data); }
  friend class DeclaratorInfo;
public:
  TypeLoc() : Data(0) { }

  bool isNull() const { return Ty.isNull(); }
  operator bool() const { return isNull(); }

  /// \brief Returns the size of type source info data block for the given type.
  static unsigned getFullDataSizeForType(QualType Ty);

  /// \brief Get the type for which this source info wrapper provides
  /// information.
  QualType getSourceType() const { return Ty; }

  /// \brief Find the TypeSpecLoc that is part of this TypeLoc.
  TypeSpecLoc getTypeSpecLoc() const;

  /// \brief Find the TypeSpecLoc that is part of this TypeLoc and return its
  /// SourceRange.
  SourceRange getTypeSpecRange() const;

  /// \brief Returns the size of the type source info data block.
  unsigned getFullDataSize() const;

  /// \brief Get the next TypeLoc pointed by this TypeLoc, e.g for "int*" the
  /// TypeLoc is a PointerLoc and next TypeLoc is for "int".
  TypeLoc getNextTypeLoc() const;

  friend bool operator==(const TypeLoc &LHS, const TypeLoc &RHS) {
    return LHS.Ty == RHS.Ty && LHS.Data == RHS.Data;
  }

  friend bool operator!=(const TypeLoc &LHS, const TypeLoc &RHS) {
    return !(LHS == RHS);<commit_msg>Fix TypeLoc::operator bool().<commit_after>//===--- TypeLoc.h - Type Source Info Wrapper -------------------*- C++ -*-===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
//  This file defines the TypeLoc interface and subclasses.
//
//===----------------------------------------------------------------------===//

#ifndef LLVM_CLANG_AST_TYPELOC_H
#define LLVM_CLANG_AST_TYPELOC_H

#include "clang/AST/Type.h"
#include "clang/AST/TypeVisitor.h"

namespace clang {
  class ParmVarDecl;
  class TypeSpecLoc;
  class DeclaratorInfo;

/// \brief Base wrapper for a particular "section" of type source info.
///
/// A client should use the TypeLoc subclasses through cast/dyn_cast in order to
/// get at the actual information.
class TypeLoc {
protected:
  QualType Ty;
  void *Data;
  
  TypeLoc(QualType ty, void *data) : Ty(ty), Data(data) { }
  static TypeLoc Create(QualType ty, void *data) { return TypeLoc(ty,data); }
  friend class DeclaratorInfo;
public:
  TypeLoc() : Data(0) { }

  bool isNull() const { return Ty.isNull(); }
  operator bool() const { return !isNull(); }

  /// \brief Returns the size of type source info data block for the given type.
  static unsigned getFullDataSizeForType(QualType Ty);

  /// \brief Get the type for which this source info wrapper provides
  /// information.
  QualType getSourceType() const { return Ty; }

  /// \brief Find the TypeSpecLoc that is part of this TypeLoc.
  TypeSpecLoc getTypeSpecLoc() const;

  /// \brief Find the TypeSpecLoc that is part of this TypeLoc and return its
  /// SourceRange.
  SourceRange getTypeSpecRange() const;

  /// \brief Returns the size of the type source info data block.
  unsigned getFullDataSize() const;

  /// \brief Get the next TypeLoc pointed by this TypeLoc, e.g for "int*" the
  /// TypeLoc is a PointerLoc and next TypeLoc is for "int".
  TypeLoc getNextTypeLoc() const;

  friend bool operator==(const TypeLoc &LHS, const TypeLoc &RHS) {
    return LHS.Ty == RHS.Ty && LHS.Data == RHS.Data;
  }

  friend bool operator!=(const TypeLoc &LHS, const TypeLoc &RHS) {
    return !(LHS == RHS);
{'fraction_non_alphanumeric': 0.1810663764961915, 'fraction_numerical': 0.0004352557127312296, 'mean_word_length': 2.44527736131934, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6785793', 'n_tokens_mistral': 1324, 'n_tokens_neox': 1305, 'n_words': 491}