diff options
Diffstat (limited to 'gcc/cp/semantics.c')
-rw-r--r-- | gcc/cp/semantics.c | 83 |
1 files changed, 33 insertions, 50 deletions
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index 2365a732cbe..06dee5a6669 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -2300,18 +2300,7 @@ finish_call_expr (tree fn, vec<tree, va_gc> **args, bool disallow_virtual, with no type; type_dependent_expression_p recognizes expressions with no type as being dependent. */ if (type_dependent_expression_p (fn) - || any_type_dependent_arguments_p (*args) - /* For a non-static member function that doesn't have an - explicit object argument, we need to specifically - test the type dependency of the "this" pointer because it - is not included in *ARGS even though it is considered to - be part of the list of arguments. Note that this is - related to CWG issues 515 and 1005. */ - || (TREE_CODE (fn) != COMPONENT_REF - && non_static_member_function_p (fn) - && !DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P (get_first_fn (fn)) - && current_class_ref - && type_dependent_expression_p (current_class_ref))) + || any_type_dependent_arguments_p (*args)) { result = build_nt_call_vec (fn, *args); SET_EXPR_LOCATION (result, EXPR_LOC_OR_LOC (fn, input_location)); @@ -2399,17 +2388,6 @@ finish_call_expr (tree fn, vec<tree, va_gc> **args, bool disallow_virtual, object = maybe_dummy_object (BINFO_TYPE (BASELINK_ACCESS_BINFO (fn)), NULL); - if (processing_template_decl) - { - if (type_dependent_expression_p (object)) - { - tree ret = build_nt_call_vec (orig_fn, orig_args); - release_tree_vector (orig_args); - return ret; - } - object = build_non_dependent_expr (object); - } - result = build_new_method_call (object, fn, args, NULL_TREE, (disallow_virtual ? LOOKUP_NORMAL|LOOKUP_NONVIRTUAL @@ -5793,8 +5771,7 @@ cp_finish_omp_clause_depend_sink (tree sink_clause) Remove any elements from the list that are invalid. */ tree -finish_omp_clauses (tree clauses, bool allow_fields, bool declare_simd, - bool is_cilk) +finish_omp_clauses (tree clauses, enum c_omp_region_type ort) { bitmap_head generic_head, firstprivate_head, lastprivate_head; bitmap_head aligned_head, map_head, map_field_head; @@ -5820,17 +5797,18 @@ finish_omp_clauses (tree clauses, bool allow_fields, bool declare_simd, switch (OMP_CLAUSE_CODE (c)) { case OMP_CLAUSE_SHARED: - field_ok = allow_fields; + field_ok = ((ort & C_ORT_OMP_DECLARE_SIMD) == C_ORT_OMP); goto check_dup_generic; case OMP_CLAUSE_PRIVATE: - field_ok = allow_fields; + field_ok = ((ort & C_ORT_OMP_DECLARE_SIMD) == C_ORT_OMP); goto check_dup_generic; case OMP_CLAUSE_REDUCTION: - field_ok = allow_fields; + field_ok = ((ort & C_ORT_OMP_DECLARE_SIMD) == C_ORT_OMP); t = OMP_CLAUSE_DECL (c); if (TREE_CODE (t) == TREE_LIST) { - if (handle_omp_array_sections (c, allow_fields)) + if (handle_omp_array_sections (c, ((ort & C_ORT_OMP_DECLARE_SIMD) + == C_ORT_OMP))) { remove = true; break; @@ -5858,14 +5836,14 @@ finish_omp_clauses (tree clauses, bool allow_fields, bool declare_simd, goto check_dup_generic; case OMP_CLAUSE_COPYPRIVATE: copyprivate_seen = true; - field_ok = allow_fields; + field_ok = ((ort & C_ORT_OMP_DECLARE_SIMD) == C_ORT_OMP); goto check_dup_generic; case OMP_CLAUSE_COPYIN: goto check_dup_generic; case OMP_CLAUSE_LINEAR: - field_ok = allow_fields; + field_ok = ((ort & C_ORT_OMP_DECLARE_SIMD) == C_ORT_OMP); t = OMP_CLAUSE_DECL (c); - if (!declare_simd + if (ort != C_ORT_OMP_DECLARE_SIMD && OMP_CLAUSE_LINEAR_KIND (c) != OMP_CLAUSE_LINEAR_DEFAULT) { error_at (OMP_CLAUSE_LOCATION (c), @@ -5890,7 +5868,7 @@ finish_omp_clauses (tree clauses, bool allow_fields, bool declare_simd, } if (TREE_CODE (type) == REFERENCE_TYPE) type = TREE_TYPE (type); - if (is_cilk) + if (ort == C_ORT_CILK) { if (!INTEGRAL_TYPE_P (type) && !SCALAR_FLOAT_TYPE_P (type) @@ -5925,7 +5903,7 @@ finish_omp_clauses (tree clauses, bool allow_fields, bool declare_simd, } else if (!type_dependent_expression_p (t) && !INTEGRAL_TYPE_P (TREE_TYPE (t)) - && (!declare_simd + && (ort != C_ORT_OMP_DECLARE_SIMD || TREE_CODE (t) != PARM_DECL || TREE_CODE (TREE_TYPE (t)) != REFERENCE_TYPE || !INTEGRAL_TYPE_P (TREE_TYPE (TREE_TYPE (t))))) @@ -5937,7 +5915,7 @@ finish_omp_clauses (tree clauses, bool allow_fields, bool declare_simd, else { t = mark_rvalue_use (t); - if (declare_simd && TREE_CODE (t) == PARM_DECL) + if (ort == C_ORT_OMP_DECLARE_SIMD && TREE_CODE (t) == PARM_DECL) { OMP_CLAUSE_LINEAR_VARIABLE_STRIDE (c) = 1; goto check_dup_generic; @@ -5946,7 +5924,7 @@ finish_omp_clauses (tree clauses, bool allow_fields, bool declare_simd, && (VAR_P (OMP_CLAUSE_DECL (c)) || TREE_CODE (OMP_CLAUSE_DECL (c)) == PARM_DECL)) { - if (declare_simd) + if (ort == C_ORT_OMP_DECLARE_SIMD) { t = maybe_constant_value (t); if (TREE_CODE (t) != INTEGER_CST) @@ -5981,7 +5959,7 @@ finish_omp_clauses (tree clauses, bool allow_fields, bool declare_simd, else if (TREE_CODE (type) == POINTER_TYPE /* Can't multiply the step yet if *this is still incomplete type. */ - && (!declare_simd + && (ort != C_ORT_OMP_DECLARE_SIMD || TREE_CODE (OMP_CLAUSE_DECL (c)) != PARM_DECL || !DECL_ARTIFICIAL (OMP_CLAUSE_DECL (c)) || DECL_NAME (OMP_CLAUSE_DECL (c)) @@ -6018,7 +5996,7 @@ finish_omp_clauses (tree clauses, bool allow_fields, bool declare_simd, t = OMP_CLAUSE_DECL (c); check_dup_generic_t: if (t == current_class_ptr - && (!declare_simd + && (ort != C_ORT_OMP_DECLARE_SIMD || (OMP_CLAUSE_CODE (c) != OMP_CLAUSE_LINEAR && OMP_CLAUSE_CODE (c) != OMP_CLAUSE_UNIFORM))) { @@ -6084,7 +6062,8 @@ finish_omp_clauses (tree clauses, bool allow_fields, bool declare_simd, break; } if (!VAR_P (t) && TREE_CODE (t) != PARM_DECL - && (!allow_fields || TREE_CODE (t) != FIELD_DECL)) + && ((ort & C_ORT_OMP_DECLARE_SIMD) != C_ORT_OMP + || TREE_CODE (t) != FIELD_DECL)) { if (processing_template_decl) break; @@ -6123,7 +6102,8 @@ finish_omp_clauses (tree clauses, bool allow_fields, bool declare_simd, break; } if (!VAR_P (t) && TREE_CODE (t) != PARM_DECL - && (!allow_fields || TREE_CODE (t) != FIELD_DECL)) + && ((ort & C_ORT_OMP_DECLARE_SIMD) != C_ORT_OMP + || TREE_CODE (t) != FIELD_DECL)) { if (processing_template_decl) break; @@ -6466,7 +6446,7 @@ finish_omp_clauses (tree clauses, bool allow_fields, bool declare_simd, case OMP_CLAUSE_ALIGNED: t = OMP_CLAUSE_DECL (c); - if (t == current_class_ptr && !declare_simd) + if (t == current_class_ptr && ort != C_ORT_OMP_DECLARE_SIMD) { error ("%<this%> allowed in OpenMP only in %<declare simd%>" " clauses"); @@ -6549,7 +6529,8 @@ finish_omp_clauses (tree clauses, bool allow_fields, bool declare_simd, } if (TREE_CODE (t) == TREE_LIST) { - if (handle_omp_array_sections (c, allow_fields)) + if (handle_omp_array_sections (c, ((ort & C_ORT_OMP_DECLARE_SIMD) + == C_ORT_OMP))) remove = true; break; } @@ -6583,7 +6564,8 @@ finish_omp_clauses (tree clauses, bool allow_fields, bool declare_simd, t = OMP_CLAUSE_DECL (c); if (TREE_CODE (t) == TREE_LIST) { - if (handle_omp_array_sections (c, allow_fields)) + if (handle_omp_array_sections (c, ((ort & C_ORT_OMP_DECLARE_SIMD) + == C_ORT_OMP))) remove = true; else { @@ -6638,7 +6620,7 @@ finish_omp_clauses (tree clauses, bool allow_fields, bool declare_simd, OMP_CLAUSE_DECL (c) = t; } if (TREE_CODE (t) == COMPONENT_REF - && allow_fields + && (ort & C_ORT_OMP_DECLARE_SIMD) == C_ORT_OMP && OMP_CLAUSE_CODE (c) != OMP_CLAUSE__CACHE_) { if (type_dependent_expression_p (t)) @@ -6778,7 +6760,7 @@ finish_omp_clauses (tree clauses, bool allow_fields, bool declare_simd, handle_map_references: if (!remove && !processing_template_decl - && allow_fields + && (ort & C_ORT_OMP_DECLARE_SIMD) == C_ORT_OMP && TREE_CODE (TREE_TYPE (OMP_CLAUSE_DECL (c))) == REFERENCE_TYPE) { t = OMP_CLAUSE_DECL (c); @@ -6972,7 +6954,7 @@ finish_omp_clauses (tree clauses, bool allow_fields, bool declare_simd, case OMP_CLAUSE_IS_DEVICE_PTR: case OMP_CLAUSE_USE_DEVICE_PTR: - field_ok = allow_fields; + field_ok = (ort & C_ORT_OMP_DECLARE_SIMD) == C_ORT_OMP; t = OMP_CLAUSE_DECL (c); if (!type_dependent_expression_p (t)) { @@ -7112,7 +7094,7 @@ finish_omp_clauses (tree clauses, bool allow_fields, bool declare_simd, need_implicitly_determined = true; break; case OMP_CLAUSE_LINEAR: - if (!declare_simd) + if (ort != C_ORT_OMP_DECLARE_SIMD) need_implicitly_determined = true; else if (OMP_CLAUSE_LINEAR_VARIABLE_STRIDE (c) && !bitmap_bit_p (&map_head, @@ -8069,7 +8051,7 @@ finish_omp_for (location_t locus, enum tree_code code, tree declv, { if (orig_incr) TREE_VEC_ELT (orig_incr, i) = incr; - incr = cp_build_modify_expr (TREE_OPERAND (incr, 0), + incr = cp_build_modify_expr (elocus, TREE_OPERAND (incr, 0), TREE_CODE (TREE_OPERAND (incr, 1)), TREE_OPERAND (incr, 2), tf_warning_or_error); @@ -8103,7 +8085,8 @@ finish_omp_for (location_t locus, enum tree_code code, tree declv, if (!processing_template_decl) { init = fold_build_cleanup_point_expr (TREE_TYPE (init), init); - init = cp_build_modify_expr (decl, NOP_EXPR, init, tf_warning_or_error); + init = cp_build_modify_expr (elocus, decl, NOP_EXPR, init, + tf_warning_or_error); } else init = build2 (MODIFY_EXPR, void_type_node, decl, init); @@ -8342,7 +8325,7 @@ finish_omp_for (location_t locus, enum tree_code code, tree declv, OMP_CLAUSE_OPERAND (c, 0) = cilk_for_number_of_iterations (omp_for); OMP_CLAUSE_CHAIN (c) = clauses; - OMP_PARALLEL_CLAUSES (omp_par) = finish_omp_clauses (c, false); + OMP_PARALLEL_CLAUSES (omp_par) = finish_omp_clauses (c, C_ORT_CILK); add_stmt (omp_par); return omp_par; } |