diff options
Diffstat (limited to 'gcc/cp/semantics.c')
-rw-r--r-- | gcc/cp/semantics.c | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index 2fe2908bf86..8bd76120fc7 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -2887,7 +2887,7 @@ baselink_for_fns (tree fns) static bool outer_var_p (tree decl) { - return ((TREE_CODE (decl) == VAR_DECL || TREE_CODE (decl) == PARM_DECL) + return ((VAR_P (decl) || TREE_CODE (decl) == PARM_DECL) && DECL_FUNCTION_SCOPE_P (decl) && (DECL_CONTEXT (decl) != current_function_decl || parsing_nsdmi ())); @@ -3083,7 +3083,7 @@ finish_id_expression (tree id_expression, } else { - error (TREE_CODE (decl) == VAR_DECL + error (VAR_P (decl) ? G_("use of local variable with automatic storage from containing function") : G_("use of parameter from containing function")); error (" %q+#D declared here", decl); @@ -3259,7 +3259,7 @@ finish_id_expression (tree id_expression, /* If we found a variable, then name lookup during the instantiation will always resolve to the same VAR_DECL (or an instantiation thereof). */ - if (TREE_CODE (decl) == VAR_DECL + if (VAR_P (decl) || TREE_CODE (decl) == PARM_DECL) { mark_used (decl); @@ -3303,7 +3303,7 @@ finish_id_expression (tree id_expression, /* Mark variable-like entities as used. Functions are similarly marked either below or after overload resolution. */ - if ((TREE_CODE (decl) == VAR_DECL + if ((VAR_P (decl) || TREE_CODE (decl) == PARM_DECL || TREE_CODE (decl) == CONST_DECL || TREE_CODE (decl) == RESULT_DECL) @@ -3328,7 +3328,7 @@ finish_id_expression (tree id_expression, } tree wrap; - if (TREE_CODE (decl) == VAR_DECL + if (VAR_P (decl) && !cp_unevaluated_operand && DECL_THREAD_LOCAL_P (decl) && (wrap = get_tls_wrapper_fn (decl))) @@ -4061,7 +4061,7 @@ finish_omp_clauses (tree clauses) goto check_dup_generic; check_dup_generic: t = OMP_CLAUSE_DECL (c); - if (TREE_CODE (t) != VAR_DECL && TREE_CODE (t) != PARM_DECL) + if (!VAR_P (t) && TREE_CODE (t) != PARM_DECL) { if (processing_template_decl) break; @@ -4084,7 +4084,7 @@ finish_omp_clauses (tree clauses) case OMP_CLAUSE_FIRSTPRIVATE: t = OMP_CLAUSE_DECL (c); - if (TREE_CODE (t) != VAR_DECL && TREE_CODE (t) != PARM_DECL) + if (!VAR_P (t) && TREE_CODE (t) != PARM_DECL) { if (processing_template_decl) break; @@ -4106,7 +4106,7 @@ finish_omp_clauses (tree clauses) case OMP_CLAUSE_LASTPRIVATE: t = OMP_CLAUSE_DECL (c); - if (TREE_CODE (t) != VAR_DECL && TREE_CODE (t) != PARM_DECL) + if (!VAR_P (t) && TREE_CODE (t) != PARM_DECL) { if (processing_template_decl) break; @@ -4258,7 +4258,7 @@ finish_omp_clauses (tree clauses) t = OMP_CLAUSE_DECL (c); if (processing_template_decl - && TREE_CODE (t) != VAR_DECL && TREE_CODE (t) != PARM_DECL) + && !VAR_P (t) && TREE_CODE (t) != PARM_DECL) { pc = &OMP_CLAUSE_CHAIN (c); continue; @@ -4298,7 +4298,7 @@ finish_omp_clauses (tree clauses) break; case OMP_CLAUSE_COPYIN: - if (TREE_CODE (t) != VAR_DECL || !DECL_THREAD_LOCAL_P (t)) + if (!VAR_P (t) || !DECL_THREAD_LOCAL_P (t)) { error ("%qE must be %<threadprivate%> for %<copyin%>", t); remove = true; @@ -4325,7 +4325,7 @@ finish_omp_clauses (tree clauses) { const char *share_name = NULL; - if (TREE_CODE (t) == VAR_DECL && DECL_THREAD_LOCAL_P (t)) + if (VAR_P (t) && DECL_THREAD_LOCAL_P (t)) share_name = "threadprivate"; else switch (cxx_omp_predetermined_sharing (t)) { @@ -4392,7 +4392,7 @@ finish_omp_threadprivate (tree vars) if (error_operand_p (v)) ; - else if (TREE_CODE (v) != VAR_DECL) + else if (!VAR_P (v)) error ("%<threadprivate%> %qD is not file, namespace " "or block scope variable", v); /* If V had already been marked threadprivate, it doesn't matter @@ -5295,7 +5295,7 @@ finish_decltype_type (tree expr, bool id_expression_or_member_access_p, /* To get the size of a static data member declared as an array of unknown bound, we need to instantiate it. */ - if (TREE_CODE (expr) == VAR_DECL + if (VAR_P (expr) && VAR_HAD_UNKNOWN_BOUND (expr) && DECL_TEMPLATE_INSTANTIATION (expr)) instantiate_decl (expr, /*defer_ok*/true, /*expl_inst_mem*/false); @@ -5727,7 +5727,7 @@ tree ensure_literal_type_for_constexpr_object (tree decl) { tree type = TREE_TYPE (decl); - if (TREE_CODE (decl) == VAR_DECL && DECL_DECLARED_CONSTEXPR_P (decl) + if (VAR_P (decl) && DECL_DECLARED_CONSTEXPR_P (decl) && !processing_template_decl) { if (CLASS_TYPE_P (type) && !COMPLETE_TYPE_P (complete_type (type))) @@ -9200,7 +9200,7 @@ capture_decltype (tree decl) bool is_capture_proxy (tree decl) { - return (TREE_CODE (decl) == VAR_DECL + return (VAR_P (decl) && DECL_HAS_VALUE_EXPR_P (decl) && !DECL_ANON_UNION_VAR_P (decl) && LAMBDA_FUNCTION_P (DECL_CONTEXT (decl))); |