From patchwork Fri Oct 31 14:28:14 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnaud Charlet X-Patchwork-Id: 405325 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 2C5AB14007D for ; Sat, 1 Nov 2014 01:28:29 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:mime-version:content-type; q=dns; s=default; b=V9fZnC+qrLKS+4TwX3L5ukVyNa8qU1lMWE7SgiImUK5kE/4tLM k0zVHs0MMsraU/UHarGszTJT1/m13N5jvF86ayxfnENDH7R5NUmxrW8gVIIWIgh1 r0wlxseKd3ejgrXP8biDl4aJ3F3WRNxCNDN17r4Dmt1H/0vLE9YwZjMoU= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:mime-version:content-type; s= default; bh=WR6arR5QcN/3+daKlzUAiDWahAU=; b=NQufaIUKt+3eWuaehjMV Ca+vO2HXGWJlFTp0prDip9+Z7Zj6a2WjwwR6cayzimcFJeFs4nW1cYsMR30rpEey IxTlxen3Rp9v2HgHB33QVPN5uK9BhzuSZyh9kOzhgCG2GEMMD1nRIl2J/IT4DqUK +lAPH+TvrUX5XmLIsemr7i4= Received: (qmail 14746 invoked by alias); 31 Oct 2014 14:28:21 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 14725 invoked by uid 89); 31 Oct 2014 14:28:20 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00, FILL_THIS_FORM autolearn=ham version=3.3.2 X-HELO: rock.gnat.com Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Fri, 31 Oct 2014 14:28:17 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 96DCB1163D1; Fri, 31 Oct 2014 10:28:14 -0400 (EDT) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id qMTcCfeZWyPg; Fri, 31 Oct 2014 10:28:14 -0400 (EDT) Received: from kwai.gnat.com (unknown [IPv6:2620:20:4000:0:7a2b:cbff:fe60:cb11]) by rock.gnat.com (Postfix) with ESMTP id 84975116362; Fri, 31 Oct 2014 10:28:14 -0400 (EDT) Received: by kwai.gnat.com (Postfix, from userid 4192) id 7C59E91A83; Fri, 31 Oct 2014 10:28:14 -0400 (EDT) Date: Fri, 31 Oct 2014 10:28:14 -0400 From: Arnaud Charlet To: gcc-patches@gcc.gnu.org Cc: Vincent Celier Subject: [Ada] Store the display name in the project node Message-ID: <20141031142814.GA19107@adacore.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) The Display_Name of a project is now store in its project node instead of a hash table. No change of functionality. Tested on x86_64-pc-linux-gnu, committed on trunk 2014-10-31 Vincent Celier * prj-part.adb (Parse_Single_Project): Call Set_Display_Name_Of. * prj-proc.adb (Recursive_Process): Call Display_Name_Of to get the project Display_Name. * prj-tree.adb (Display_Name_Of): New function (Set_Display_Name_Of): New procedure. (Create_Project): Call Set_Display_Name_Of. * prj-tree.ads (Display_Name_Of): New function. (Set_Display_Name_Of): New procedure. (Project_Node_Record): New component Display_Name. (Project_Name_And_Node): Remove component Display_Name. Index: prj-proc.adb =================================================================== --- prj-proc.adb (revision 216970) +++ prj-proc.adb (working copy) @@ -2765,6 +2765,10 @@ Success := not Prj.Tree.No (Loaded_Project); if Success then + if Node_Tree.Incomplete_With then + From_Project_Node_Tree.Incomplete_With := True; + end if; + List.Tree := new Project_Tree_Data (Is_Root_Tree => False); Prj.Initialize (List.Tree); List.Tree.Shared := In_Tree.Shared; @@ -2928,9 +2932,9 @@ Name : constant Name_Id := Name_Of (From_Project_Node, From_Project_Node_Tree); - Name_Node : constant Tree_Private_Part.Project_Name_And_Node := - Tree_Private_Part.Projects_Htable.Get - (From_Project_Node_Tree.Projects_HT, Name); + Display_Name : constant Name_Id := + Display_Name_Of + (From_Project_Node, From_Project_Node_Tree); begin Project := Processed_Projects.Get (Name); @@ -2994,15 +2998,8 @@ Processed_Projects.Set (Name, Project); Project.Name := Name; + Project.Display_Name := Display_Name; - -- Make sure that the project display name is never No_Name - - if Name_Node.Display_Name = No_Name then - Project.Display_Name := Name; - else - Project.Display_Name := Name_Node.Display_Name; - end if; - Get_Name_String (Name); -- If name starts with the virtual prefix, flag the project as Index: prj-part.adb =================================================================== --- prj-part.adb (revision 216965) +++ prj-part.adb (working copy) @@ -1298,7 +1298,6 @@ Name_From_Path : constant Name_Id := Project_Name_From (Path_Name, Is_Config_File => Is_Config_File); Name_Of_Project : Name_Id := No_Name; - Display_Name_Of_Project : Name_Id := No_Name; Duplicated : Boolean := False; @@ -1634,11 +1633,11 @@ end if; end; - -- Read the original casing of the project name + -- Read the original casing of the project name and put it in the + -- project node. declare Loc : Source_Ptr; - begin Loc := Location_Of (Project, In_Tree); for J in 1 .. Name_Len loop @@ -1646,7 +1645,7 @@ Loc := Loc + 1; end loop; - Display_Name_Of_Project := Name_Find; + Set_Display_Name_Of (Project, In_Tree, Name_Find); end; declare @@ -2018,7 +2017,6 @@ (T => In_Tree.Projects_HT, K => Name_Of_Project, E => (Name => Name_Of_Project, - Display_Name => Display_Name_Of_Project, Node => Project, Resolved_Path => Resolved_Path_Name, Extended => Extended, Index: prj-tree.adb =================================================================== --- prj-tree.adb (revision 216925) +++ prj-tree.adb (working copy) @@ -110,26 +110,27 @@ Project_Node_Table.Increment_Last (In_Tree.Project_Nodes); In_Tree.Project_Nodes.Table (Project_Node_Table.Last (In_Tree.Project_Nodes)) := - (Kind => N_Comment_Zones, - Qualifier => Unspecified, - Expr_Kind => Undefined, - Location => No_Location, - Directory => No_Path, - Variables => Empty_Node, - Packages => Empty_Node, - Pkg_Id => Empty_Package, - Name => No_Name, - Src_Index => 0, - Path_Name => No_Path, - Value => No_Name, - Default => Empty_Value, - Field1 => Empty_Node, - Field2 => Empty_Node, - Field3 => Empty_Node, - Field4 => Empty_Node, - Flag1 => False, - Flag2 => False, - Comments => Empty_Node); + (Kind => N_Comment_Zones, + Qualifier => Unspecified, + Expr_Kind => Undefined, + Location => No_Location, + Directory => No_Path, + Variables => Empty_Node, + Packages => Empty_Node, + Pkg_Id => Empty_Package, + Name => No_Name, + Display_Name => No_Name, + Src_Index => 0, + Path_Name => No_Path, + Value => No_Name, + Default => Empty_Value, + Field1 => Empty_Node, + Field2 => Empty_Node, + Field3 => Empty_Node, + Field4 => Empty_Node, + Flag1 => False, + Flag2 => False, + Comments => Empty_Node); Zone := Project_Node_Table.Last (In_Tree.Project_Nodes); In_Tree.Project_Nodes.Table (To).Comments := Zone; @@ -170,6 +171,7 @@ Packages => Empty_Node, Pkg_Id => Empty_Package, Name => No_Name, + Display_Name => No_Name, Src_Index => 0, Path_Name => No_Path, Value => Comments.Table (J).Value, @@ -339,6 +341,7 @@ Packages => Empty_Node, Pkg_Id => Empty_Package, Name => No_Name, + Display_Name => No_Name, Src_Index => 0, Path_Name => No_Path, Value => No_Name, @@ -432,6 +435,7 @@ Packages => Empty_Node, Pkg_Id => Empty_Package, Name => No_Name, + Display_Name => No_Name, Src_Index => 0, Path_Name => No_Path, Value => No_Name, @@ -469,6 +473,7 @@ Packages => Empty_Node, Pkg_Id => Empty_Package, Name => No_Name, + Display_Name => No_Name, Src_Index => 0, Path_Name => No_Path, Value => No_Name, @@ -504,6 +509,7 @@ Packages => Empty_Node, Pkg_Id => Empty_Package, Name => No_Name, + Display_Name => No_Name, Src_Index => 0, Path_Name => No_Path, Value => Comments.Table (J).Value, @@ -1225,6 +1231,22 @@ return In_Tree.Project_Nodes.Table (Node).Name; end Name_Of; + --------------------- + -- Display_Name_Of -- + --------------------- + + function Display_Name_Of + (Node : Project_Node_Id; + In_Tree : Project_Node_Tree_Ref) return Name_Id + is + begin + pragma Assert + (Present (Node) + and then + In_Tree.Project_Nodes.Table (Node).Kind = N_Project); + return In_Tree.Project_Nodes.Table (Node).Display_Name; + end Display_Name_Of; + -------------------- -- Next_Case_Item -- -------------------- @@ -2424,6 +2446,23 @@ In_Tree.Project_Nodes.Table (Node).Name := To; end Set_Name_Of; + ------------------------- + -- Set_Display_Name_Of -- + ------------------------- + + procedure Set_Display_Name_Of + (Node : Project_Node_Id; + In_Tree : Project_Node_Tree_Ref; + To : Name_Id) + is + begin + pragma Assert + (Present (Node) + and then + In_Tree.Project_Nodes.Table (Node).Kind = N_Project); + In_Tree.Project_Nodes.Table (Node).Display_Name := To; + end Set_Display_Name_Of; + ------------------------------- -- Set_Next_Declarative_Item -- ------------------------------- @@ -2949,6 +2988,7 @@ begin Project := Default_Project_Node (In_Tree, N_Project); Set_Name_Of (Project, In_Tree, Name); + Set_Display_Name_Of (Project, In_Tree, Name); Set_Directory_Of (Project, In_Tree, Path_Name_Type (Get_Directory (File_Name_Type (Full_Path)))); @@ -2968,7 +3008,6 @@ Name, Prj.Tree.Tree_Private_Part.Project_Name_And_Node' (Name => Name, - Display_Name => Name, Resolved_Path => No_Path, Node => Project, Extended => False, Index: prj-tree.ads =================================================================== --- prj-tree.ads (revision 216925) +++ prj-tree.ads (working copy) @@ -269,6 +269,12 @@ -- Valid for all non empty nodes. May return No_Name for nodes that have -- no names. + function Display_Name_Of + (Node : Project_Node_Id; + In_Tree : Project_Node_Tree_Ref) return Name_Id; + pragma Inline (Display_Name_Of); + -- Valid only for N_Project node. Returns the display name of the project. + function Kind_Of (Node : Project_Node_Id; In_Tree : Project_Node_Tree_Ref) return Project_Node_Kind; @@ -738,8 +744,15 @@ In_Tree : Project_Node_Tree_Ref; To : Name_Id); pragma Inline (Set_Name_Of); - -- Valid for all non empty nodes. + -- Valid for all non empty nodes + procedure Set_Display_Name_Of + (Node : Project_Node_Id; + In_Tree : Project_Node_Tree_Ref; + To : Name_Id); + pragma Inline (Set_Display_Name_Of); + -- Valid only for N_Project nodes + procedure Set_Kind_Of (Node : Project_Node_Id; In_Tree : Project_Node_Tree_Ref; @@ -1159,6 +1172,9 @@ Directory : Path_Name_Type := No_Path; -- Only for N_Project + Display_Name : Name_Id := No_Name; + -- Only for N_Project + Expr_Kind : Variable_Kind := Undefined; -- See below for what Project_Node_Kind it is used @@ -1479,9 +1495,6 @@ Name : Name_Id; -- Name of the project - Display_Name : Name_Id; - -- The name of the project as it appears in the .gpr file - Node : Project_Node_Id; -- Node of the project in table Project_Nodes @@ -1502,7 +1515,6 @@ No_Project_Name_And_Node : constant Project_Name_And_Node := (Name => No_Name, - Display_Name => No_Name, Node => Empty_Node, Resolved_Path => No_Path, Extended => True,