Add caching when looking up coroutine_traits
authorBrian Gesiak <modocache@gmail.com>
Sat, 14 Jul 2018 18:21:44 +0000 (18:21 +0000)
committerBrian Gesiak <modocache@gmail.com>
Sat, 14 Jul 2018 18:21:44 +0000 (18:21 +0000)
commit3e65d9a6fab74f83ae952f117abfcaf63e7780f2
tree1797f6a544396a035fc506c1adcb5ed9d31f1ace
parent0f5ec8921b31da4befe64e01e46afbf0ce7d6e88
Add caching when looking up coroutine_traits

Summary:
Currently clang looks up the coroutine_traits ClassTemplateDecl
everytime it looks up the promise type. This is unnecessary
as coroutine_traits doesn't change between promise type lookups.

This diff caches the coroutine_traits lookup.

Patch by Tanoy Sinha!

Test Plan:
I added log statements in the new lookupCoroutineTraits function
to ensure that LookupQualifiedName was only called once even
when multiple coroutines existed in the source file.

Reviewers: modocache, GorNishanov

Reviewed By: modocache

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D48981

llvm-svn: 337103
clang/include/clang/Sema/Sema.h
clang/lib/Sema/Sema.cpp
clang/lib/Sema/SemaCoroutine.cpp