CN114647439A - Code scanning method, code migration method and related device - Google Patents

Code scanning method, code migration method and related device Download PDF

Info

Publication number
CN114647439A
CN114647439A CN202011524498.3A CN202011524498A CN114647439A CN 114647439 A CN114647439 A CN 114647439A CN 202011524498 A CN202011524498 A CN 202011524498A CN 114647439 A CN114647439 A CN 114647439A
Authority
CN
China
Prior art keywords
macro
code
information
conditional
source
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202011524498.3A
Other languages
Chinese (zh)
Inventor
刘继周
张汝涛
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Huawei Technologies Co Ltd
Original Assignee
Huawei Technologies Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Huawei Technologies Co Ltd filed Critical Huawei Technologies Co Ltd
Priority to CN202011524498.3A priority Critical patent/CN114647439A/en
Publication of CN114647439A publication Critical patent/CN114647439A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/76Adapting program code to run in a different environment; Porting
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/43Checking; Contextual analysis
    • G06F8/433Dependency analysis; Data or control flow analysis

Landscapes

  • Engineering & Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)

Abstract

The embodiment of the application provides a code scanning method, a code migration method and a related device. The method can scan the source code, accurately identify all effective macro and conditional compiled code blocks, efficiently identify the code segments needing to be migrated and provide accurate code transplantation suggestions.

Description

