Coverage Report

Created: 2019-07-24 05:18

/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/llvm/tools/clang/include/clang/AST/DataCollection.h
Line
Count
Source
1
//===--- DatatCollection.h --------------------------------------*- C++ -*-===//
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
/// \file
9
/// This file declares helper methods for collecting data from AST nodes.
10
///
11
/// To collect data from Stmt nodes, subclass ConstStmtVisitor and include
12
/// StmtDataCollectors.inc after defining the macros that you need. This
13
/// provides data collection implementations for most Stmt kinds. Note
14
/// that the code requires some conditions to be met:
15
///
16
///   - There must be a method addData(const T &Data) that accepts strings,
17
///     integral types as well as QualType. All data is forwarded using
18
///     to this method.
19
///   - The ASTContext of the Stmt must be accessible by the name Context.
20
///
21
/// It is also possible to override individual visit methods. Have a look at
22
/// the DataCollector in lib/Analysis/CloneDetection.cpp for a usage example.
23
///
24
//===----------------------------------------------------------------------===//
25
26
#ifndef LLVM_CLANG_AST_DATACOLLECTION_H
27
#define LLVM_CLANG_AST_DATACOLLECTION_H
28
29
#include "clang/AST/ASTContext.h"
30
31
namespace clang {
32
namespace data_collection {
33
34
/// Returns a string that represents all macro expansions that expanded into the
35
/// given SourceLocation.
36
///
37
/// If 'getMacroStack(A) == getMacroStack(B)' is true, then the SourceLocations
38
/// A and B are expanded from the same macros in the same order.
39
std::string getMacroStack(SourceLocation Loc, ASTContext &Context);
40
41
/// Utility functions for implementing addData() for a consumer that has a
42
/// method update(StringRef)
43
template <class T>
44
24.6k
void addDataToConsumer(T &DataConsumer, llvm::StringRef Str) {
45
24.6k
  DataConsumer.update(Str);
46
24.6k
}
void clang::data_collection::addDataToConsumer<llvm::MD5>(llvm::MD5&, llvm::StringRef)
Line
Count
Source
44
5.36k
void addDataToConsumer(T &DataConsumer, llvm::StringRef Str) {
45
5.36k
  DataConsumer.update(Str);
46
5.36k
}
CloneDetection.cpp:void clang::data_collection::addDataToConsumer<(anonymous namespace)::FoldingSetNodeIDWrapper>((anonymous namespace)::FoldingSetNodeIDWrapper&, llvm::StringRef)
Line
Count
Source
44
19.3k
void addDataToConsumer(T &DataConsumer, llvm::StringRef Str) {
45
19.3k
  DataConsumer.update(Str);
46
19.3k
}
47
48
7.68k
template <class T> void addDataToConsumer(T &DataConsumer, const QualType &QT) {
49
7.68k
  addDataToConsumer(DataConsumer, QT.getAsString());
50
7.68k
}
void clang::data_collection::addDataToConsumer<llvm::MD5>(llvm::MD5&, clang::QualType const&)
Line
Count
Source
48
1.51k
template <class T> void addDataToConsumer(T &DataConsumer, const QualType &QT) {
49
1.51k
  addDataToConsumer(DataConsumer, QT.getAsString());
50
1.51k
}
CloneDetection.cpp:void clang::data_collection::addDataToConsumer<(anonymous namespace)::FoldingSetNodeIDWrapper>((anonymous namespace)::FoldingSetNodeIDWrapper&, clang::QualType const&)
Line
Count
Source
48
6.17k
template <class T> void addDataToConsumer(T &DataConsumer, const QualType &QT) {
49
6.17k
  addDataToConsumer(DataConsumer, QT.getAsString());
50
6.17k
}
51
52
template <class T, class Type>
53
typename std::enable_if<
54
    std::is_integral<Type>::value || std::is_enum<Type>::value ||
55
    std::is_convertible<Type, size_t>::value // for llvm::hash_code
56
    >::type
57
10.9k
addDataToConsumer(T &DataConsumer, Type Data) {
58
10.9k
  DataConsumer.update(StringRef(reinterpret_cast<char *>(&Data), sizeof(Data)));
59
10.9k
}
std::__1::enable_if<((std::is_integral<bool>::value) || (std::is_enum<bool>::value)) || (std::is_convertible<bool, unsigned long>::value), void>::type clang::data_collection::addDataToConsumer<llvm::MD5, bool>(llvm::MD5&, bool)
Line
Count
Source
57
35
addDataToConsumer(T &DataConsumer, Type Data) {
58
35
  DataConsumer.update(StringRef(reinterpret_cast<char *>(&Data), sizeof(Data)));
59
35
}
std::__1::enable_if<((std::is_integral<clang::Stmt::StmtClass>::value) || (std::is_enum<clang::Stmt::StmtClass>::value)) || (std::is_convertible<clang::Stmt::StmtClass, unsigned long>::value), void>::type clang::data_collection::addDataToConsumer<llvm::MD5, clang::Stmt::StmtClass>(llvm::MD5&, clang::Stmt::StmtClass)
Line
Count
Source
57
1.88k
addDataToConsumer(T &DataConsumer, Type Data) {
58
1.88k
  DataConsumer.update(StringRef(reinterpret_cast<char *>(&Data), sizeof(Data)));
59
1.88k
}
std::__1::enable_if<((std::is_integral<unsigned int>::value) || (std::is_enum<unsigned int>::value)) || (std::is_convertible<unsigned int, unsigned long>::value), void>::type clang::data_collection::addDataToConsumer<llvm::MD5, unsigned int>(llvm::MD5&, unsigned int)
Line
Count
Source
57
32
addDataToConsumer(T &DataConsumer, Type Data) {
58
32
  DataConsumer.update(StringRef(reinterpret_cast<char *>(&Data), sizeof(Data)));
59
32
}
Unexecuted instantiation: std::__1::enable_if<((std::is_integral<clang::ArrayTypeTrait>::value) || (std::is_enum<clang::ArrayTypeTrait>::value)) || (std::is_convertible<clang::ArrayTypeTrait, unsigned long>::value), void>::type clang::data_collection::addDataToConsumer<llvm::MD5, clang::ArrayTypeTrait>(llvm::MD5&, clang::ArrayTypeTrait)
std::__1::enable_if<((std::is_integral<clang::BinaryOperatorKind>::value) || (std::is_enum<clang::BinaryOperatorKind>::value)) || (std::is_convertible<clang::BinaryOperatorKind, unsigned long>::value), void>::type clang::data_collection::addDataToConsumer<llvm::MD5, clang::BinaryOperatorKind>(llvm::MD5&, clang::BinaryOperatorKind)
Line
Count
Source
57
285
addDataToConsumer(T &DataConsumer, Type Data) {
58
285
  DataConsumer.update(StringRef(reinterpret_cast<char *>(&Data), sizeof(Data)));
59
285
}
Unexecuted instantiation: std::__1::enable_if<((std::is_integral<clang::ObjCBridgeCastKind>::value) || (std::is_enum<clang::ObjCBridgeCastKind>::value)) || (std::is_convertible<clang::ObjCBridgeCastKind, unsigned long>::value), void>::type clang::data_collection::addDataToConsumer<llvm::MD5, clang::ObjCBridgeCastKind>(llvm::MD5&, clang::ObjCBridgeCastKind)
Unexecuted instantiation: std::__1::enable_if<((std::is_integral<clang::ExpressionTrait>::value) || (std::is_enum<clang::ExpressionTrait>::value)) || (std::is_convertible<clang::ExpressionTrait, unsigned long>::value), void>::type clang::data_collection::addDataToConsumer<llvm::MD5, clang::ExpressionTrait>(llvm::MD5&, clang::ExpressionTrait)
std::__1::enable_if<((std::is_integral<clang::LambdaCaptureKind>::value) || (std::is_enum<clang::LambdaCaptureKind>::value)) || (std::is_convertible<clang::LambdaCaptureKind, unsigned long>::value), void>::type clang::data_collection::addDataToConsumer<llvm::MD5, clang::LambdaCaptureKind>(llvm::MD5&, clang::LambdaCaptureKind)
Line
Count
Source
57
5
addDataToConsumer(T &DataConsumer, Type Data) {
58
5
  DataConsumer.update(StringRef(reinterpret_cast<char *>(&Data), sizeof(Data)));
59
5
}
Unexecuted instantiation: std::__1::enable_if<((std::is_integral<clang::PredefinedExpr::IdentKind>::value) || (std::is_enum<clang::PredefinedExpr::IdentKind>::value)) || (std::is_convertible<clang::PredefinedExpr::IdentKind, unsigned long>::value), void>::type clang::data_collection::addDataToConsumer<llvm::MD5, clang::PredefinedExpr::IdentKind>(llvm::MD5&, clang::PredefinedExpr::IdentKind)
Unexecuted instantiation: std::__1::enable_if<((std::is_integral<clang::TypeTrait>::value) || (std::is_enum<clang::TypeTrait>::value)) || (std::is_convertible<clang::TypeTrait, unsigned long>::value), void>::type clang::data_collection::addDataToConsumer<llvm::MD5, clang::TypeTrait>(llvm::MD5&, clang::TypeTrait)
std::__1::enable_if<((std::is_integral<clang::UnaryOperatorKind>::value) || (std::is_enum<clang::UnaryOperatorKind>::value)) || (std::is_convertible<clang::UnaryOperatorKind, unsigned long>::value), void>::type clang::data_collection::addDataToConsumer<llvm::MD5, clang::UnaryOperatorKind>(llvm::MD5&, clang::UnaryOperatorKind)
Line
Count
Source
57
54
addDataToConsumer(T &DataConsumer, Type Data) {
58
54
  DataConsumer.update(StringRef(reinterpret_cast<char *>(&Data), sizeof(Data)));
59
54
}
CloneDetection.cpp:std::__1::enable_if<((std::is_integral<bool>::value) || (std::is_enum<bool>::value)) || (std::is_convertible<bool, unsigned long>::value), void>::type clang::data_collection::addDataToConsumer<(anonymous namespace)::FoldingSetNodeIDWrapper, bool>((anonymous namespace)::FoldingSetNodeIDWrapper&, bool)
Line
Count
Source
57
4
addDataToConsumer(T &DataConsumer, Type Data) {
58
4
  DataConsumer.update(StringRef(reinterpret_cast<char *>(&Data), sizeof(Data)));
59
4
}
CloneDetection.cpp:std::__1::enable_if<((std::is_integral<clang::Stmt::StmtClass>::value) || (std::is_enum<clang::Stmt::StmtClass>::value)) || (std::is_convertible<clang::Stmt::StmtClass, unsigned long>::value), void>::type clang::data_collection::addDataToConsumer<(anonymous namespace)::FoldingSetNodeIDWrapper, clang::Stmt::StmtClass>((anonymous namespace)::FoldingSetNodeIDWrapper&, clang::Stmt::StmtClass)
Line
Count
Source
57
6.53k
addDataToConsumer(T &DataConsumer, Type Data) {
58
6.53k
  DataConsumer.update(StringRef(reinterpret_cast<char *>(&Data), sizeof(Data)));
59
6.53k
}
Unexecuted instantiation: CloneDetection.cpp:std::__1::enable_if<((std::is_integral<unsigned int>::value) || (std::is_enum<unsigned int>::value)) || (std::is_convertible<unsigned int, unsigned long>::value), void>::type clang::data_collection::addDataToConsumer<(anonymous namespace)::FoldingSetNodeIDWrapper, unsigned int>((anonymous namespace)::FoldingSetNodeIDWrapper&, unsigned int)
Unexecuted instantiation: CloneDetection.cpp:std::__1::enable_if<((std::is_integral<clang::ArrayTypeTrait>::value) || (std::is_enum<clang::ArrayTypeTrait>::value)) || (std::is_convertible<clang::ArrayTypeTrait, unsigned long>::value), void>::type clang::data_collection::addDataToConsumer<(anonymous namespace)::FoldingSetNodeIDWrapper, clang::ArrayTypeTrait>((anonymous namespace)::FoldingSetNodeIDWrapper&, clang::ArrayTypeTrait)
CloneDetection.cpp:std::__1::enable_if<((std::is_integral<clang::BinaryOperatorKind>::value) || (std::is_enum<clang::BinaryOperatorKind>::value)) || (std::is_convertible<clang::BinaryOperatorKind, unsigned long>::value), void>::type clang::data_collection::addDataToConsumer<(anonymous namespace)::FoldingSetNodeIDWrapper, clang::BinaryOperatorKind>((anonymous namespace)::FoldingSetNodeIDWrapper&, clang::BinaryOperatorKind)
Line
Count
Source
57
2.00k
addDataToConsumer(T &DataConsumer, Type Data) {
58
2.00k
  DataConsumer.update(StringRef(reinterpret_cast<char *>(&Data), sizeof(Data)));
59
2.00k
}
Unexecuted instantiation: CloneDetection.cpp:std::__1::enable_if<((std::is_integral<clang::ObjCBridgeCastKind>::value) || (std::is_enum<clang::ObjCBridgeCastKind>::value)) || (std::is_convertible<clang::ObjCBridgeCastKind, unsigned long>::value), void>::type clang::data_collection::addDataToConsumer<(anonymous namespace)::FoldingSetNodeIDWrapper, clang::ObjCBridgeCastKind>((anonymous namespace)::FoldingSetNodeIDWrapper&, clang::ObjCBridgeCastKind)
Unexecuted instantiation: CloneDetection.cpp:std::__1::enable_if<((std::is_integral<clang::ExpressionTrait>::value) || (std::is_enum<clang::ExpressionTrait>::value)) || (std::is_convertible<clang::ExpressionTrait, unsigned long>::value), void>::type clang::data_collection::addDataToConsumer<(anonymous namespace)::FoldingSetNodeIDWrapper, clang::ExpressionTrait>((anonymous namespace)::FoldingSetNodeIDWrapper&, clang::ExpressionTrait)
Unexecuted instantiation: CloneDetection.cpp:std::__1::enable_if<((std::is_integral<clang::LambdaCaptureKind>::value) || (std::is_enum<clang::LambdaCaptureKind>::value)) || (std::is_convertible<clang::LambdaCaptureKind, unsigned long>::value), void>::type clang::data_collection::addDataToConsumer<(anonymous namespace)::FoldingSetNodeIDWrapper, clang::LambdaCaptureKind>((anonymous namespace)::FoldingSetNodeIDWrapper&, clang::LambdaCaptureKind)
Unexecuted instantiation: CloneDetection.cpp:std::__1::enable_if<((std::is_integral<clang::PredefinedExpr::IdentKind>::value) || (std::is_enum<clang::PredefinedExpr::IdentKind>::value)) || (std::is_convertible<clang::PredefinedExpr::IdentKind, unsigned long>::value), void>::type clang::data_collection::addDataToConsumer<(anonymous namespace)::FoldingSetNodeIDWrapper, clang::PredefinedExpr::IdentKind>((anonymous namespace)::FoldingSetNodeIDWrapper&, clang::PredefinedExpr::IdentKind)
Unexecuted instantiation: CloneDetection.cpp:std::__1::enable_if<((std::is_integral<clang::TypeTrait>::value) || (std::is_enum<clang::TypeTrait>::value)) || (std::is_convertible<clang::TypeTrait, unsigned long>::value), void>::type clang::data_collection::addDataToConsumer<(anonymous namespace)::FoldingSetNodeIDWrapper, clang::TypeTrait>((anonymous namespace)::FoldingSetNodeIDWrapper&, clang::TypeTrait)
CloneDetection.cpp:std::__1::enable_if<((std::is_integral<clang::UnaryOperatorKind>::value) || (std::is_enum<clang::UnaryOperatorKind>::value)) || (std::is_convertible<clang::UnaryOperatorKind, unsigned long>::value), void>::type clang::data_collection::addDataToConsumer<(anonymous namespace)::FoldingSetNodeIDWrapper, clang::UnaryOperatorKind>((anonymous namespace)::FoldingSetNodeIDWrapper&, clang::UnaryOperatorKind)
Line
Count
Source
57
118
addDataToConsumer(T &DataConsumer, Type Data) {
58
118
  DataConsumer.update(StringRef(reinterpret_cast<char *>(&Data), sizeof(Data)));
59
118
}
60
61
} // end namespace data_collection
62
} // end namespace clang
63
64
#endif // LLVM_CLANG_AST_DATACOLLECTION_H