summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/Sema')
-rw-r--r--clang/lib/Sema/Sema.cpp22
-rw-r--r--clang/lib/Sema/SemaChecking.cpp25
-rw-r--r--clang/lib/Sema/SemaDecl.cpp5
-rw-r--r--clang/lib/Sema/SemaExpr.cpp15
-rw-r--r--clang/lib/Sema/SemaTemplate.cpp7
5 files changed, 72 insertions, 2 deletions
diff --git a/clang/lib/Sema/Sema.cpp b/clang/lib/Sema/Sema.cpp
index 5c0026cd374..928d8732211 100644
--- a/clang/lib/Sema/Sema.cpp
+++ b/clang/lib/Sema/Sema.cpp
@@ -40,6 +40,7 @@
#include "clang/Sema/TemplateInstCallback.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/SmallSet.h"
+#include "llvm/Support/Timer.h"
using namespace clang;
using namespace sema;
@@ -842,6 +843,9 @@ void Sema::ActOnStartOfTranslationUnit() {
/// translation unit when EOF is reached and all but the top-level scope is
/// popped.
void Sema::ActOnEndOfTranslationUnit() {
+ llvm::NamedRegionTimer T(
+ "actoneou1", "Act On End Of Translation Unit: Common case",
+ GroupName, GroupDescription, llvm::TimePassesIsEnabled);
assert(DelayedDiagnostics.getCurrentPool() == nullptr
&& "reached end of translation unit with a pool attached?");
@@ -867,6 +871,10 @@ void Sema::ActOnEndOfTranslationUnit() {
// Complete translation units and modules define vtables and perform implicit
// instantiations. PCH files do not.
if (TUKind != TU_Prefix) {
+ llvm::NamedRegionTimer T(
+ "actoneou2",
+ "Act On End Of Translation Unit: TUKind != TU_Prefix", GroupName,
+ GroupDescription, llvm::TimePassesIsEnabled);
DiagnoseUseOfUnimplementedSelectors();
// If DefinedUsedVTables ends up marking any virtual member functions it
@@ -929,6 +937,10 @@ void Sema::ActOnEndOfTranslationUnit() {
UnusedFileScopedDecls.end());
if (TUKind == TU_Prefix) {
+ llvm::NamedRegionTimer T(
+ "actoneou3",
+ "Act On End Of Translation Unit: TUKind == TU_Prefix", GroupName,
+ GroupDescription, llvm::TimePassesIsEnabled);
// Translation unit prefixes don't need any of the checking below.
if (!PP.isIncrementalProcessingEnabled())
TUScope = nullptr;
@@ -963,6 +975,10 @@ void Sema::ActOnEndOfTranslationUnit() {
}
if (TUKind == TU_Module) {
+ llvm::NamedRegionTimer T(
+ "actoneou4",
+ "Act On End Of Translation Unit: TUKind == TU_Module", GroupName,
+ GroupDescription, llvm::TimePassesIsEnabled);
// If we are building a module interface unit, we need to have seen the
// module declaration by now.
if (getLangOpts().getCompilingModule() ==
@@ -1557,6 +1573,9 @@ void ExternalSemaSource::ReadMismatchingDeleteExpressions(llvm::MapVector<
/// name, this parameter is populated with the decls of the various overloads.
bool Sema::tryExprAsCall(Expr &E, QualType &ZeroArgCallReturnTy,
UnresolvedSetImpl &OverloadSet) {
+ llvm::NamedRegionTimer T("tryascall", "Try Expr As Call", GroupName,
+ GroupDescription, llvm::TimePassesIsEnabled);
+
ZeroArgCallReturnTy = QualType();
OverloadSet.clear();
@@ -1719,6 +1738,9 @@ static bool IsCallableWithAppend(Expr *E) {
bool Sema::tryToRecoverWithCall(ExprResult &E, const PartialDiagnostic &PD,
bool ForceComplain,
bool (*IsPlausibleResult)(QualType)) {
+ llvm::NamedRegionTimer T("trytorecover", "Try To Recover With Call",
+ GroupName, GroupDescription,
+ llvm::TimePassesIsEnabled);
SourceLocation Loc = E.get()->getExprLoc();
SourceRange Range = E.get()->getSourceRange();
diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp
index fdf7e2b70f3..74f0de61abe 100644
--- a/clang/lib/Sema/SemaChecking.cpp
+++ b/clang/lib/Sema/SemaChecking.cpp
@@ -84,6 +84,7 @@
#include "llvm/Support/Format.h"
#include "llvm/Support/Locale.h"
#include "llvm/Support/MathExtras.h"
+#include "llvm/Support/Timer.h"
#include "llvm/Support/raw_ostream.h"
#include <algorithm>
#include <cassert>
@@ -118,7 +119,7 @@ static bool checkArgCount(Sema &S, CallExpr *call, unsigned desiredArgCount) {
// Highlight all the excess arguments.
SourceRange range(call->getArg(desiredArgCount)->getLocStart(),
call->getArg(argCount - 1)->getLocEnd());
-
+
return S.Diag(range.getBegin(), diag::err_typecheck_call_too_many_args)
<< 0 /*function call*/ << desiredArgCount << argCount
<< call->getArg(1)->getSourceRange();
@@ -224,7 +225,7 @@ static bool SemaBuiltinOverflow(Sema &S, CallExpr *TheCall) {
}
static void SemaBuiltinMemChkCall(Sema &S, FunctionDecl *FDecl,
- CallExpr *TheCall, unsigned SizeIdx,
+ CallExpr *TheCall, unsigned SizeIdx,
unsigned DstSizeIdx) {
if (TheCall->getNumArgs() <= SizeIdx ||
TheCall->getNumArgs() <= DstSizeIdx)
@@ -491,6 +492,9 @@ static bool checkOpenCLEnqueueVariadicArgs(Sema &S, CallExpr *TheCall,
/// void (^block)(local void*, ...),
/// uint size0, ...)
static bool SemaOpenCLBuiltinEnqueueKernel(Sema &S, CallExpr *TheCall) {
+ llvm::NamedRegionTimer T(
+ "semaopenclbuiltin", "Sema OpenCL Builtin Enqueue Kernel",
+ Sema::GroupName, Sema::GroupDescription, llvm::TimePassesIsEnabled);
unsigned NumArgs = TheCall->getNumArgs();
if (NumArgs < 4) {
@@ -853,6 +857,10 @@ static bool SemaOpenCLBuiltinToAddr(Sema &S, unsigned BuiltinID,
ExprResult
Sema::CheckBuiltinFunctionCall(FunctionDecl *FDecl, unsigned BuiltinID,
CallExpr *TheCall) {
+ llvm::NamedRegionTimer T("checkbuiltinfunction",
+ "Check Builtin Function Call", GroupName,
+ GroupDescription, llvm::TimePassesIsEnabled);
+
ExprResult TheCallResult(TheCall);
// Find out if any arguments are required to be integer constant expressions.
@@ -2252,6 +2260,9 @@ bool Sema::CheckX86BuiltinGatherScatterScale(unsigned BuiltinID,
}
bool Sema::CheckX86BuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall) {
+ llvm::NamedRegionTimer T("checkx86builtin",
+ "Check X86 Builtin Function Call", GroupName,
+ GroupDescription, llvm::TimePassesIsEnabled);
if (BuiltinID == X86::BI__builtin_cpu_supports)
return SemaBuiltinCpuSupports(*this, TheCall);
@@ -2693,6 +2704,8 @@ void Sema::checkCall(NamedDecl *FDecl, const FunctionProtoType *Proto,
const Expr *ThisArg, ArrayRef<const Expr *> Args,
bool IsMemberFunction, SourceLocation Loc,
SourceRange Range, VariadicCallType CallType) {
+ llvm::NamedRegionTimer T("checkcall", "Check Call", GroupName,
+ GroupDescription, llvm::TimePassesIsEnabled);
// FIXME: We should check as much as we can in the template definition.
if (CurContext->isDependentContext())
return;
@@ -3331,6 +3344,10 @@ static bool checkBuiltinArgument(Sema &S, CallExpr *E, unsigned ArgIndex) {
/// builtins,
ExprResult
Sema::SemaBuiltinAtomicOverloaded(ExprResult TheCallResult) {
+ llvm::NamedRegionTimer T("semabuiltinatomic",
+ "Sema Builtin Atomic Overloaded", GroupName,
+ GroupDescription, llvm::TimePassesIsEnabled);
+
CallExpr *TheCall = (CallExpr *)TheCallResult.get();
DeclRefExpr *DRE =cast<DeclRefExpr>(TheCall->getCallee()->IgnoreParenCasts());
FunctionDecl *FDecl = cast<FunctionDecl>(DRE->getDecl());
@@ -9518,6 +9535,10 @@ static bool isSameWidthConstantConversion(Sema &S, Expr *E, QualType T,
static void
CheckImplicitConversion(Sema &S, Expr *E, QualType T, SourceLocation CC,
bool *ICContext = nullptr) {
+ llvm::NamedRegionTimer NRT("checkimplicit",
+ "Check Implicit Conversion", Sema::GroupName,
+ Sema::GroupDescription, llvm::TimePassesIsEnabled);
+
if (E->isTypeDependent() || E->isValueDependent()) return;
const Type *Source = S.Context.getCanonicalType(E->getType()).getTypePtr();
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index 9228d65250c..6ed2c9ee805 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -44,6 +44,7 @@
#include "clang/Sema/Template.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/Triple.h"
+#include "llvm/Support/Timer.h"
#include <algorithm>
#include <cstring>
#include <functional>
@@ -849,6 +850,8 @@ Sema::ClassifyName(Scope *S, CXXScopeSpec &SS, IdentifierInfo *&Name,
SourceLocation NameLoc, const Token &NextToken,
bool IsAddressOfOperand,
std::unique_ptr<CorrectionCandidateCallback> CCC) {
+ llvm::NamedRegionTimer T("classifyname", "Classify Name", GroupName,
+ GroupDescription, llvm::TimePassesIsEnabled);
DeclarationNameInfo NameInfo(Name, NameLoc);
ObjCMethodDecl *CurMethod = getCurMethodDecl();
@@ -5321,6 +5324,8 @@ bool Sema::diagnoseQualifiedDeclaration(CXXScopeSpec &SS, DeclContext *DC,
NamedDecl *Sema::HandleDeclarator(Scope *S, Declarator &D,
MultiTemplateParamsArg TemplateParamLists) {
+ llvm::NamedRegionTimer T("handledeclarator", "Handle Declarator", GroupName,
+ GroupDescription, llvm::TimePassesIsEnabled);
// TODO: consider using NameInfo for diagnostic.
DeclarationNameInfo NameInfo = GetNameForDeclarator(D);
DeclarationName Name = NameInfo.getName();
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index b8cadaf7abb..0b864803859 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/lib/Sema/SemaExpr.cpp
@@ -44,6 +44,7 @@
#include "clang/Sema/SemaInternal.h"
#include "clang/Sema/Template.h"
#include "llvm/Support/ConvertUTF.h"
+#include "llvm/Support/Timer.h"
using namespace clang;
using namespace sema;
@@ -1308,6 +1309,10 @@ Sema::ActOnGenericSelectionExpr(SourceLocation KeyLoc,
Expr *ControllingExpr,
ArrayRef<ParsedType> ArgTypes,
ArrayRef<Expr *> ArgExprs) {
+ llvm::NamedRegionTimer T("actongenericselection",
+ "Act On Generic Selection Expr", GroupName,
+ GroupDescription, llvm::TimePassesIsEnabled);
+
unsigned NumAssocs = ArgTypes.size();
assert(NumAssocs == ArgExprs.size());
@@ -1520,6 +1525,9 @@ static ExprResult BuildCookedLiteralOperatorCall(Sema &S, Scope *Scope,
ExprResult
Sema::ActOnStringLiteral(ArrayRef<Token> StringToks, Scope *UDLScope) {
assert(!StringToks.empty() && "Must have at least one string!");
+ llvm::NamedRegionTimer T("actonstringliteral", "Act On String Literal",
+ GroupName, GroupDescription,
+ llvm::TimePassesIsEnabled);
StringLiteralParser Literal(StringToks, PP);
if (Literal.hadError)
@@ -2027,6 +2035,9 @@ Sema::ActOnIdExpression(Scope *S, CXXScopeSpec &SS,
bool IsInlineAsmIdentifier, Token *KeywordReplacement) {
assert(!(IsAddressOfOperand && HasTrailingLParen) &&
"cannot be direct & operand and have a trailing lparen");
+ llvm::NamedRegionTimer T("actonid", "Act On Id Expression",
+ GroupName, GroupDescription,
+ llvm::TimePassesIsEnabled);
if (SS.isInvalid())
return ExprError();
@@ -3063,6 +3074,10 @@ ExprResult Sema::BuildPredefinedExpr(SourceLocation Loc,
}
ExprResult Sema::ActOnPredefinedExpr(SourceLocation Loc, tok::TokenKind Kind) {
+ llvm::NamedRegionTimer T("actonpredefined", "Act On Predefined Expr",
+ GroupName, GroupDescription,
+ llvm::TimePassesIsEnabled);
+
PredefinedExpr::IdentType IT;
switch (Kind) {
diff --git a/clang/lib/Sema/SemaTemplate.cpp b/clang/lib/Sema/SemaTemplate.cpp
index 9cc1bd529ff..9df697eebef 100644
--- a/clang/lib/Sema/SemaTemplate.cpp
+++ b/clang/lib/Sema/SemaTemplate.cpp
@@ -32,6 +32,7 @@
#include "llvm/ADT/SmallBitVector.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/StringExtras.h"
+#include "llvm/Support/Timer.h"
#include <iterator>
using namespace clang;
@@ -303,6 +304,9 @@ void Sema::LookupTemplateName(LookupResult &Found,
QualType ObjectType,
bool EnteringContext,
bool &MemberOfUnknownSpecialization) {
+ llvm::NamedRegionTimer T("lookuptemplate", "Lookup Template Name",
+ GroupName, GroupDescription,
+ llvm::TimePassesIsEnabled);
// Determine where to perform name lookup
MemberOfUnknownSpecialization = false;
DeclContext *LookupCtx = nullptr;
@@ -543,6 +547,9 @@ Sema::ActOnDependentIdExpression(const CXXScopeSpec &SS,
const DeclarationNameInfo &NameInfo,
bool isAddressOfOperand,
const TemplateArgumentListInfo *TemplateArgs) {
+ llvm::NamedRegionTimer T("actondependent",
+ "Act On Dependent Id Expression", GroupName,
+ GroupDescription, llvm::TimePassesIsEnabled);
DeclContext *DC = getFunctionLevelDeclContext();
// C++11 [expr.prim.general]p12:
OpenPOWER on IntegriCloud