Code scanning method, code migration method and related device
Technical Field
The embodiment of the application relates to the technical field of computers, in particular to a code scanning method, a code migration method and a related device.
Background
Code Migration refers to moving programming Code from one system to another. The programming code refers to program code written using a programming language (e.g., C language, C + + language, Java language, Python language, etc.).
Currently, C/C + + code generally includes system Macro (Macro) and conditional compilation related to Central Processing Unit (CPU) architecture. During code migration, these CPU architecture-dependent macros increase the difficulty of code migration between different CPU architectures.
Specifically, in the process of processing C/C + + source code, the existing standard C/C + + preprocessor directly expands macro definition, selects only effective code block information for conditional compilation, and finally outputs a preprocessed intermediate file. The intermediate file obtained in this way cannot provide complete effective macro list information and conditional compiled code block information, so that the intermediate file cannot meet the migration requirements of C/C + + codes between different CPU architectures.
Disclosure of Invention
The embodiment of the application provides a code scanning method, a code migration method and a related device, which can scan a source code, accurately identify all effective macro and conditional compiled code blocks, efficiently identify code segments needing migration and give accurate code migration suggestions.
In a first aspect, an embodiment of the present application provides a method for code scanning, including: scanning a source code in a source file to obtain macro definition list information, macro reference context information and conditional compiled code block information, wherein the macro definition list information comprises macro definition information of macros in the source code, the macro reference context information comprises reference positions of the macros in the source file, and the conditional compiled code block information comprises macros related to all conditional branches; and generating an intermediate result file according to the macro definition list information, the macro reference context information and the conditional coding code block information. According to the method and the device, all effective information required in the code migration tool can be recorded and an intermediate result file can be generated in the C/C + + source code preprocessing process, and the intermediate result file is used for guiding source code scanning of the subsequent code migration tool.
With reference to the first aspect, in an implementation manner of an embodiment of the present application, scanning source code in a source file includes: and if the source file contains the header file, expanding and scanning the header file to obtain macro definition list information, macro reference context information and conditional coding code block information corresponding to the header file. In this implementation, the method can unroll the header file contained and identify valid macro information.
With reference to the first aspect, in an implementation manner of an embodiment of the present application, scanning source code in a source file to obtain macro definition list information, macro reference context information, and conditional compiled code block information includes: if the scanned text of the source code comprises the macro, recording macro definition information of the macro into macro definition list information; if the macro in the text scanned to the source code is quoted, recording the line number corresponding to the quoted position and the corresponding file identification to macro quote context information; and if the conditional coding code block in the text of the source code is scanned, recording codes related to all conditional branches in the conditional coding code block into the conditional coding code block information. In the implementation mode, the macro definition list information, the macro reference context information and the conditional compiled code block information included in the file analyze macro-related information needed by all code migration, so that a code migration tool can give an accurate code migration suggestion according to complete macro information.
With reference to the first aspect, in an implementation manner of the embodiment of the present application, before scanning the source code in the source file, the method further includes: and acquiring a preset macro definition and a white list macro information list related to the CPU architecture. In the implementation mode, the code migration tool can find out the macro definition related to the CPU architecture used after the code is migrated, so that the code migration tool only needs to migrate the macro related to the CPU architecture, the migrated data volume is greatly reduced, and the code migration efficiency is improved.
In a second aspect, an embodiment of the present application provides a method for code migration, including: acquiring an intermediate result file obtained by the code scanning method of the first aspect and a white list macro information list related to a preset Central Processing Unit (CPU) architecture; analyzing the intermediate result file to obtain macro definition list information, macro reference context information and conditional compilation code block information; selecting macro definition information related to a preset CPU architecture from the macro definition list information to form effective macro list information according to the white list macro information list; analyzing the conditional coding code block information to obtain macros related to each conditional branch; selecting a macro matched with the effective macro list information from the macros related to each conditional branch; locating a first source code position according to the macro referencing context information and the macro matched with the effective macro list information; and migrating the code or generating a migration suggestion corresponding to the first source code position after the first source code position is located. According to the method and the device, all the necessary effective information in the code migration tool can be recorded and an intermediate result file can be generated in the C/C + + source code preprocessing process. According to the macro definition list information, the macro reference context information and the condition compiling code block information in the intermediate result file, the code migration tool can analyze macro related information required by all code migration, so that the code migration tool can give an accurate code migration suggestion according to complete macro information.
With reference to the second aspect, in an implementation manner of the embodiment of the present application, the method further includes: and compiling codes among code segments corresponding to the code block information under the scanning condition, and confirming whether code migration is needed or not according to a preset rule. In this implementation, for codes between macro condition code blocks, the code migration tool performs progressive scanning by using the original processing logic, and needs to confirm whether code migration is needed, so that all macros in the source code can not be missed.
With reference to the second aspect, in an implementation manner of the embodiment of the present application, determining whether code migration is required according to a preset rule includes: selecting a macro matching the valid macro list information from macros in the code between the code segments; and migrating the code or generating a transplantation suggestion corresponding to the second source code position after the second source code position is positioned according to the macro reference context information and the macro matched with the effective macro list information. In the implementation mode, the code migration tool matches the relevant macros according to the effective macro list information, and can find out the macro definition relevant to the CPU architecture used after the codes are migrated, so that the code migration tool only needs to migrate the macros relevant to the CPU architecture, the migrated data volume is greatly reduced, and the code migration efficiency is improved.
With reference to the second aspect, in an implementation manner of the embodiment of the present application, the method further includes: and generating a code migration report according to the scanning processing result of all the source codes. In the implementation mode, the code migration tool can scan a plurality of source file source codes through the intermediate result file, and after the scanning is completed, a code migration report is generated for a user to download and guide the completion of the code migration.
In a third aspect, an embodiment of the present application provides an apparatus for code scanning, including: the acquisition module is used for acquiring a source file; the processing module scans a source code in a source file by a user to obtain macro definition list information, macro reference context information and conditional compiled code block information, wherein the macro definition list information comprises macro definition information of macros in the source code, the macro reference context information comprises reference positions of the macros in the source file, and the conditional compiled code block information comprises macros related to all conditional branches; the processing module is further configured to generate an intermediate result file according to the macro definition list information, the macro reference context information, and the conditional compiled code block information. The technical effects of the apparatus of the third aspect of the present application can be understood by referring to the related effects of the method portion of the first aspect, and are not described herein again.
With reference to the third aspect, in an implementation manner of the embodiment of the present application, the processing module is configured to: and if the source file contains the header file, expanding and scanning the header file to obtain macro definition list information, macro reference context information and conditional coding code block information corresponding to the header file.
With reference to the third aspect, in an implementation manner of the embodiment of the present application, the processing module is configured to: if the scanned text of the source code comprises the macro, recording macro definition information of the macro into macro definition list information; if the macro in the text scanned to the source code is quoted, recording the line number corresponding to the quoted position and the corresponding file identification to macro quote context information; and if the conditional coding code block in the text of the source code is scanned, recording codes related to all conditional branches in the conditional coding code block into the conditional coding code block information.
With reference to the third aspect, in an implementation manner of the embodiment of the present application, the obtaining module is configured to: and acquiring a preset macro definition and a white list macro information list related to the CPU architecture.
In a fourth aspect, an embodiment of the present application provides an apparatus for code migration, including: an obtaining module, configured to obtain an intermediate result file obtained by the code scanning apparatus of the third aspect and a list of white list macro information related to a preset central processing unit CPU architecture; the processing module is used for analyzing the intermediate result file to obtain macro definition list information, macro reference context information and conditional coding code block information; the processing module is also used for selecting macro definition information related to a preset CPU architecture from the macro definition list information to form effective macro list information according to the white list macro information list; the processing module is also used for analyzing the conditional coding block information to obtain macros related to each conditional branch; the processing module is also used for selecting the macro matched with the effective macro list information from the macros related to each conditional branch; the processing module is further used for positioning to a first source code position according to the macro reference context information and the macro matched with the effective macro list information; and the processing module is also used for migrating the code after the first source code position is located or generating a transplantation suggestion corresponding to the first source code position. The technical effects of the apparatus of the fourth aspect of the present application can be understood by referring to the related effects of the method portion of the second aspect, which are not described herein again.
With reference to the fourth aspect, in an implementation manner of the embodiment of the present application, the processing module is configured to: and compiling codes among code segments corresponding to the code block information under the scanning condition, and confirming whether code migration is needed or not according to a preset rule.
With reference to the fourth aspect, in an implementation manner of the embodiment of the present application, the processing module is configured to: selecting a macro matching the valid macro list information from macros in the code between the code segments; and migrating the code or generating a transplantation suggestion corresponding to the second source code position after the second source code position is positioned according to the macro reference context information and the macro matched with the effective macro list information.
With reference to the fourth aspect, in an implementation manner of the embodiment of the present application, the processing module is configured to: and generating a code migration report according to the scanning processing result of all the source codes.
In a fifth aspect, an embodiment of the present application provides a device for code processing, including: one or more central processing units, a memory, a communication bus and a communication interface; the memory is a transient memory or a persistent memory, and program codes are stored in the memory; the communication interface is used for receiving and transmitting data; the central processor communicates with the memory over a communication bus, and program code in the memory is executed on the code processing device to perform the method of the first or second aspect. The technical effects of the apparatus of the fifth aspect of the present application can be understood by referring to the related effects of the method portions of the first aspect or the second aspect, which are not described herein again.
Drawings
Fig. 1 is a schematic diagram of a method for scanning a code according to an embodiment of the present application;
FIG. 2 is a schematic diagram of a logic processing unit according to an embodiment of the present application;
FIG. 3 is a flow chart of a method of code migration provided by an embodiment of the present application;
FIG. 4 is an exemplary diagram of a code migration tool provided by an embodiment of the present application;
FIG. 5 is a schematic diagram of an apparatus for scanning a code according to an embodiment of the present disclosure;
FIG. 6 is a schematic diagram of an apparatus for code migration according to an embodiment of the present application;
fig. 7 is a schematic diagram of a device for processing code according to an embodiment of the present application.
Detailed Description
The embodiment of the application provides a code scanning method, a code migration method and a related device, which can scan a source code, accurately identify all effective macro and conditional compiled code blocks, efficiently identify code segments needing migration and give accurate code migration suggestions.
The terms "first," "second," "third," "fourth," and the like in the description and in the claims of the present application and in the drawings described above, if any, are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the application described herein are capable of operation in sequences other than those illustrated or described herein. Furthermore, the terms "comprises," "comprising," and "corresponding" and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
In the embodiments of the present application, words such as "exemplary" or "for example" are used to mean serving as an example, instance, or illustration. Any embodiment or design described herein as "exemplary" or "e.g.," is not necessarily to be construed as preferred or advantageous over other embodiments or designs. Rather, use of the word "exemplary" or "such as" is intended to present concepts related in a concrete fashion.
For clarity and conciseness of the following descriptions of the various embodiments, a brief introduction to the related art is first given:
macro Definition (Macro Definition): is a name for batch processing. Macros in computer science are abstractions that replace certain text patterns according to a set of predefined rules.
Macro replacement (Macro failure): at the location defined by the macro, the text information is replaced with the macro identifier. If other macro identifiers exist in the text information replaced by the macro identifiers, the macro expansion and replacement need to be performed recursively until the macro expansion cannot be performed.
Conditional Compilation (Conditional Compilation): conditional compilation uses a compilation implementation method. Allowing the compiler to control the executable program that produces the differences, generated by the parameters provided during compilation.
To explain the related art, the present application provides a section of source code as follows:
Figure BDA0002848464160000041
Figure BDA0002848464160000051
these 12 lines of source code are stored in the source file "macrotest.c". The codes of the first line and the second line can refer to macro definition information, and represent macro definitions used by the source file for subsequent codes. And (3) compiling the code segment according to the conditions from the 7 th line to the 11 th line, wherein the lines of codes detect whether the conditions of the seventh line are met or not when executed, if so, executing the codes of the eighth line, and if not, executing the codes of the 10 th line.
In the C/C + + code, system macros related to the CPU architecture are included, and conditional compilation increases the difficulty of code migration between different CPU architectures. The method has the advantages that the efficiency of manually identifying the code segments needing to be migrated is low, and in order to efficiently identify the code segments needing to be migrated and provide an accurate code transplanting suggestion, the source code needs to be scanned and all effective macro and conditional compiled code blocks are accurately identified.
In the existing standard C/C + + preprocessor, in the process of processing C/C + + source code, macro definitions are directly expanded, only effective code block information is selected for conditional compilation, and finally a preprocessed intermediate file is output. Complete and effective macro list information and conditional compiled code block information cannot be provided, and the migration requirements of the C/C + + codes among different CPU architectures cannot be met without the complete information.
Specifically, under different CPU architecture platforms, the identified macro and conditional compilation valid code segments of the first and existing standard C/C + + preprocessors are also different, and finally different intermediate result files are generated, which cannot ensure the consistency of the results. In addition, for example, a compiler of the GCC standard needs a platform to support a complete compiling environment, otherwise, the platform cannot support the running of the compiler.
Secondly, macro information scanned in the preprocessing process, macro replacement information and conditional compilation information are not recorded, effective macro list information and conditional code segment information required by C/C + + code migration cannot be provided after preprocessing is finished, code segments and code migration suggestions required to be migrated cannot be accurately identified, and finally the accuracy and efficiency of the whole code migration are affected.
Thirdly, the currently implemented C/C + + code migration tool scans the source code based on a white list or regular matching, and cannot accurately identify effective macro definition information (e.g., macros contained in a header file, user-defined macros, etc.), which may affect the selection of a correct conditional compiled code block, and may ultimately affect the accuracy of the final code migration.
In order to solve the above problems, embodiments of the present application provide a code scanning method, a code migration method, and a related apparatus, which can scan a source code, accurately identify all effective macro and conditional compiled code blocks, efficiently identify a code segment that needs to be migrated, and provide an accurate code migration suggestion.
Aiming at the problem that the preprocessor in the existing scheme does not record key information: the existing C/C + + preprocessor mainly selects effective code blocks through text replacement, macro expansion and conditional compilation of macro definitions, and finally generates an effective intermediate code file, but does not record macro definitions and conditional compilation code blocks scanned in each source file and header file in the preprocessing process. The information is just key information necessary for C/C + + code migration between different platforms, and only by accurately acquiring the effective information, the information can accurately provide code position information required for code migration for a code migration tool. The method provided by the embodiment of the application can record all the necessary effective information in the code migration tool and generate an intermediate result file in the C/C + + source code preprocessing process, so as to guide the source code scanning of the subsequent code migration tool.
Therefore, the embodiment of the present application provides a code scanning method, which is executed by a preprocessor (or called code scanning tool) and is used for generating an intermediate result file capable of recording key information. Fig. 1 is a schematic diagram of a method for scanning a code according to an embodiment of the present disclosure. The method comprises the following steps:
101. scanning a source code in a source file to obtain macro definition list information, macro reference context information and conditional compilation code block information;
in an embodiment of the present application, the macro definition list information includes macro definition information in the source code. If the preprocessor scans that the text of the source code comprises the macro definition, the macro definition is recorded into the macro definition list information. Illustratively, the first line of code and the second line of code in the aforementioned source file "macrotest.c" define two pieces of macro definition information, and the preprocessor scans and recognizes the first line of code and the second line of code as two pieces of macro definition information, and then may record them in the macro definition list information.
As an example, the embodiment of the present application provides macro definition list information of the source file "macrotest.c" as follows:
Figure BDA0002848464160000061
wherein, macrodefinitions indicates that the information is macro definition list information, macroName indicates the name of the macro defined by the macro, replayext is the replacement content (which may be referred to as macro replacement information) defined by the macro, lineNum indicates the number of lines (i.e. position) of the macro definition in the source code of the source file, macroTrace indicates the macro definition, and portable indicates whether the macro definition is portable. In practical applications, the preprocessor may record other information that may be richer if the source code also includes one. Alternatively, the preprocessor may record specified macro definition information according to actual needs, which is not limited in this embodiment of the application.
It is to be understood that, in the embodiment of the present application, the type of the macro definition information may be a common standard macro definition, or may be a macro defined by a user, which is not limited in the embodiment of the present application.
In the present embodiment, the macro-reference context information includes a location (source code location) defined using the macro in the source file. If the preprocessor scans the reference of the macro definition list information in the text of the source code, the line number where the reference is located and the corresponding file identification are recorded in the macro reference context information. Illustratively, the eighth line of the source file "macrotest.c" uses the macro definition "CONDITION _ ENABLE" and the tenth line uses the macro definition "CONDITION _ DISABLE", so that the preprocessor scans the macro reference context information after recognizing this CONDITION.
As an example, the embodiment of the present application provides macro-referencing context information of a source file "macrotest.c" as follows:
Figure BDA0002848464160000072
where macroRef indicates that the information is macro-reference context information and lineNum indicates the location (number of rows) where the macro definition is used. Other information is similar to the macro definition list information, and is not described herein again.
In the embodiment of the present application, the conditional coding code block information includes macro definition information to which all conditional branches refer. If the preprocessor scans a conditional coding code block in the text of the source code, recording codes related to all conditional branches in the conditional coding code block into conditional coding code block information. For example, if the seventh line to the eleventh line of the source code in the source file "macrotest.c" are compiled into code blocks, the preprocessor may record all macro definition information contained therein.
As an example, the embodiment of the present application provides conditional compiled code block information of a source file "macrotest.c" as follows:
Figure BDA0002848464160000071
Figure BDA0002848464160000081
wherein, the condition compilation indicates that the information is conditional coding code block information, startLineNum indicates the number of lines of the conditional coding code block, endLineNum indicates the number of lines of the conditional coding code block, condition type indicates the type format of the conditional coding code block, conditions indicates the specific content of the conditional coding code block, condition name indicates the condition name, level indicates the number of stages of macros used in the conditional coding code block, condition text indicates the specific content of the condition, condition value indicates the value that the condition is satisfied, macroList indicates the macro information in the conditional coding code block, macroName is the name defined by the macros, and macroText is the content defined by the macros.
102. And generating an intermediate result file according to the macro definition list information, the macro reference context information and the conditional coding code block information.
In the embodiment of the application, after the preprocessor scans the source code of the source file and records the macro definition list information, the macro reference context information and the conditional compiled code block information, the information can be combined to generate an intermediate result file. Illustratively, the content in the intermediate result file of the source file "macrotest.c" provided by the embodiments of the present application is as follows:
Figure BDA0002848464160000082
Figure BDA0002848464160000091
the JSON indicates that the file type of the intermediate result file is JSON, and in practical application, other types of files (such as Yaml or user-defined files) may also be used, which is not limited in the embodiment of the present application. fileName indicates to which source file the following information belongs. If the preprocessor scans a plurality of source files, the information recorded corresponding to the plurality of source files can be all stored in an intermediate result file.
As can be seen from the scanning process of the source code of the source file, the embodiment of the present application can record all macro definition list (including user-defined macro) information by scanning the C/C + + source code, where the macro definition list includes macro definition values, valid scope ranges, and locations of macro references in the source code. According to the method and the device, all condition compiled code blocks are identified by scanning C/C + + source codes, true and false values of all branches are calculated, macro lists used by all branches and values defined by all the macros are analyzed and recorded, finally, the starting positions of the condition compiled code blocks, nesting hierarchical relations and macro list information related to all the levels are stored in an intermediate file (such as Json, Yaml or a user-defined file) and used as the input of a subsequent code migration tool, and the code migration tool can be accurately positioned to the code position needing migration and insertion.
In some embodiments, when the preprocessor scans the source file, it identifies some files as header files, and then expands the header files and scans them to obtain macro definition list information, macro reference context information and conditional compiled code block information corresponding to the header files. Specifically, the preprocessor can identify whether the file is a normal source file or a header file by a file suffix. Illustratively, a file suffixed with ". h" then the file is a header file and a file suffix ". cpp" then the file is a source file. After the preprocessor identifies the header file, the header file can be expanded and scanned to obtain macro definition list information, macro reference context information and conditional coding code block information corresponding to the header file. After the header file is expanded, the preprocessor scans the header file in a manner similar to that of the source file scanning, which is not described herein again.
In some embodiments, before step 101, the preprocessor may further obtain a preset macro definition and a white list macro information list related to the architecture of the central processing unit CPU. The preset macro definition is obtained by the preprocessor, which is capable of obtaining the macro definition in the user command line from a cmake or Make construction tool. And the white list macro information list related to the CPU architecture can be read in a preset database.
Based on the method shown in fig. 1, the embodiment of the present application provides a logic processing unit, configured to perform source file source code scanning, and generate an intermediate result file. In some embodiments, the logical processing unit may also be referred to as a preprocessor and a code scanning tool, which is not limited in this application. Fig. 2 is a schematic diagram of a logic processing unit according to an embodiment of the present application. The logical processing unit first obtains the C/C + + source file. If the header file is contained, the logic processing unit expands and scans the header file. For source files that are not header files, a logical processing unit may scan its source code directly. The way of scanning the source file and the expanded header file by the logic processing unit is similar to the way of scanning the source file and the expanded header file in the embodiments corresponding to fig. 1, and is not described herein again. After the logic processing unit scans the source file and the expanded header file, the relevant macro definition list information, macro reference context information and conditional coding code block information can be obtained. After the logical processing unit has completed scanning all source files and header files, the logical processing unit may package these information into an intermediate result file.
The code scanning method provided by the embodiment of the application can scan the source code in the source file to obtain the macro definition list information, the macro citation context information and the conditional compilation code block information, and generate the corresponding intermediate result file, wherein the macro definition list information, the macro citation context information and the conditional compilation code block information in the file analyze macro-related information required by all code migration, so that the code migration tool can give an accurate code migration suggestion according to the complete macro information. The code migration tool conducts code migration guidance based on the macro information of the intermediate result file, and can improve code migration accuracy and code migration efficiency.
Specifically, the code migration tool may execute the method for code migration provided by the embodiment of the present application. Fig. 3 is a flowchart of a method for code migration according to an embodiment of the present application, where the flowchart includes:
301. acquiring a white list macro information list related to the intermediate result file and the CPU architecture;
in this embodiment of the present application, the intermediate result file may be an intermediate result file obtained by the method in each embodiment corresponding to fig. 1, or may also be an intermediate result file obtained by another method and including macro definition list information, macro reference context information, and conditional coding block information, which is not limited in this embodiment of the present application.
In this embodiment of the present application, the macro used in the source file source code may be related to a first type of CPU, and may also be related to a second type of CPU, where the first type of CPU and the second type of CPU may refer to a CPU in an X86 architecture, a CPU in an ARM architecture, and the like, which is not limited in this embodiment of the present application. When code migration is carried out, if the code migration tool can find out the macro definition related to the CPU architecture used after the code migration, the code migration tool only needs to migrate the macro related to the CPU architecture, so that the migration data volume is greatly reduced, and the code migration efficiency is improved. Specifically, if the source code is migrated from the X86 platform to the ARM platform, the code migration tool may obtain a white list macro information list related to the CPU of the ARM architecture.
It will be appreciated that in some embodiments, the preprocessor is a module in the code migration tool, and the code migration tool may read the intermediate result file directly from the preprocessor. In other embodiments, the preprocessor and the code migration tool are different devices, and the code migration tool may retrieve the intermediate result file from the preprocessor via data transfer.
302. Analyzing the intermediate result file to obtain macro definition list information, macro reference context information and conditional compilation code block information;
in this embodiment of the present application, the code migration tool may parse the intermediate result file to obtain macro definition list information, macro reference context information, and conditional compiled code block information. Illustratively, as described above, the intermediate result file obtained based on the source file "macrotest.c" indicates that the information corresponding to the title is macro definition list information, "macroRef" indicates that the information corresponding to the title is macro reference context information, and "conditioncompletion" indicates that the information corresponding to the title is conditional coding block information. The code migration tool can read the relevant title and then analyze the title to obtain the relevant information.
303. Selecting macro definition information related to a preset CPU architecture from the macro definition list information to form effective macro list information according to the white list macro information list;
in this embodiment of the present application, the code migration tool may select macro definition information related to a preset CPU architecture from the macro definition list information according to the whitelist macro information list to form effective macro list information. In particular, the code migration tool may select macro definition information from the macro definition list information that is also present in the whitelist macro information list to compose valid macro list information. Illustratively, the macro definition list information includes macro definition information of macro a, macro B, and macro C, and the whitelist macro information list includes only macro definition information of macro B and macro C, then the code migration tool may select the macro definition information of macro B and macro C from macro a, macro B, and macro C to compose effective macro list information.
304. Analyzing the conditional coding code block information to obtain macros related to each conditional branch;
in this embodiment, the code migration tool may compile code block information according to the obtained condition, and analyze the condition compiled code block information to obtain a macro related to each conditional branch. Specifically, the conditional coding code block information includes information of macros to which each conditional branch refers. Illustratively, an intermediate result file is obtained based on the source file "MacroTest.c" as described above, in which "[ ] macroList" and "macroName:" CONDITION _ ENABLE "indicate that the IF branch of the conditional compiled code block refers to macro CONDITION _ ENABLE. In practical applications, the code migration tool may compile macros to which each conditional branch of the code block information refers according to the conditions in the intermediate result file.
305. Selecting a macro matched with the effective macro list information from the macros related to each conditional branch;
in an embodiment of the present application, the code migration tool may select a macro matching the valid macro list information from the macros involved in each conditional branch. For example, the macro definition information in the valid macro list information is the macro information corresponding to the macro B and the macro C, and the code migration tool may select the macro B from the macro B, the macro D, and the macro E as the macro matching the valid macro list information.
306. According to the macro reference context information and the macro matched with the effective macro list information, positioning to a first source code position;
in an embodiment of the present application, the code migration tool may locate the first source code location based on the macro referencing context information and the macro matching the valid macro list information. In particular, the code migration tool may search the macro reference context information for the reference location of the macro that matches the valid macro list information and then locate the first source code location based on the reference location. Illustratively, macro B is a macro that matches the valid macro list information, and the reference location of macro B is on line 8 of the source file according to the macro reference context information, then the code migration tool may locate the first source code location as line 8.
307. And migrating the code or generating a migration suggestion corresponding to the first source code position after the first source code position is located.
In an embodiment of the present application, the code migration tool may migrate code after locating the first source code location. For example, after finding the macro B reference on line 8 of the source file, the code migration tool may insert the macro B reference-related code into the code migration report (and note that it is the macro B reference code), or may even automatically migrate the related code.
In other embodiments, the code migration tool may generate a migration suggestion corresponding to the first source code location after locating the first source code location. For example, after the code migration tool finds the macro B reference on line 8 of the source file, the code migration tool may generate a migration recommendation of "migrate the macro B reference on line 8 of the source file. In practical applications, the text of the migration suggestion may have other forms, which is not limited in the embodiments of the present application.
It will be appreciated that the code migration tool may also give relevant suggestions, or insert preset code segments, for macros in a conditional compiled code block that do not match the valid macro list information. For example, the macro X is a macro that is not matched with the valid macro list information in the conditional compiled code block, the code migration tool may suggest that the macro C is related to "the macro is not related to the CPU architecture, please perform reasonable conversion", or perform code conversion according to a preset rule, or insert a code corresponding to the macro into a code migration report for a user to view, which is not limited in the embodiment of the present application.
In some embodiments, the code migration tool may further scan codes between code segments corresponding to the conditional compiled code block information, and determine whether code migration is required according to a preset rule. Codes among conditional compiled code blocks are common, so that the code migration tool can adopt the original processing logic to perform line-by-line scanning and needs to confirm whether code migration needs to be performed or not. For example, the code migration tool may select a macro from the macros in the code between the code segments that matches the valid macro list information; and migrating the code or generating a transplantation suggestion corresponding to the second source code position after the second source code position is positioned according to the macro reference context information and the macro matched with the effective macro list information. For example, if the macro in the code between the code segments is macro X, macro Y, where macro X matches the valid macro list information, the code migration tool may determine that macro X is in XX row (second source code location) of the source file according to the macro reference context information, thereby migrating the code or generating a migration suggestion corresponding to the second source code location.
In some embodiments, the code migration tool may scan a plurality of source files through the intermediate result file, and after the scanning is completed, generate a code migration report for a user to download and instruct completion of the code migration.
Aiming at the problem that the existing scheme code migration tool does not completely record information: existing code migration tools are directed to platform-dependent macro definitions, and macro replacement is done based on white lists or specific canonical matches. Some macros are defined in a header file and are included and introduced through the header file. In addition, the repeated define or undedefine of some macros needs to be judged based on the context of preprocessing, whether the reference of a certain row of a certain file is valid, the value information of the macro, and the like, and the complete records are needed. In the embodiment of the application, in the process of preprocessing the C/C + + source code, the effective scope of each macro, the reference position of the macro in each file, the conditional compiled code block, and all macro information related to each conditional branch are collected.
Specifically, compared with the conventional code migration tool, the code migration tool of the embodiment of the present application has the following advantages:
(1) the traditional code migration tool is used for acquiring partial macros based on a white list defined by the macros, and the macro information cannot be completely identified without the context information of the macros, which is one of the reasons for causing tool false alarm. The code migration tool can analyze all macro context information, and can give an accurate code migration suggestion according to complete macro information.
(2) The recognition of the macro definition corresponding to the traditional code migration tool is based on regular expression matching, and the macro definition contained in the header file cannot be recognized, so that the finished macro list information cannot be acquired finally, which is also one of false alarms of the tool. The preprocessor in the code migration tool in the embodiment of the application can expand the contained header file and identify effective macro information.
(3) The traditional code migration tool scans the conditional compilation code segment line by line according to the regular matching, cannot see the context information of the whole conditional compilation code segment, and cannot quickly locate the conditional compilation code block needing code transplantation. The structured intermediate file generated by the preprocessor in the code migration tool in the embodiment of the application can provide context information of all conditional compiled code blocks in a source file, can be quickly positioned to a source code scanning position, and improves the efficiency of code scanning and migration.
FIG. 4 is an exemplary diagram of a code migration tool provided in an embodiment of the present application. The code migration tool may first obtain a scan source file list, where the source file list may include a source file 1, a source file 2, a source file 3, and the like, and the code migration tool may scan the source files one by one, or may scan a plurality of source files simultaneously, which is not limited in this embodiment of the present application. When all source files are scanned completely, the code migration tool can generate a scanning migration report according to the scanning result, so that a user can download and guide the completion of code migration.
Then, the code migration tool may generate an intermediate result file (or called structured format file) through a logic processing unit similar to that in fig. 2, where the generating process is similar to that in the foregoing method embodiments corresponding to fig. 1 for generating the intermediate result file according to the method, or similar to that in the foregoing embodiments corresponding to fig. 2 for generating the intermediate result file by the logic processing unit, and details are not repeated here.
After the code migration tool acquires the intermediate result file from the logic processing unit, macro definition list information, macro reference context information and conditional compiled code block information can be analyzed. Then, the code migration tool may extract the valid macro list information related to the specified CPU architecture from the macro definition list information according to the white list macro information list, and the process is similar to step 303 in each embodiment corresponding to fig. 3, and is not described herein again.
The code migration tool may compile code segments according to conditions for source file scanning. In particular, the code migration tool may analyze whether macros in the conditional compilation code segment support the desired CPU architecture through valid macro list information. And if the macro in the conditional compiling code segment supports the expected CPU architecture, positioning the source code position needing to be scanned according to the condition and the macro reference context information, and giving a migration suggestion. If the macro in the conditional compiling code segment does not support the expected CPU architecture, branch code insertion (for example, inserting the branch code corresponding to the macro into the code migration report) or generating a migration suggestion is carried out according to the condition and the macro reference context information. For the codes among the condition code blocks, the code migration tool adopts the original processing logic to perform line-by-line scanning, and needs to confirm whether the code migration needs to be performed or not.
And after the code migration tool finishes the whole source code scanning, generating a code migration report for a user to download and guide the completion of the code migration.
The code migration tool provided by the embodiment of the application can identify the effective macro information defined in each file context through a self-developed C/C + + scanning tool, and format and output the effective macro information to the intermediate result file. Moreover, the code migration tool provided by the embodiment of the application can identify the context information (such as line number, macro replacement content, whether the CPU architecture is related or not) referred by the macro definition in the source file, and format and output the context information into the formatted intermediate file. The subsequent code migration tool gives accurate migration suggestions according to the recorded macro-defined context information. Moreover, the code migration tool provided by the embodiment of the application can identify the conditional compilation code block, record the type, the starting line number, the nesting level and the effectiveness of each conditional branch of the conditional compilation, and format and output the conditional compilation code block to an intermediate file. The code migration tool can quickly locate the conditional compilation code block and judge whether to insert the code or give a transplanting suggestion according to the recorded conditional compilation information. Further, the code migration tool provided by the embodiment of the application can further identify macro list information on which each branch depends. The code migration tool can judge whether the conditional compiling code segment needs to be transplanted or not according to the macros used by all the branches, and can improve the code migration efficiency if the conditional compiling code segment does not need to be directly skipped over and scanned.
Fig. 5 is a schematic diagram of a code scanning apparatus according to an embodiment of the present application. The code scanning apparatus 500 includes:
an obtaining module 501, configured to obtain a source file;
a processing module 502, configured to perform step 101 and step 102 in the above-described embodiments corresponding to fig. 1.
Fig. 6 is a schematic diagram of an apparatus for code migration according to an embodiment of the present application. The apparatus 600 for code migration comprises:
an obtaining module 601, configured to execute step 301 in each embodiment corresponding to fig. 3.
A processing module 602, configured to perform step 301, step 302, step 303, step 304, step 305, step 306, and step 307 in the above-described embodiments corresponding to fig. 3.
Fig. 7 is a schematic diagram of a device for processing code according to an embodiment of the present application. The code processing apparatus 700 includes: one or more processors 701, a memory 703, and a communication interface 704, the processors 701, the memory 703, and the communication interface 704 may be connected by a communication bus 702. The memory 703 is used to store one or more programs; the one or more processors 701 are configured to execute the one or more programs, so that the apparatus 700 for code processing performs the methods corresponding to the above-described method embodiments.
The processor 701 may be a general-purpose Central Processing Unit (CPU), a Network Processor (NP), a microprocessor, or one or more integrated circuits such as an application-specific integrated circuit (ASIC), a Programmable Logic Device (PLD), or a combination thereof, for implementing the present invention. The PLD may be a Complex Programmable Logic Device (CPLD), a field-programmable gate array (FPGA), a General Array Logic (GAL), or any combination thereof.
A communication bus 702 is used to transfer information between the above components. The communication bus 702 may be divided into an address bus, a data bus, a control bus, and the like. For ease of illustration, only one thick line is shown in FIG. 7, but this does not indicate only one bus or one type of bus.
The Memory 703 may be a read-only Memory (ROM) or other type of static storage device that can store static information and instructions, a Random Access Memory (RAM) or other type of dynamic storage device that can store information and instructions, an electrically erasable programmable read-only Memory (EEPROM), a compact disc read-only Memory (CD-ROM) or other optical disc storage, optical disc storage (including compact disc, laser disc, optical disc, digital versatile disc, blu-ray disc, etc.), a magnetic disc storage medium, or other magnetic storage devices, or any other medium which can be used to carry or store desired program code in the form of instructions or data structures and which can be accessed by a computer, but is not limited to such. The memory 703 may be separate and coupled to the processor 701 by a communication bus 702. The memory 703 may also be integrated with the processor 701.
The communication interface 704 uses any transceiver or the like for communicating with other devices or a communication network. The communication interface 704 includes a wired communication interface, and may also include a wireless communication interface. The wired communication interface may be an ethernet interface, for example. The ethernet interface may be an optical interface, an electrical interface, or a combination thereof. The wireless communication interface may be a Wireless Local Area Network (WLAN) interface, a cellular network communication interface, or a combination thereof.
In particular implementations, processor 701 may include one or more CPUs, such as CPU0 and CPU1 shown in fig. 7, as one example.
In particular implementations, code processing apparatus 700 may comprise a plurality of processors, such as processor 701 and processor 705 shown in FIG. 7, for one embodiment. Each of these processors may be a single-Core Processor (CPU) or a multi-Core Processor (CPU). A processor herein may refer to one or more devices, circuits, and/or processing cores for processing data (e.g., computer program instructions).
In particular implementations, code processing apparatus 700 may also include an output device and an input device, as an embodiment. An output device is in communication with the processor 701 and may display information in a variety of ways. For example, the output device may be a Liquid Crystal Display (LCD), a Light Emitting Diode (LED) display device, a Cathode Ray Tube (CRT) display device, a projector (projector), or the like. The input device is in communication with the processor 701 and may receive user input in a variety of ways. For example, the input device may be a mouse, a keyboard, a touch screen device, or a sensing device, among others.
In some embodiments, the memory 703 is used for storing the program code 710 for implementing the present solution, and the processor 701 may execute the program code 710 stored in the memory 703. That is, the code processing apparatus 700 may implement the method for code scanning or the method for code migration provided by the method embodiment through the processor 701 and the program code 710 in the memory 703.
It should be understood that, for specific details, reference may be made to the above method embodiment, and for brevity, detailed description will not be provided herein for each unit and the other operations and/or functions in the code processing apparatus 700 to implement the method shown in fig. 1 or the method shown in fig. 3, or to implement the steps and methods implemented by the logic processing unit shown in fig. 2, or to implement the steps and methods implemented by the code migration tool shown in fig. 2.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the above-described systems, apparatuses and units may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
In the several embodiments provided in the present application, it should be understood that the disclosed system, apparatus and method may be implemented in other manners. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the units is only one logical division, and other divisions may be realized in practice, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present application may be substantially implemented or contributed to by the prior art, or all or part of the technical solution may be embodied in a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
The above embodiments are only used to illustrate the technical solutions of the present application, and not to limit the same; although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; such modifications or substitutions do not depart from the spirit and scope of the present disclosure as defined by the appended claims.

