Coverage Report

Created: 2018-07-22 10:17

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