diff options
author | Nathan Sidwell <nathan@acm.org> | 2020-05-14 07:20:35 -0700 |
---|---|---|
committer | Nathan Sidwell <nathan@acm.org> | 2020-05-14 07:20:35 -0700 |
commit | ea5a33d4536ce2af90255782bda0ada632952205 (patch) | |
tree | 4aba278f3d3a36bd48a5cc3f7a03382cc54343b9 | |
parent | 5adbd0907563f494b602b9f38283d29c7b029bdf (diff) | |
download | gcc-ea5a33d4536ce2af90255782bda0ada632952205.zip gcc-ea5a33d4536ce2af90255782bda0ada632952205.tar.gz gcc-ea5a33d4536ce2af90255782bda0ada632952205.tar.bz2 |
c++: simplify lookup_template_class_1
We were checking TYPE_NAME and then copying it if not null. Just copy
it, and then see if we got null.
* pt.c (lookup_template_class_1): Remove unnecessary else by
simply grabbing TYPE_NAME earlier.
-rw-r--r-- | gcc/cp/ChangeLog | 3 | ||||
-rw-r--r-- | gcc/cp/pt.c | 5 |
2 files changed, 5 insertions, 3 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 9bc3e8d..ab6130e 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,8 @@ 2020-05-14 Nathan Sidwell <nathan@acm.org> + * pt.c (lookup_template_class_1): Remove unnecessary else by + simply grabbing TYPE_NAME earlier. + * pt.c (push_template_decl_real): Adjust friend pushing logic. Reinit template type. diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 68d113b..55f72e3 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -9919,7 +9919,8 @@ lookup_template_class_1 (tree d1, tree arglist, tree in_decl, tree context, /* If we called start_enum or pushtag above, this information will already be set up. */ - if (!TYPE_NAME (t)) + type_decl = TYPE_NAME (t); + if (!type_decl) { TYPE_CONTEXT (t) = FROB_CONTEXT (context); @@ -9928,8 +9929,6 @@ lookup_template_class_1 (tree d1, tree arglist, tree in_decl, tree context, DECL_SOURCE_LOCATION (type_decl) = DECL_SOURCE_LOCATION (TYPE_STUB_DECL (template_type)); } - else - type_decl = TYPE_NAME (t); if (CLASS_TYPE_P (template_type)) { |