Claims (17)

1. A method of code scanning, comprising:
scanning a source code in a source file to obtain macro definition list information, macro reference context information and conditional compiled code block information, wherein the macro definition list information comprises macro definition information of macros in the source code, the macro reference context information comprises reference positions of the macros in the source file, and the conditional compiled code block information comprises macros related to all conditional branches;
and generating an intermediate result file according to the macro definition list information, the macro reference context information and the conditional coding code block information.
2. The method of claim 1, wherein scanning source code in a source file comprises:
and if the source file contains a header file, expanding and scanning the header file to obtain the macro definition list information, the macro reference context information and the conditional coding code block information corresponding to the header file.
3. The method according to claim 1 or 2, wherein the scanning the source code in the source file to obtain the macro definition list information, the macro reference context information and the conditional compiled code block information comprises:
if the scanned text of the source code comprises the macro, recording macro definition information of the macro into the macro definition list information;
if the macro in the text scanned to the source code is quoted, recording the line number corresponding to the quoted position and the corresponding file identification to the macro quoted context information;
and if the conditional coding code block in the text of the source code is scanned, recording codes related to all conditional branches in the conditional coding code block into the conditional coding code block information.
4. A method according to any one of claims 1 to 3, wherein prior to scanning the source code in the source file, the method further comprises:
and acquiring a preset macro definition and a white list macro information list related to a Central Processing Unit (CPU) architecture.
5. A method of code migration, comprising:
acquiring an intermediate result file obtained by the code scanning method of any one of claims 1 to 4 and a white list macro information list related to a preset Central Processing Unit (CPU) architecture;
analyzing the intermediate result file to obtain macro definition list information, macro reference context information and conditional compilation code block information;
selecting macro definition information related to a preset CPU architecture from the macro definition list information to form effective macro list information according to the white list macro information list;
analyzing the conditional coding code block information to obtain macros related to each conditional branch;
selecting a macro matched with the effective macro list information from the macros related to each conditional branch;
locating a first source code position according to the macro referencing context information and the macro matched with the effective macro list information;
and migrating the code or generating a migration suggestion corresponding to the first source code position after the first source code position is located.
6. The method of claim 5, further comprising:
and scanning codes among code segments corresponding to the conditional compiling code block information, and confirming whether code migration is needed or not according to a preset rule.
7. The method according to claim 6, wherein the confirming whether the code migration is required according to the preset rule comprises:
selecting a macro matching the valid macro list information from macros in code between the code segments;
and migrating the code or generating a transplantation suggestion corresponding to the second source code position after positioning to the second source code position according to the macro reference context information and the macro matched with the effective macro list information.
8. The method of claim 5, further comprising:
and generating a code migration report according to the scanning processing result of all the source codes.
9. An apparatus for code scanning, comprising:
the acquisition module is used for acquiring a source file;
a processing module, configured to scan a source code in the source file by a user to obtain macro definition list information, macro reference context information, and conditional compiled code block information, where the macro definition list information includes macro definition information of a macro in the source code, the macro reference context information includes a reference position of the macro in the source file, and the conditional compiled code block information includes macros to which all conditional branches relate;
the processing module is further configured to generate an intermediate result file according to the macro definition list information, the macro reference context information, and the conditional compiled code block information.
10. The apparatus of claim 9, wherein the processing module is configured to:
and if the source file contains a header file, expanding and scanning the header file to obtain the macro definition list information, the macro reference context information and the conditional coding code block information corresponding to the header file.
11. The apparatus of claim 9 or 10, wherein the processing module is configured to:
if the scanned text of the source code comprises the macro, recording macro definition information of the macro into the macro definition list information;
if the macro in the text scanned to the source code is quoted, recording the line number corresponding to the quoted position and the corresponding file identification to the macro quoted context information;
and if the conditional coding code block in the text of the source code is scanned, recording codes related to all conditional branches in the conditional coding code block into the conditional coding code block information.
12. The apparatus of any one of claims 9 to 11, wherein the obtaining module is configured to:
and acquiring a preset macro definition and a white list macro information list related to the CPU architecture.
13. An apparatus for code migration, comprising:
an obtaining module, configured to obtain an intermediate result file obtained by the code scanning apparatus according to any one of claims 9 to 12 and a white list macro information list related to a preset central processing unit CPU architecture;
the processing module is used for analyzing the intermediate result file to obtain macro definition list information, macro reference context information and conditional coding code block information;
the processing module is further configured to select macro definition information related to a preset CPU architecture from the macro definition list information to form effective macro list information according to the whitelist macro information list;
the processing module is further configured to analyze the conditional coding block information to obtain macros related to each conditional branch;
the processing module is further configured to select a macro matching the valid macro list information from macros related to each conditional branch;
the processing module is further used for positioning to a first source code position according to the macro reference context information and the macro matched with the effective macro list information;
the processing module is further configured to migrate the code after the first source code position is located or generate a migration suggestion corresponding to the first source code position.
14. The apparatus of claim 13, wherein the processing module is configured to:
and scanning codes among code segments corresponding to the conditional compiling code block information, and confirming whether code migration is needed or not according to a preset rule.
15. The apparatus of claim 14, wherein the processing module is configured to:
selecting a macro matching the valid macro list information from macros in code between the code segments;
and migrating the code or generating a transplantation suggestion corresponding to the second source code position after positioning to the second source code position according to the macro reference context information and the macro matched with the effective macro list information.
16. The apparatus of any one of claims 13 to 15, wherein the processing module is configured to:
and generating a code migration report according to the scanning processing result of all the source codes.
17. An apparatus for code processing, comprising: one or more central processing units, a memory, a communication bus and a communication interface;
the memory is a transient memory or a persistent memory, and program codes are stored in the memory;
the communication interface is used for receiving and transmitting data;
the central processor communicates with the memory through the communication bus, and program code in the memory is executed on the code processing device to perform the method of any one of claims 1 to 8.
CN202011524498.3A 2020-12-21 2020-12-21 Code scanning method, code migration method and related device Pending CN114647439A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011524498.3A CN114647439A (en) 2020-12-21 2020-12-21 Code scanning method, code migration method and related device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011524498.3A CN114647439A (en) 2020-12-21 2020-12-21 Code scanning method, code migration method and related device

