BaseTools: change more list to set
authorCarsey, Jaben </o=Intel/ou=Americas01/cn=Workers/cn=Carsey, Jaben>
Thu, 5 Apr 2018 23:14:00 +0000 (07:14 +0800)
committerYonghong Zhu <yonghong.zhu@intel.com>
Tue, 10 Apr 2018 02:05:15 +0000 (10:05 +0800)
potentially accelerate "in" testing
remove uncalled function

Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
BaseTools/Source/Python/AutoGen/AutoGen.py
BaseTools/Source/Python/AutoGen/BuildEngine.py

index b646738ea01878ef2debcdd77b673cec018ba837..5baabf2a0c74f293648ef46e216fbef5ea8e496b 100644 (file)
@@ -4179,7 +4179,7 @@ class ModuleAutoGen(AutoGen):
                     PcdItem = PcdComments + '\n  ' + PcdItem\r
                 AsBuiltInfDict['patchablepcd_item'].append(PcdItem)\r
 \r
-        HiiPcds = []\r
+        HiiPcds = set()\r
         for Pcd in Pcds + VfrPcds:\r
             PcdComments = ''\r
             PcdCommentList = []\r
@@ -4202,8 +4202,7 @@ class ModuleAutoGen(AutoGen):
                 #\r
                 if (SkuId, Pcd.TokenSpaceGuidCName, Pcd.TokenCName) in HiiPcds:\r
                     continue\r
-                else:\r
-                    HiiPcds.append((SkuId, Pcd.TokenSpaceGuidCName, Pcd.TokenCName))\r
+                HiiPcds.add((SkuId, Pcd.TokenSpaceGuidCName, Pcd.TokenCName))\r
             if (Pcd.TokenSpaceGuidCName, Pcd.TokenCName) in self._PcdComments:\r
                 PcdCommentList = self._PcdComments[Pcd.TokenSpaceGuidCName, Pcd.TokenCName][:]\r
             if HiiInfo:\r
index 0daed7da610db1340c273205b671cb55a1166b95..1663ddd21bb03ec03563053b836ec0873de98d3b 100644 (file)
@@ -161,7 +161,7 @@ class FileBuildRule:
 \r
         # Check input files\r
         self.IsMultipleInput = False\r
-        self.SourceFileExtList = []\r
+        self.SourceFileExtList = set()\r
         for File in Input:\r
             Base, Ext = os.path.splitext(File)\r
             if Base.find("*") >= 0:\r
@@ -172,8 +172,7 @@ class FileBuildRule:
                 # There's no "*" and "?" in file name\r
                 self.ExtraSourceFileList.append(File)\r
                 continue\r
-            if Ext not in self.SourceFileExtList:\r
-                self.SourceFileExtList.append(Ext)\r
+            self.SourceFileExtList.add(Ext)\r
 \r
         # Check output files\r
         self.DestFileList = []\r
@@ -194,16 +193,6 @@ class FileBuildRule:
         CommandString = "\n\t".join(self.CommandList)\r
         return "%s : %s\n\t%s" % (DestString, SourceString, CommandString)\r
 \r
-    ## Check if given file extension is supported by this rule\r
-    #\r
-    #   @param  FileExt     The extension of a file\r
-    #\r
-    #   @retval True        If the extension is supported\r
-    #   @retval False       If the extension is not supported\r
-    #\r
-    def IsSupported(self, FileExt):\r
-        return FileExt in self.SourceFileExtList\r
-\r
     def Instantiate(self, Macros={}):\r
         NewRuleObject = copy.copy(self)\r
         NewRuleObject.BuildTargets = {}\r
@@ -365,8 +354,8 @@ class BuildRule:
         self._State = ""\r
         self._RuleInfo = tdict(True, 2)     # {toolchain family : {"InputFile": {}, "OutputFile" : [], "Command" : []}}\r
         self._FileType = ''\r
-        self._BuildTypeList = []\r
-        self._ArchList = []\r
+        self._BuildTypeList = set()\r
+        self._ArchList = set()\r
         self._FamilyList = []\r
         self._TotalToolChainFamilySet = set()\r
         self._RuleObjectList = [] # FileBuildRule object list\r
@@ -456,8 +445,8 @@ class BuildRule:
     #\r
     def ParseSectionHeader(self, LineIndex):\r
         self._RuleInfo = tdict(True, 2)\r
-        self._BuildTypeList = []\r
-        self._ArchList = []\r
+        self._BuildTypeList = set()\r
+        self._ArchList = set()\r
         self._FamilyList = []\r
         self._TotalToolChainFamilySet = set()\r
         FileType = ''\r
@@ -494,10 +483,8 @@ class BuildRule:
                     BuildType = TokenList[1]\r
                 if len(TokenList) > 2:\r
                     Arch = TokenList[2]\r
-            if BuildType not in self._BuildTypeList:\r
-                self._BuildTypeList.append(BuildType)\r
-            if Arch not in self._ArchList:\r
-                self._ArchList.append(Arch)\r
+            self._BuildTypeList.add(BuildType)\r
+            self._ArchList.add(Arch)\r
 \r
         if 'COMMON' in self._BuildTypeList and len(self._BuildTypeList) > 1:\r
             EdkLogger.error("build", FORMAT_INVALID,\r