Publications (1)

Publication Number Publication Date
CN114647439A true CN114647439A (en) 2022-06-21

Family

ID=81992451

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011524498.3A Pending CN114647439A (en) 2020-12-21 2020-12-21 Code scanning method, code migration method and related device

Country Status (1)

Country Link
CN (1) CN114647439A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116756103A (en) * 2023-08-23 2023-09-15 北京云枢创新软件技术有限公司 Macro definition text expansion method based on use line, electronic device and medium

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116756103A (en) * 2023-08-23 2023-09-15 北京云枢创新软件技术有限公司 Macro definition text expansion method based on use line, electronic device and medium
CN116756103B (en) * 2023-08-23 2023-10-27 北京云枢创新软件技术有限公司 Macro definition text expansion method based on use line, electronic device and medium

Similar Documents

Publication Publication Date Title
US8006229B2 (en) Program maintenance support device and program for the same
JP4693044B2 (en) Source code vulnerability inspection device
CN110502227B (en) Code complement method and device, storage medium and electronic equipment
CN111382070B (en) Compatibility testing method and device, storage medium and computer equipment
CN106371997B (en) Code checking method and device
US11262988B2 (en) Method and system for using subroutine graphs for formal language processing
CN112860265B (en) Method and device for detecting abnormal operation of source code database
CN111488155B (en) Coloring language translation method
CN113094252B (en) Test case generation method and device, computer equipment and storage medium
CN112199115A (en) Cross-Java byte code and source code line association method based on feature similarity matching
CN114647439A (en) Code scanning method, code migration method and related device
CN111966578A (en) Automatic evaluation method for android compatibility defect repair effect
CN116048481A (en) Service information processing system and method
CN116305118A (en) Method, device, electronic equipment and medium for static detection of increment codes
CN115129598A (en) Risk detection method, device, system and medium for SQL (structured query language) statements
CN114816364A (en) Method, device and application for dynamically generating template file based on Swagger
Tukaram Design and development of software tool for code clone search, detection, and analysis
CN110457046B (en) Disassembles method, disassembles device, storage medium and disassembles terminal for hybrid instruction set programs
KR100501936B1 (en) System and method for source code checking
CN113821496A (en) Database migration method, system, device and computer readable storage medium
JP6955162B2 (en) Analytical equipment, analysis method and analysis program
CN112148581A (en) Code specification checking method, device, system and storage medium
CN118113301B (en) Program code checking method and system for numerical weather forecast mode program
CN115934106B (en) Method for rapidly detecting source dependency integrity of apt warehouse
CN113688131A (en) Method, system, device and computer program product for field level impact analysis

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination