arkanalyzer 1.0.94 → 2.0.0-beta1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/Config.d.ts +7 -0
- package/lib/Config.d.ts.map +1 -1
- package/lib/Scene.d.ts +134 -170
- package/lib/Scene.d.ts.map +1 -1
- package/lib/Scene.js +412 -976
- package/lib/callgraph/algorithm/AbstractAnalysis.js +3 -2
- package/lib/callgraph/algorithm/RapidTypeAnalysis.js +1 -1
- package/lib/callgraph/model/CallGraph.js +1 -1
- package/lib/callgraph/pointerAnalysis/PTAUtils.d.ts +1 -3
- package/lib/callgraph/pointerAnalysis/PTAUtils.d.ts.map +1 -1
- package/lib/callgraph/pointerAnalysis/PTAUtils.js +17 -7
- package/lib/callgraph/pointerAnalysis/Pag.d.ts.map +1 -1
- package/lib/callgraph/pointerAnalysis/Pag.js +4 -14
- package/lib/callgraph/pointerAnalysis/PagBuilder.d.ts.map +1 -1
- package/lib/callgraph/pointerAnalysis/PagBuilder.js +2 -1
- package/lib/callgraph/pointerAnalysis/PointerAnalysis.d.ts.map +1 -1
- package/lib/callgraph/pointerAnalysis/PointerAnalysis.js +1 -2
- package/lib/callgraph/pointerAnalysis/plugins/WorkerPlugin.d.ts.map +1 -1
- package/lib/callgraph/pointerAnalysis/plugins/WorkerPlugin.js +0 -1
- package/lib/cli/commands/cg.d.ts +1 -0
- package/lib/cli/commands/cg.d.ts.map +1 -1
- package/lib/cli/commands/cg.js +22 -18
- package/lib/cli/commands/ir.d.ts +1 -0
- package/lib/cli/commands/ir.d.ts.map +1 -1
- package/lib/cli/commands/ir.js +5 -2
- package/lib/core/base/Constant.d.ts +5 -5
- package/lib/core/base/Constant.d.ts.map +1 -1
- package/lib/core/base/Constant.js +12 -9
- package/lib/core/base/Expr.d.ts +36 -20
- package/lib/core/base/Expr.d.ts.map +1 -1
- package/lib/core/base/Expr.js +206 -94
- package/lib/core/base/Local.d.ts +10 -20
- package/lib/core/base/Local.d.ts.map +1 -1
- package/lib/core/base/Local.js +25 -28
- package/lib/core/base/Position.d.ts +6 -0
- package/lib/core/base/Position.d.ts.map +1 -1
- package/lib/core/base/Position.js +37 -11
- package/lib/core/base/Ref.d.ts +45 -33
- package/lib/core/base/Ref.d.ts.map +1 -1
- package/lib/core/base/Ref.js +225 -51
- package/lib/core/base/Stmt.d.ts +19 -9
- package/lib/core/base/Stmt.d.ts.map +1 -1
- package/lib/core/base/Stmt.js +135 -52
- package/lib/core/base/Type.d.ts +67 -4
- package/lib/core/base/Type.d.ts.map +1 -1
- package/lib/core/base/Type.js +391 -20
- package/lib/core/base/TypeExpr.d.ts +6 -4
- package/lib/core/base/TypeExpr.d.ts.map +1 -1
- package/lib/core/base/TypeExpr.js +34 -10
- package/lib/core/base/Value.d.ts +20 -2
- package/lib/core/base/Value.d.ts.map +1 -1
- package/lib/core/base/Value.js +12 -0
- package/lib/core/common/ArkIRTransformer.d.ts +18 -0
- package/lib/core/common/ArkIRTransformer.d.ts.map +1 -1
- package/lib/core/common/ArkIRTransformer.js +94 -75
- package/lib/core/common/ArkValueTransformer.d.ts +21 -3
- package/lib/core/common/ArkValueTransformer.d.ts.map +1 -1
- package/lib/core/common/ArkValueTransformer.js +455 -265
- package/lib/core/common/Builtin.d.ts +48 -24
- package/lib/core/common/Builtin.d.ts.map +1 -1
- package/lib/core/common/Builtin.js +90 -52
- package/lib/core/common/CanonicalizerValidator.d.ts +308 -0
- package/lib/core/common/CanonicalizerValidator.d.ts.map +1 -0
- package/lib/core/common/CanonicalizerValidator.js +888 -0
- package/lib/core/common/Const.d.ts +3 -3
- package/lib/core/common/Const.d.ts.map +1 -1
- package/lib/core/common/Const.js +3 -3
- package/lib/core/common/DummyMainCreater.d.ts +2 -21
- package/lib/core/common/DummyMainCreater.d.ts.map +1 -1
- package/lib/core/common/DummyMainCreater.js +8 -105
- package/lib/core/common/IRInference.d.ts +55 -3
- package/lib/core/common/IRInference.d.ts.map +1 -1
- package/lib/core/common/IRInference.js +407 -126
- package/lib/core/common/IRUtils.d.ts +1 -0
- package/lib/core/common/IRUtils.d.ts.map +1 -1
- package/lib/core/common/IRUtils.js +44 -13
- package/lib/core/common/ModelUtils.d.ts +44 -20
- package/lib/core/common/ModelUtils.d.ts.map +1 -1
- package/lib/core/common/ModelUtils.js +378 -208
- package/lib/core/common/SdkUtils.d.ts +35 -5
- package/lib/core/common/SdkUtils.d.ts.map +1 -1
- package/lib/core/common/SdkUtils.js +181 -53
- package/lib/core/common/SignatureCanonicalizer.d.ts +95 -0
- package/lib/core/common/SignatureCanonicalizer.d.ts.map +1 -0
- package/lib/core/common/SignatureCanonicalizer.js +116 -0
- package/lib/core/common/SignatureCanonicalizerRegistry.d.ts +176 -0
- package/lib/core/common/SignatureCanonicalizerRegistry.d.ts.map +1 -0
- package/lib/core/common/SignatureCanonicalizerRegistry.js +343 -0
- package/lib/core/common/SignatureModelCanonicalizer.d.ts +69 -0
- package/lib/core/common/SignatureModelCanonicalizer.d.ts.map +1 -0
- package/lib/core/common/SignatureModelCanonicalizer.js +109 -0
- package/lib/core/common/StmtUseReplacer.d.ts +1 -0
- package/lib/core/common/StmtUseReplacer.d.ts.map +1 -1
- package/lib/core/common/StmtUseReplacer.js +9 -0
- package/lib/core/common/StringUtils.d.ts +12 -1
- package/lib/core/common/StringUtils.d.ts.map +1 -1
- package/lib/core/common/StringUtils.js +36 -17
- package/lib/core/common/TempSignatureCanonicalizer.d.ts +82 -0
- package/lib/core/common/TempSignatureCanonicalizer.d.ts.map +1 -0
- package/lib/core/common/TempSignatureCanonicalizer.js +177 -0
- package/lib/core/common/TypeInference.d.ts +24 -6
- package/lib/core/common/TypeInference.d.ts.map +1 -1
- package/lib/core/common/TypeInference.js +243 -117
- package/lib/core/common/ValueUtil.d.ts +2 -1
- package/lib/core/common/ValueUtil.d.ts.map +1 -1
- package/lib/core/common/ValueUtil.js +4 -1
- package/lib/core/graph/Cfg.d.ts.map +1 -1
- package/lib/core/graph/Cfg.js +21 -6
- package/lib/core/graph/builder/CfgBuilder.d.ts.map +1 -1
- package/lib/core/graph/builder/CfgBuilder.js +46 -33
- package/lib/core/graph/builder/IfBuilder.d.ts.map +1 -1
- package/lib/core/graph/builder/IfBuilder.js +6 -2
- package/lib/core/graph/builder/ViewTreeBuilder.d.ts.map +1 -1
- package/lib/core/graph/builder/ViewTreeBuilder.js +6 -2
- package/lib/core/inference/ModelInference.d.ts +24 -4
- package/lib/core/inference/ModelInference.d.ts.map +1 -1
- package/lib/core/inference/ModelInference.js +273 -79
- package/lib/core/inference/ValueInference.d.ts +3 -2
- package/lib/core/inference/ValueInference.d.ts.map +1 -1
- package/lib/core/inference/ValueInference.js +90 -40
- package/lib/core/inference/abc/AbcInference.d.ts.map +1 -1
- package/lib/core/inference/abc/AbcInference.js +28 -15
- package/lib/core/inference/arkts/ArkTsInference.d.ts +9 -3
- package/lib/core/inference/arkts/ArkTsInference.d.ts.map +1 -1
- package/lib/core/inference/arkts/ArkTsInference.js +54 -16
- package/lib/core/model/ArkClass.d.ts +192 -18
- package/lib/core/model/ArkClass.d.ts.map +1 -1
- package/lib/core/model/ArkClass.js +852 -122
- package/lib/core/model/ArkExport.d.ts.map +1 -1
- package/lib/core/model/ArkExport.js +1 -2
- package/lib/core/model/ArkField.d.ts +34 -2
- package/lib/core/model/ArkField.d.ts.map +1 -1
- package/lib/core/model/ArkField.js +89 -14
- package/lib/core/model/ArkFile.d.ts +72 -12
- package/lib/core/model/ArkFile.d.ts.map +1 -1
- package/lib/core/model/ArkFile.js +275 -65
- package/lib/core/model/ArkImport.d.ts.map +1 -1
- package/lib/core/model/ArkImport.js +1 -2
- package/lib/core/model/ArkMethod.d.ts +101 -15
- package/lib/core/model/ArkMethod.d.ts.map +1 -1
- package/lib/core/model/ArkMethod.js +252 -39
- package/lib/core/model/ArkModule.d.ts +1 -1
- package/lib/core/model/ArkModule.js +1 -1
- package/lib/core/model/ArkNamespace.d.ts +80 -10
- package/lib/core/model/ArkNamespace.d.ts.map +1 -1
- package/lib/core/model/ArkNamespace.js +309 -76
- package/lib/core/model/ArkSignature.d.ts +242 -18
- package/lib/core/model/ArkSignature.d.ts.map +1 -1
- package/lib/core/model/ArkSignature.js +725 -95
- package/lib/core/model/builder/ArkClassBuilder.d.ts +6 -3
- package/lib/core/model/builder/ArkClassBuilder.d.ts.map +1 -1
- package/lib/core/model/builder/ArkClassBuilder.js +116 -71
- package/lib/core/model/builder/ArkExportBuilder.d.ts +1 -1
- package/lib/core/model/builder/ArkExportBuilder.d.ts.map +1 -1
- package/lib/core/model/builder/ArkExportBuilder.js +1 -1
- package/lib/core/model/builder/ArkFieldBuilder.d.ts +0 -2
- package/lib/core/model/builder/ArkFieldBuilder.d.ts.map +1 -1
- package/lib/core/model/builder/ArkFieldBuilder.js +9 -43
- package/lib/core/model/builder/ArkFileBuilder.d.ts.map +1 -1
- package/lib/core/model/builder/ArkFileBuilder.js +32 -33
- package/lib/core/model/builder/ArkMethodBuilder.d.ts +10 -3
- package/lib/core/model/builder/ArkMethodBuilder.d.ts.map +1 -1
- package/lib/core/model/builder/ArkMethodBuilder.js +40 -26
- package/lib/core/model/builder/ArkNamespaceBuilder.d.ts +3 -2
- package/lib/core/model/builder/ArkNamespaceBuilder.d.ts.map +1 -1
- package/lib/core/model/builder/ArkNamespaceBuilder.js +45 -77
- package/lib/core/model/builder/ArkSignatureBuilder.d.ts +9 -0
- package/lib/core/model/builder/ArkSignatureBuilder.d.ts.map +1 -1
- package/lib/core/model/builder/ArkSignatureBuilder.js +26 -3
- package/lib/core/model/builder/BodyBuilder.d.ts +1 -0
- package/lib/core/model/builder/BodyBuilder.d.ts.map +1 -1
- package/lib/core/model/builder/BodyBuilder.js +37 -11
- package/lib/core/model/builder/builderUtils.d.ts +11 -1
- package/lib/core/model/builder/builderUtils.d.ts.map +1 -1
- package/lib/core/model/builder/builderUtils.js +124 -90
- package/lib/frontend/FrontendBuilder.d.ts +10 -6
- package/lib/frontend/FrontendBuilder.d.ts.map +1 -1
- package/lib/frontend/FrontendBuilder.js +19 -45
- package/lib/frontend/ModuleScene.d.ts +43 -0
- package/lib/frontend/ModuleScene.d.ts.map +1 -0
- package/lib/frontend/ModuleScene.js +143 -0
- package/lib/frontend/SceneBuildStage.d.ts +15 -0
- package/lib/frontend/SceneBuildStage.d.ts.map +1 -0
- package/lib/frontend/SceneBuildStage.js +32 -0
- package/lib/frontend/SceneBuilder.d.ts +153 -0
- package/lib/frontend/SceneBuilder.d.ts.map +1 -0
- package/lib/frontend/SceneBuilder.js +859 -0
- package/lib/frontend/arktsFrontend/ArktsFrontend.d.ts +0 -2
- package/lib/frontend/arktsFrontend/ArktsFrontend.d.ts.map +1 -1
- package/lib/frontend/arktsFrontend/ArktsFrontend.js +0 -18
- package/lib/frontend/arktsFrontend/FileBodyRemount.d.ts +17 -0
- package/lib/frontend/arktsFrontend/FileBodyRemount.d.ts.map +1 -0
- package/lib/frontend/arktsFrontend/FileBodyRemount.js +187 -0
- package/lib/frontend/common/ModuleBuilder.d.ts +4 -2
- package/lib/frontend/common/ModuleBuilder.d.ts.map +1 -1
- package/lib/frontend/common/ModuleBuilder.js +19 -9
- package/lib/frontend/cppFrontend/CppFrontend.d.ts +0 -6
- package/lib/frontend/cppFrontend/CppFrontend.d.ts.map +1 -1
- package/lib/frontend/cppFrontend/CppFrontend.js +0 -56
- package/lib/frontend/cppFrontend/base/Type.d.ts +7 -0
- package/lib/frontend/cppFrontend/base/Type.d.ts.map +1 -1
- package/lib/frontend/cppFrontend/base/Type.js +29 -0
- package/lib/frontend/cppFrontend/common/ArkIRTransformer.d.ts.map +1 -1
- package/lib/frontend/cppFrontend/common/ArkIRTransformer.js +56 -56
- package/lib/frontend/cppFrontend/common/ArkValueTransformer.d.ts +1 -1
- package/lib/frontend/cppFrontend/common/ArkValueTransformer.d.ts.map +1 -1
- package/lib/frontend/cppFrontend/common/ArkValueTransformer.js +124 -113
- package/lib/frontend/cppFrontend/common/Builtin.d.ts +29 -19
- package/lib/frontend/cppFrontend/common/Builtin.d.ts.map +1 -1
- package/lib/frontend/cppFrontend/common/Builtin.js +56 -35
- package/lib/frontend/cppFrontend/common/IRInference.d.ts +7 -2
- package/lib/frontend/cppFrontend/common/IRInference.d.ts.map +1 -1
- package/lib/frontend/cppFrontend/common/IRInference.js +61 -28
- package/lib/frontend/cppFrontend/common/IRUtils.d.ts +1 -0
- package/lib/frontend/cppFrontend/common/IRUtils.d.ts.map +1 -1
- package/lib/frontend/cppFrontend/common/IRUtils.js +22 -10
- package/lib/frontend/cppFrontend/common/ModelUtils.d.ts +19 -0
- package/lib/frontend/cppFrontend/common/ModelUtils.d.ts.map +1 -1
- package/lib/frontend/cppFrontend/common/ModelUtils.js +84 -3
- package/lib/frontend/cppFrontend/common/TypeInference.d.ts.map +1 -1
- package/lib/frontend/cppFrontend/common/TypeInference.js +44 -54
- package/lib/frontend/cppFrontend/graph/builder/CfgBuilder.d.ts.map +1 -1
- package/lib/frontend/cppFrontend/graph/builder/CfgBuilder.js +2 -1
- package/lib/frontend/cppFrontend/inference/CxxModelInference.d.ts +1 -1
- package/lib/frontend/cppFrontend/inference/CxxModelInference.d.ts.map +1 -1
- package/lib/frontend/cppFrontend/inference/CxxValueInference.d.ts.map +1 -1
- package/lib/frontend/cppFrontend/inference/CxxValueInference.js +41 -5
- package/lib/frontend/cppFrontend/model/builder/ArkClassBuilder.d.ts.map +1 -1
- package/lib/frontend/cppFrontend/model/builder/ArkClassBuilder.js +18 -28
- package/lib/frontend/cppFrontend/model/builder/ArkFieldBuilder.d.ts.map +1 -1
- package/lib/frontend/cppFrontend/model/builder/ArkFieldBuilder.js +2 -3
- package/lib/frontend/cppFrontend/model/builder/ArkFileBuilder.d.ts +2 -2
- package/lib/frontend/cppFrontend/model/builder/ArkFileBuilder.d.ts.map +1 -1
- package/lib/frontend/cppFrontend/model/builder/ArkFileBuilder.js +31 -24
- package/lib/frontend/cppFrontend/model/builder/ArkMethodBuilder.d.ts.map +1 -1
- package/lib/frontend/cppFrontend/model/builder/ArkMethodBuilder.js +10 -16
- package/lib/frontend/cppFrontend/model/builder/ArkNamespaceBuilder.d.ts +0 -2
- package/lib/frontend/cppFrontend/model/builder/ArkNamespaceBuilder.d.ts.map +1 -1
- package/lib/frontend/cppFrontend/model/builder/ArkNamespaceBuilder.js +19 -37
- package/lib/frontend/cppFrontend/model/builder/BodyBuilder.d.ts +1 -0
- package/lib/frontend/cppFrontend/model/builder/BodyBuilder.d.ts.map +1 -1
- package/lib/frontend/cppFrontend/model/builder/BodyBuilder.js +30 -3
- package/lib/frontend/cppFrontend/model/builder/builderUtils.d.ts.map +1 -1
- package/lib/frontend/cppFrontend/model/builder/builderUtils.js +8 -4
- package/lib/index.d.ts +3 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +10 -2
- package/lib/save/json/JsonSerialization.js +2 -2
- package/lib/save/source/SourceStmt.js +1 -1
- package/lib/save/source/SourceTransformer.d.ts.map +1 -1
- package/lib/save/source/SourceTransformer.js +0 -9
- package/lib/statistics/StageStatistics.d.ts +195 -0
- package/lib/statistics/StageStatistics.d.ts.map +1 -0
- package/lib/statistics/StageStatistics.js +346 -0
- package/lib/statistics/StageStatisticsReporter.d.ts +58 -0
- package/lib/statistics/StageStatisticsReporter.d.ts.map +1 -0
- package/lib/statistics/StageStatisticsReporter.js +255 -0
- package/lib/utils/Canonicalizer.d.ts +9 -2
- package/lib/utils/Canonicalizer.d.ts.map +1 -1
- package/lib/utils/Canonicalizer.js +19 -2
- package/lib/utils/CxxSceneUtils.d.ts +7 -0
- package/lib/utils/CxxSceneUtils.d.ts.map +1 -1
- package/lib/utils/CxxSceneUtils.js +10 -1
- package/lib/utils/FileUtils.d.ts +0 -1
- package/lib/utils/FileUtils.d.ts.map +1 -1
- package/lib/utils/FileUtils.js +1 -9
- package/lib/utils/HashUtils.d.ts +9 -0
- package/lib/utils/HashUtils.d.ts.map +1 -0
- package/lib/utils/HashUtils.js +65 -0
- package/lib/utils/ModuleUtils.d.ts.map +1 -1
- package/lib/utils/ModuleUtils.js +24 -5
- package/lib/utils/VisitedSegment.d.ts +23 -0
- package/lib/utils/VisitedSegment.d.ts.map +1 -0
- package/lib/utils/VisitedSegment.js +64 -0
- package/lib/utils/callGraphUtils.d.ts.map +1 -1
- package/lib/utils/callGraphUtils.js +7 -7
- package/lib/utils/getAllFiles.d.ts.map +1 -1
- package/lib/utils/getAllFiles.js +11 -8
- package/lib/utils/logger.d.ts +4 -0
- package/lib/utils/logger.d.ts.map +1 -1
- package/lib/utils/logger.js +16 -0
- package/lib/utils/parseArkSourceFile.d.ts +33 -0
- package/lib/utils/parseArkSourceFile.d.ts.map +1 -0
- package/lib/utils/parseArkSourceFile.js +131 -0
- package/package.json +1 -1
- package/lib/utils/DependenciesSort.d.ts +0 -3
- package/lib/utils/DependenciesSort.d.ts.map +0 -1
- package/lib/utils/DependenciesSort.js +0 -72
- package/lib/utils/crypto_utils.d.ts +0 -6
- package/lib/utils/crypto_utils.d.ts.map +0 -1
- package/lib/utils/crypto_utils.js +0 -57
|
@@ -252,6 +252,9 @@ class CxxCharType extends Type_1.Type {
|
|
|
252
252
|
getOriTypeName() {
|
|
253
253
|
return this.oriTypeName;
|
|
254
254
|
}
|
|
255
|
+
isUnclearWithVisited(_visited) {
|
|
256
|
+
return false;
|
|
257
|
+
}
|
|
255
258
|
getTypeString() {
|
|
256
259
|
if (this.oriTypeName) {
|
|
257
260
|
return cxxStdTypeNameToStr(this.oriTypeName);
|
|
@@ -354,6 +357,9 @@ class PointerType extends Type_1.Type {
|
|
|
354
357
|
getLevel() {
|
|
355
358
|
return this.level;
|
|
356
359
|
}
|
|
360
|
+
isUnclearWithVisited(visited) {
|
|
361
|
+
return this.getBaseType().isUnclearWithVisited(visited);
|
|
362
|
+
}
|
|
357
363
|
getTypeString() {
|
|
358
364
|
const strs = [];
|
|
359
365
|
if (this.baseType instanceof Type_1.UnionType) {
|
|
@@ -468,6 +474,9 @@ class ReferenceType extends Type_1.Type {
|
|
|
468
474
|
getCategory() {
|
|
469
475
|
return this.category;
|
|
470
476
|
}
|
|
477
|
+
isUnclearWithVisited(visited) {
|
|
478
|
+
return this.getBaseType().isUnclearWithVisited(visited);
|
|
479
|
+
}
|
|
471
480
|
setSourceValue(sourceValue) {
|
|
472
481
|
this.sourceValue = sourceValue;
|
|
473
482
|
}
|
|
@@ -501,6 +510,9 @@ class Thread extends Type_1.Type {
|
|
|
501
510
|
constructor() {
|
|
502
511
|
super();
|
|
503
512
|
}
|
|
513
|
+
isUnclearWithVisited(_visited) {
|
|
514
|
+
return false;
|
|
515
|
+
}
|
|
504
516
|
getTypeString() {
|
|
505
517
|
return 'thread ';
|
|
506
518
|
}
|
|
@@ -518,6 +530,10 @@ class TypeInfo extends Type_1.Type {
|
|
|
518
530
|
getType() {
|
|
519
531
|
return this.type;
|
|
520
532
|
}
|
|
533
|
+
isUnclearWithVisited(_visited) {
|
|
534
|
+
// RTTI descriptor leaf: the held type is descriptive metadata, not a value type whose uncertainty should propagate.
|
|
535
|
+
return false;
|
|
536
|
+
}
|
|
521
537
|
getTypeString() {
|
|
522
538
|
return this.name;
|
|
523
539
|
}
|
|
@@ -547,6 +563,15 @@ class CxxArrayType extends Type_1.Type {
|
|
|
547
563
|
setBaseType(newType) {
|
|
548
564
|
this.baseType = newType;
|
|
549
565
|
}
|
|
566
|
+
isUnclearWithVisited(visited) {
|
|
567
|
+
if (visited.has(this)) {
|
|
568
|
+
return false;
|
|
569
|
+
}
|
|
570
|
+
visited.add(this);
|
|
571
|
+
// Aligned with core ArrayType (full semantics): the array is unclear iff its
|
|
572
|
+
// base type is unclear.
|
|
573
|
+
return this.getBaseType().isUnclearWithVisited(visited);
|
|
574
|
+
}
|
|
550
575
|
getDimension() {
|
|
551
576
|
return this.dimension;
|
|
552
577
|
}
|
|
@@ -592,6 +617,10 @@ class AutoType extends Type_1.Type {
|
|
|
592
617
|
constructor() {
|
|
593
618
|
super();
|
|
594
619
|
}
|
|
620
|
+
isUnclearWithVisited(_visited) {
|
|
621
|
+
// `auto` is deduced before use; the type itself is not an unclear placeholder
|
|
622
|
+
return false;
|
|
623
|
+
}
|
|
595
624
|
getTypeString() {
|
|
596
625
|
return 'auto';
|
|
597
626
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ArkIRTransformer.d.ts","sourceRoot":"","sources":["../../../../src/frontend/cppFrontend/common/ArkIRTransformer.ts"],"names":[],"mappings":"AAeA,OAAO,EAYH,aAAa,EAChB,MAAM,yBAAyB,CAAC;AACjC,OAAO,
|
|
1
|
+
{"version":3,"file":"ArkIRTransformer.d.ts","sourceRoot":"","sources":["../../../../src/frontend/cppFrontend/common/ArkIRTransformer.ts"],"names":[],"mappings":"AAeA,OAAO,EAYH,aAAa,EAChB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAwF,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACzI,OAAO,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AAEjD,OAAO,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AACjD,OAAO,EAAE,sBAAsB,EAA2F,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAChK,OAAO,EAAE,SAAS,EAAuF,MAAM,yBAAyB,CAAC;AAGzI,OAAO,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAE1D,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAK3D,OAAO,EAAE,gBAAgB,EAAa,MAAM,uCAAuC,CAAC;AAMpF,OAAO,EAAsB,UAAU,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAS5F,MAAM,MAAM,aAAa,GAAG;IACxB,KAAK,EAAE,KAAK,CAAC;IACb,sBAAsB,EAAE,YAAY,EAAE,CAAC;IACvC,KAAK,EAAE,IAAI,EAAE,CAAC;CACjB,CAAC;AAUF,qBAAa,mBAAoB,SAAQ,gBAAgB;IACrD,gBAAuB,4BAA4B,YAAY;IAC/D,gBAAuB,qBAAqB,WAAW;IACvD,gBAA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AC,eAAe,EAAE,UAAU,GAAG,aAAa,EAAE;IA6CtF;;;;;;;;OAQG;IACH,OAAO,CAAC,sBAAsB;IAkC9B,OAAO,CAAC,wBAAwB;IAQhC,OAAO,CAAC,qBAAqB;IAM7B,OAAO,CAAC,qBAAqB;IAI7B,OAAO,CAAC,eAAe;IAIvB,OAAO,CAAC,qBAAqB;IAI7B,OAAO,CAAC,2BAA2B;IAqCnC,OAAO,CAAC,iBAAiB;IA2CzB,OAAO,CAAC,uBAAuB;IAY/B,OAAO,CAAC,wBAAwB;IAIhC,OAAO,CAAC,iCAAiC;IAIlC,qBAAqB,CACxB,WAAW,EAAE,UAAU,EACvB,KAAK,GAAE,MAAU,EACjB,OAAO,CAAC,EAAE;QACN,aAAa,EAAE,KAAK,GAAG,SAAS,CAAC;KACpC,GACF,IAAI,EAAE;IAmCT,OAAO,CAAC,wBAAwB;IAazB,mBAAmB,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,UAAU,GAAG,IAAI;IAQjE;;;;;OAKG;WACW,uBAAuB,CAAC,KAAK,EAAE,MAAM,GAAG,aAAa,GAAG,IAAI;IAiBnE,0BAA0B,CAAC,KAAK,EAAE,KAAK,EAAE,sBAAsB,EAAE,YAAY,EAAE,GAAG,aAAa;IAwBtG,OAAO,CAAC,oBAAoB;IAqB5B,OAAO,CAAC,qBAAqB;IAW7B,OAAO,CAAC,qBAAqB;IAe7B,OAAO,CAAC,wBAAwB;IAgBzB,2BAA2B,CAAC,wBAAwB,EAAE,OAAO,GAAG,IAAI;CAC9E"}
|
|
@@ -63,6 +63,7 @@ const Type_2 = require("../base/Type");
|
|
|
63
63
|
const builderUtils_2 = require("../../../core/model/builder/builderUtils");
|
|
64
64
|
const logger_1 = __importStar(require("../../../utils/logger"));
|
|
65
65
|
const ArkFileBuilder_1 = require("../model/builder/ArkFileBuilder");
|
|
66
|
+
const SignatureCanonicalizerRegistry_1 = require("../../../core/common/SignatureCanonicalizerRegistry");
|
|
66
67
|
const logger = logger_1.default.getLogger(logger_1.LOG_MODULE_TYPE.ARKANALYZER, 'ArkIRTransformer');
|
|
67
68
|
function nodeInnerNode(node) {
|
|
68
69
|
if (node.inner && node.inner.length > 0) {
|
|
@@ -111,8 +112,7 @@ class ArkCxxIRTransformer extends ArkIRTransformer_1.ArkIRTransformer {
|
|
|
111
112
|
ArkValueTransformer_1.ArkCxxValueTransformer.isCxxCompoundAssignmentOperator(expression.opcode) ||
|
|
112
113
|
expression.kind === ArkCxxAstNode_1.AstKind.CXXNewExpr ||
|
|
113
114
|
expression.kind === ArkCxxAstNode_1.AstKind.CallExpr ||
|
|
114
|
-
(expression.kind === ArkCxxAstNode_1.AstKind.UnaryOperator &&
|
|
115
|
-
(expression.opcode === ArkCxxAstNode_1.CxxOpcode.Inc || expression.opcode === ArkCxxAstNode_1.CxxOpcode.Dec)) ||
|
|
115
|
+
(expression.kind === ArkCxxAstNode_1.AstKind.UnaryOperator && (expression.opcode === ArkCxxAstNode_1.CxxOpcode.Inc || expression.opcode === ArkCxxAstNode_1.CxxOpcode.Dec)) ||
|
|
116
116
|
expression.kind === ArkCxxAstNode_1.AstKind.CXXOperatorCallExpr ||
|
|
117
117
|
expression.kind === ArkCxxAstNode_1.AstKind.CXXConstructExpr ||
|
|
118
118
|
expression.kind === ArkCxxAstNode_1.AstKind.CXXCtorInitializer);
|
|
@@ -206,12 +206,8 @@ class ArkCxxIRTransformer extends ArkIRTransformer_1.ArkIRTransformer {
|
|
|
206
206
|
return stmts;
|
|
207
207
|
}
|
|
208
208
|
cxxClassDeclarationToStmts(node) {
|
|
209
|
-
const cls = new ArkClass_1.ArkClass();
|
|
210
209
|
const declaringArkNamespace = this.declaringMethod.getDeclaringArkClass().getDeclaringArkNamespace();
|
|
211
|
-
|
|
212
|
-
cls.setDeclaringArkNamespace(declaringArkNamespace);
|
|
213
|
-
}
|
|
214
|
-
cls.setDeclaringArkFile(this.declaringMethod.getDeclaringArkFile());
|
|
210
|
+
const cls = new ArkClass_1.ArkClass(this._declaringFile.getFileSigID(), declaringArkNamespace === null || declaringArkNamespace === void 0 ? void 0 : declaringArkNamespace.getNamespaceSigID());
|
|
215
211
|
(0, ArkClassBuilder_1.buildNormalArkClassFromArkMethod)(node, cls, this.cxxSourceFile, this.declaringMethod);
|
|
216
212
|
return [];
|
|
217
213
|
}
|
|
@@ -287,7 +283,8 @@ class ArkCxxIRTransformer extends ArkIRTransformer_1.ArkIRTransformer {
|
|
|
287
283
|
populateRealGenericTypes(node, expr) {
|
|
288
284
|
if (node.kind === ArkCxxAstNode_1.AstKind.TypeAliasTemplateDecl) {
|
|
289
285
|
const realGenericTypes = [];
|
|
290
|
-
node.inner
|
|
286
|
+
node.inner
|
|
287
|
+
.filter(inn => inn.kind === ArkCxxAstNode_1.AstKind.TemplateTypeParmDecl)
|
|
291
288
|
.forEach(typeArgument => {
|
|
292
289
|
realGenericTypes.push((0, builderUtils_1.cxxNode2Type)(typeArgument, this.declaringMethod));
|
|
293
290
|
});
|
|
@@ -306,9 +303,12 @@ class ArkCxxIRTransformer extends ArkIRTransformer_1.ArkIRTransformer {
|
|
|
306
303
|
}
|
|
307
304
|
getAnonymousInformation(node) {
|
|
308
305
|
if (node.inner.length === 0 && node.originalId) {
|
|
309
|
-
const
|
|
310
|
-
if (
|
|
311
|
-
|
|
306
|
+
const classSigID = ArkFileBuilder_1.classMap.get(node.originalId);
|
|
307
|
+
if (classSigID !== undefined) {
|
|
308
|
+
const cls = SignatureCanonicalizerRegistry_1.SignatureCanonicalizerRegistry.getInstance().getClassById(classSigID);
|
|
309
|
+
if (cls) {
|
|
310
|
+
return new Type_1.ClassType(cls.getSignature());
|
|
311
|
+
}
|
|
312
312
|
}
|
|
313
313
|
}
|
|
314
314
|
return (0, builderUtils_1.cxxNode2Type)(node, this.declaringMethod);
|
|
@@ -343,6 +343,7 @@ class ArkCxxIRTransformer extends ArkIRTransformer_1.ArkIRTransformer {
|
|
|
343
343
|
return stmts;
|
|
344
344
|
}
|
|
345
345
|
cxxGenerateAliasTypeExpr(rightOp, aliasType) {
|
|
346
|
+
var _a;
|
|
346
347
|
let rightType = aliasType.getOriginalType();
|
|
347
348
|
let expr;
|
|
348
349
|
expr = new Expr_1.AliasTypeExpr(rightType, false);
|
|
@@ -350,7 +351,10 @@ class ArkCxxIRTransformer extends ArkIRTransformer_1.ArkIRTransformer {
|
|
|
350
351
|
// and the corresponding ArkClass needs to be found as originalObject.
|
|
351
352
|
// For other cases, this is UnclearReferenceType here and will be found and processed by type inference
|
|
352
353
|
if (rightType instanceof Type_1.ClassType) {
|
|
353
|
-
|
|
354
|
+
// 签名直查优先(typedef 右侧 ClassType 的生成路径——classMap 命中 /
|
|
355
|
+
// buildTypeFromDerivedType / 内建——均为真实归属签名);miss 再按名兜底
|
|
356
|
+
//(保守保留:CxxModelInference 推断回写可能引入非真实签名)
|
|
357
|
+
const classObject = (_a = SignatureCanonicalizerRegistry_1.SignatureCanonicalizerRegistry.getInstance().getClassBySig(rightType.getClassSignature())) !== null && _a !== void 0 ? _a : ModelUtils_1.ModelUtils.getClassWithName(rightType.getClassSignature().getClassName(), this.declaringMethod.getDeclaringArkClass());
|
|
354
358
|
if (classObject) {
|
|
355
359
|
expr.setOriginalObject(classObject);
|
|
356
360
|
}
|
|
@@ -361,44 +365,44 @@ class ArkCxxIRTransformer extends ArkIRTransformer_1.ArkIRTransformer {
|
|
|
361
365
|
const stmts = [];
|
|
362
366
|
let entry = forOfStatement.inner[1];
|
|
363
367
|
// Handle iterable initialization
|
|
364
|
-
let { iterablePositions, iteratorInvokeExpr, iteratorInvokeExprPositions
|
|
368
|
+
let { iterablePositions, iteratorInvokeExpr, iteratorInvokeExprPositions } = this.handleForRangeIterInit(entry, stmts);
|
|
365
369
|
const base = iteratorInvokeExpr.getBase();
|
|
366
370
|
// Handle iterable begin
|
|
367
|
-
const { iterator, doneFieldRef, doneFieldRefPositions
|
|
371
|
+
const { iterator, doneFieldRef, doneFieldRefPositions } = this.handleForRangeIterBegin(iteratorInvokeExpr, iteratorInvokeExprPositions, stmts, iterablePositions, base);
|
|
368
372
|
// Handle iterable end
|
|
369
|
-
const { iteratorNextInvokeExpr, iteratorNextInvokeExprPositions
|
|
373
|
+
const { iteratorNextInvokeExpr, iteratorNextInvokeExprPositions } = this.handleForRangeIterEnd(doneFieldRef, doneFieldRefPositions, stmts, iterator);
|
|
370
374
|
// Handle iterable result value
|
|
371
|
-
const { valueFieldRef, valueFieldRefPositions
|
|
375
|
+
const { valueFieldRef, valueFieldRefPositions } = this.handleForRangeIterResult(iteratorNextInvokeExpr, iteratorNextInvokeExprPositions, stmts, iterator);
|
|
372
376
|
// Handle whether iterable is finished
|
|
373
|
-
const
|
|
374
|
-
stmts.push(...
|
|
375
|
-
const castExpr = new Expr_1.ArkCastExpr(
|
|
376
|
-
const castExprPositions = [
|
|
377
|
+
const yieldResult = this.generateAssignStmtForValue(valueFieldRef, valueFieldRefPositions);
|
|
378
|
+
stmts.push(...yieldResult.stmts);
|
|
379
|
+
const castExpr = new Expr_1.ArkCastExpr(yieldResult.value, Type_1.UnknownType.getInstance());
|
|
380
|
+
const castExprPositions = [yieldResult.valueOriginalPositions[0], ...yieldResult.valueOriginalPositions];
|
|
377
381
|
let declStmts = forOfStatement.inner[0];
|
|
378
382
|
declStmts = declStmts.kind === ArkCxxAstNode_1.AstKind.DeclStmt ? declStmts.inner[0] : declStmts;
|
|
379
383
|
if (declStmts.kind === ArkCxxAstNode_1.AstKind.VarDecl) {
|
|
380
|
-
const
|
|
381
|
-
const assignStmt = new Stmt_1.ArkAssignStmt(
|
|
382
|
-
assignStmt.setOperandOriginalPositions([...
|
|
384
|
+
const initResult = this.ArkCxxValueTransformer.cxxVariableDeclarationToValueAndStmts(declStmts, false);
|
|
385
|
+
const assignStmt = new Stmt_1.ArkAssignStmt(initResult.value, castExpr);
|
|
386
|
+
assignStmt.setOperandOriginalPositions([...initResult.valueOriginalPositions, ...castExprPositions]);
|
|
383
387
|
stmts.push(assignStmt);
|
|
384
|
-
stmts.push(...
|
|
388
|
+
stmts.push(...initResult.stmts);
|
|
385
389
|
// Processing structured binding under cyclic conditions
|
|
386
390
|
}
|
|
387
391
|
else if (declStmts.kind === ArkCxxAstNode_1.AstKind.DecompositionDecl) {
|
|
388
|
-
const { stmts: initStmts
|
|
392
|
+
const { stmts: initStmts } = this.ArkCxxValueTransformer.bindingNodeToValueAndStmts(declStmts, yieldResult.value);
|
|
389
393
|
stmts.push(...initStmts);
|
|
390
394
|
}
|
|
391
395
|
else {
|
|
392
|
-
const
|
|
393
|
-
const assignStmt = new Stmt_1.ArkAssignStmt(
|
|
394
|
-
assignStmt.setOperandOriginalPositions([...
|
|
395
|
-
stmts.push(...
|
|
396
|
+
const initResult = this.cxxNodeToValueAndStmts(declStmts);
|
|
397
|
+
const assignStmt = new Stmt_1.ArkAssignStmt(initResult.value, castExpr);
|
|
398
|
+
assignStmt.setOperandOriginalPositions([...initResult.valueOriginalPositions, ...castExprPositions]);
|
|
399
|
+
stmts.push(...initResult.stmts);
|
|
396
400
|
stmts.push(assignStmt);
|
|
397
401
|
}
|
|
398
402
|
return stmts;
|
|
399
403
|
}
|
|
400
404
|
handleForRangeIterInit(entry, stmts) {
|
|
401
|
-
let { value: iterableValue, valueOriginalPositions: iterablePositions, stmts: iterableStmts
|
|
405
|
+
let { value: iterableValue, valueOriginalPositions: iterablePositions, stmts: iterableStmts } = this.cxxNodeToValueAndStmts(entry);
|
|
402
406
|
stmts.push(...iterableStmts);
|
|
403
407
|
if (!(iterableValue instanceof Local_1.Local)) {
|
|
404
408
|
({
|
|
@@ -409,7 +413,7 @@ class ArkCxxIRTransformer extends ArkIRTransformer_1.ArkIRTransformer {
|
|
|
409
413
|
stmts.push(...iterableStmts);
|
|
410
414
|
}
|
|
411
415
|
const iteratorMethodSubSignature = new ArkSignature_1.MethodSubSignature(Builtin_1.BuiltinCxx.ITERATOR_FUNCTION, [], Builtin_1.BuiltinCxx.ITERATOR_CLASS_TYPE);
|
|
412
|
-
const iteratorMethodSignature = new ArkSignature_1.MethodSignature(
|
|
416
|
+
const iteratorMethodSignature = new ArkSignature_1.MethodSignature(0, iteratorMethodSubSignature);
|
|
413
417
|
const iteratorInvokeExpr = new Expr_1.ArkInstanceInvokeExpr(iterableValue, iteratorMethodSignature, []);
|
|
414
418
|
const iteratorInvokeExprPositions = [iterablePositions[0], ...iterablePositions];
|
|
415
419
|
return { iterablePositions, iteratorInvokeExpr, iteratorInvokeExprPositions };
|
|
@@ -424,15 +428,17 @@ class ArkCxxIRTransformer extends ArkIRTransformer_1.ArkIRTransformer {
|
|
|
424
428
|
logger.error(logger_1.LOG_MODULE_TYPE.DEFAULT, 'iterator is not a local');
|
|
425
429
|
}
|
|
426
430
|
const baseType = base.getType();
|
|
427
|
-
const beginFieldSignature = baseType instanceof Type_1.ClassType
|
|
428
|
-
new ArkSignature_1.FieldSignature(Builtin_1.BuiltinCxx.ITERATOR_RESULT_BEGIN,
|
|
431
|
+
const beginFieldSignature = baseType instanceof Type_1.ClassType
|
|
432
|
+
? new ArkSignature_1.FieldSignature(Builtin_1.BuiltinCxx.ITERATOR_RESULT_BEGIN, baseType.getClassSignature(), Type_1.UnknownType.getInstance(), false)
|
|
433
|
+
: new ArkSignature_1.FieldSignature(Builtin_1.BuiltinCxx.ITERATOR_RESULT_BEGIN, Builtin_1.BuiltinCxx.ITERATOR_RESULT_CLASS_SIGNATURE, Type_1.UnknownType.getInstance(), false);
|
|
429
434
|
const beginFieldRef = new Ref_1.ArkInstanceFieldRef(base, beginFieldSignature);
|
|
430
435
|
const beginStmt = new Stmt_1.ArkAssignStmt(iterator, beginFieldRef);
|
|
431
436
|
stmts.push(beginStmt);
|
|
432
437
|
const dummyInitializerStmt = new ArkIRTransformer_1.DummyStmt(ArkIRTransformer_1.ArkIRTransformer.DUMMY_LOOP_INITIALIZER_STMT);
|
|
433
438
|
stmts.push(dummyInitializerStmt);
|
|
434
|
-
const doneFieldSignature = baseType instanceof Type_1.ClassType
|
|
435
|
-
new ArkSignature_1.FieldSignature(Builtin_1.BuiltinCxx.ITERATOR_RESULT_END,
|
|
439
|
+
const doneFieldSignature = baseType instanceof Type_1.ClassType
|
|
440
|
+
? new ArkSignature_1.FieldSignature(Builtin_1.BuiltinCxx.ITERATOR_RESULT_END, baseType.getClassSignature(), Type_1.UnknownType.getInstance(), false)
|
|
441
|
+
: new ArkSignature_1.FieldSignature(Builtin_1.BuiltinCxx.ITERATOR_RESULT_END, Builtin_1.BuiltinCxx.ITERATOR_RESULT_CLASS_SIGNATURE, Type_1.UnknownType.getInstance(), false);
|
|
436
442
|
const doneFieldRef = new Ref_1.ArkInstanceFieldRef(base, doneFieldSignature);
|
|
437
443
|
const doneFieldRefPositions = [iteratorPositions[0], ...iterablePositions];
|
|
438
444
|
return { iterator, doneFieldRef, doneFieldRefPositions };
|
|
@@ -447,7 +453,7 @@ class ArkCxxIRTransformer extends ArkIRTransformer_1.ArkIRTransformer {
|
|
|
447
453
|
ifStmt.setOperandOriginalPositions(conditionExprPositions);
|
|
448
454
|
stmts.push(ifStmt);
|
|
449
455
|
const nextMethodSubSignature = new ArkSignature_1.MethodSubSignature(Builtin_1.BuiltinCxx.ITERATOR_NEXT, [], Builtin_1.BuiltinCxx.ITERATOR_RESULT_CLASS_TYPE);
|
|
450
|
-
const nextMethodSignature = new ArkSignature_1.MethodSignature(
|
|
456
|
+
const nextMethodSignature = new ArkSignature_1.MethodSignature(0, nextMethodSubSignature);
|
|
451
457
|
const iteratorNextInvokeExpr = new Expr_1.ArkInstanceInvokeExpr(iterator, nextMethodSignature, []);
|
|
452
458
|
const iteratorNextInvokeExprPositions = [doneFieldRefPositions[0], ...doneFieldRefPositions];
|
|
453
459
|
return { iteratorNextInvokeExpr, iteratorNextInvokeExprPositions };
|
|
@@ -455,6 +461,8 @@ class ArkCxxIRTransformer extends ArkIRTransformer_1.ArkIRTransformer {
|
|
|
455
461
|
handleForRangeIterResult(iteratorNextInvokeExpr, iteratorNextInvokeExprPositions, stmts, iterator) {
|
|
456
462
|
const nextStmt = new Stmt_1.ArkAssignStmt(iterator, iteratorNextInvokeExpr);
|
|
457
463
|
stmts.push(nextStmt);
|
|
464
|
+
// Object path: the iterator stub is unclear and is routed to the temp canonicalizer
|
|
465
|
+
// inside the constructor — no formal interning without a model.
|
|
458
466
|
const valueFieldSignature = new ArkSignature_1.FieldSignature(Builtin_1.BuiltinCxx.ITERATOR_VALUE, Builtin_1.BuiltinCxx.ITERATOR_CLASS_SIGNATURE, Type_1.UnknownType.getInstance(), false);
|
|
459
467
|
const valueFieldRef = new Ref_1.ArkInstanceFieldRef(iterator, valueFieldSignature);
|
|
460
468
|
const valueFieldRefPositions = [iteratorNextInvokeExprPositions[0], ...iteratorNextInvokeExprPositions];
|
|
@@ -472,7 +480,8 @@ class ArkCxxIRTransformer extends ArkIRTransformer_1.ArkIRTransformer {
|
|
|
472
480
|
stmts.push(assignStmt);
|
|
473
481
|
stmts.push(...catchStmts);
|
|
474
482
|
}
|
|
475
|
-
else {
|
|
483
|
+
else {
|
|
484
|
+
// When the scenario is catch (...)
|
|
476
485
|
const caughtExceptionRef = new Ref_1.ArkCaughtExceptionRef(Type_1.AnyType.getInstance());
|
|
477
486
|
const catchValue = new Local_1.Local('error');
|
|
478
487
|
this.catchedExceptions.push(catchValue);
|
|
@@ -489,14 +498,10 @@ class ArkCxxIRTransformer extends ArkIRTransformer_1.ArkIRTransformer {
|
|
|
489
498
|
cxxReturnStatementToStmts(returnStatement) {
|
|
490
499
|
const stmts = [];
|
|
491
500
|
if (returnStatement.inner.length > 0) {
|
|
492
|
-
let { value: exprValue, valueOriginalPositions: exprPositions, stmts: exprStmts
|
|
501
|
+
let { value: exprValue, valueOriginalPositions: exprPositions, stmts: exprStmts } = this.cxxNodeToValueAndStmts(returnStatement.inner[0]);
|
|
493
502
|
stmts.push(...exprStmts);
|
|
494
503
|
if (IRUtils_1.IRUtils.moreThanOneAddress(exprValue)) {
|
|
495
|
-
({
|
|
496
|
-
value: exprValue,
|
|
497
|
-
valueOriginalPositions: exprPositions,
|
|
498
|
-
stmts: exprStmts,
|
|
499
|
-
} = this.generateAssignStmtForValue(exprValue, exprPositions));
|
|
504
|
+
({ value: exprValue, valueOriginalPositions: exprPositions, stmts: exprStmts } = this.generateAssignStmtForValue(exprValue, exprPositions));
|
|
500
505
|
stmts.push(...exprStmts);
|
|
501
506
|
}
|
|
502
507
|
const returnStmt = new Stmt_1.ArkReturnStmt(exprValue);
|
|
@@ -514,7 +519,7 @@ class ArkCxxIRTransformer extends ArkIRTransformer_1.ArkIRTransformer {
|
|
|
514
519
|
return stmts;
|
|
515
520
|
}
|
|
516
521
|
cxxExpressionStatementToStmts(expressionStatement) {
|
|
517
|
-
const { value: exprValue, valueOriginalPositions: exprPositions, stmts: stmts
|
|
522
|
+
const { value: exprValue, valueOriginalPositions: exprPositions, stmts: stmts } = this.cxxNodeToValueAndStmts(expressionStatement);
|
|
518
523
|
if (exprValue instanceof Expr_1.AbstractInvokeExpr) {
|
|
519
524
|
this.cxxAddInvokeStmts(exprValue, exprPositions, stmts);
|
|
520
525
|
}
|
|
@@ -558,11 +563,7 @@ class ArkCxxIRTransformer extends ArkIRTransformer_1.ArkIRTransformer {
|
|
|
558
563
|
let { value: exprValue, valueOriginalPositions: exprPositions, stmts: exprTempStmts, } = this.cxxNodeToValueAndStmts(switchStatement.inner[switchStatement.inner.length - 2]);
|
|
559
564
|
exprStmts.push(...exprTempStmts);
|
|
560
565
|
if (IRUtils_1.IRUtils.moreThanOneAddress(exprValue)) {
|
|
561
|
-
({
|
|
562
|
-
value: exprValue,
|
|
563
|
-
valueOriginalPositions: exprPositions,
|
|
564
|
-
stmts: exprTempStmts,
|
|
565
|
-
} = this.generateAssignStmtForValue(exprValue, exprPositions));
|
|
566
|
+
({ value: exprValue, valueOriginalPositions: exprPositions, stmts: exprTempStmts } = this.generateAssignStmtForValue(exprValue, exprPositions));
|
|
566
567
|
exprStmts.push(...exprTempStmts);
|
|
567
568
|
}
|
|
568
569
|
valueAndStmtsOfSwitchAndCases.push({
|
|
@@ -574,7 +575,7 @@ class ArkCxxIRTransformer extends ArkIRTransformer_1.ArkIRTransformer {
|
|
|
574
575
|
for (const clause of switchStatement.inner[switchStatement.inner.length - 1].inner) {
|
|
575
576
|
if (clause.kind === ArkCxxAstNode_1.AstKind.CaseStmt) {
|
|
576
577
|
const clauseStmts = [];
|
|
577
|
-
let { value: clauseValue, valueOriginalPositions: clausePositions, stmts: clauseTempStmts
|
|
578
|
+
let { value: clauseValue, valueOriginalPositions: clausePositions, stmts: clauseTempStmts } = this.cxxNodeToValueAndStmts(clause.inner[0]);
|
|
578
579
|
clauseStmts.push(...clauseTempStmts);
|
|
579
580
|
if (IRUtils_1.IRUtils.moreThanOneAddress(clauseValue)) {
|
|
580
581
|
({
|
|
@@ -658,7 +659,7 @@ class ArkCxxIRTransformer extends ArkIRTransformer_1.ArkIRTransformer {
|
|
|
658
659
|
return this.memberCallExpressionToStmts(expressionStatement);
|
|
659
660
|
}
|
|
660
661
|
memberCallExpressionToStmts(expression) {
|
|
661
|
-
const { value: exprValue, valueOriginalPositions: exprPositions, stmts: stmts
|
|
662
|
+
const { value: exprValue, valueOriginalPositions: exprPositions, stmts: stmts } = this.cxxNodeToValueAndStmts(expression);
|
|
662
663
|
if (exprValue instanceof Expr_1.AbstractInvokeExpr) {
|
|
663
664
|
const invokeStmt = new Stmt_1.ArkInvokeStmt(exprValue);
|
|
664
665
|
invokeStmt.setOperandOriginalPositions(exprPositions);
|
|
@@ -695,7 +696,7 @@ class ArkCxxIRTransformer extends ArkIRTransformer_1.ArkIRTransformer {
|
|
|
695
696
|
}
|
|
696
697
|
expressionToStmts(expression) {
|
|
697
698
|
var _a;
|
|
698
|
-
const { value: exprValue, valueOriginalPositions: exprPositions, stmts: stmts
|
|
699
|
+
const { value: exprValue, valueOriginalPositions: exprPositions, stmts: stmts } = this.cxxNodeToValueAndStmts(expression);
|
|
699
700
|
if (exprValue instanceof Expr_1.AbstractInvokeExpr) {
|
|
700
701
|
const invokeStmt = new Stmt_1.ArkInvokeStmt(exprValue);
|
|
701
702
|
invokeStmt.setOperandOriginalPositions(exprPositions);
|
|
@@ -774,7 +775,7 @@ class ArkCxxIRTransformer extends ArkIRTransformer_1.ArkIRTransformer {
|
|
|
774
775
|
return this.cxxIfStatementToStmts(ifStatement.inner[0], depth);
|
|
775
776
|
}
|
|
776
777
|
else {
|
|
777
|
-
const { value: conditionExpr, valueOriginalPositions: conditionExprPositions, stmts: conditionStmts } = this.ArkCxxValueTransformer.cxxConditionToValueAndStmts(ifStatement);
|
|
778
|
+
const { value: conditionExpr, valueOriginalPositions: conditionExprPositions, stmts: conditionStmts, } = this.ArkCxxValueTransformer.cxxConditionToValueAndStmts(ifStatement);
|
|
778
779
|
stmts.push(...conditionStmts);
|
|
779
780
|
const ifStmt = new Stmt_1.ArkIfStmt(conditionExpr);
|
|
780
781
|
ifStmt.setOperandOriginalPositions(conditionExprPositions);
|
|
@@ -787,7 +788,7 @@ class ArkCxxIRTransformer extends ArkIRTransformer_1.ArkIRTransformer {
|
|
|
787
788
|
}
|
|
788
789
|
cxxThrowStatementToStmts(throwStatement) {
|
|
789
790
|
const stmts = [];
|
|
790
|
-
let { value: throwValue, valueOriginalPositions: throwValuePositions, stmts: throwStmts
|
|
791
|
+
let { value: throwValue, valueOriginalPositions: throwValuePositions, stmts: throwStmts } = this.cxxNodeToValueAndStmts(throwStatement.inner[0]);
|
|
791
792
|
if (throwStatement.inner.length === 0 && this.catchedExceptions.length !== 0) {
|
|
792
793
|
throwValue = this.catchedExceptions[this.catchedExceptions.length - 1];
|
|
793
794
|
}
|
|
@@ -916,8 +917,7 @@ class ArkCxxIRTransformer extends ArkIRTransformer_1.ArkIRTransformer {
|
|
|
916
917
|
}
|
|
917
918
|
return value.getBase().getType();
|
|
918
919
|
}
|
|
919
|
-
setBuilderMethodContextFlag(builderMethodContextFlag) {
|
|
920
|
-
}
|
|
920
|
+
setBuilderMethodContextFlag(builderMethodContextFlag) { }
|
|
921
921
|
}
|
|
922
922
|
exports.ArkCxxIRTransformer = ArkCxxIRTransformer;
|
|
923
923
|
ArkCxxIRTransformer.DUMMY_IF_OPERATOR_AND_SIGNAL = 'If(&&)';
|
|
@@ -23,7 +23,7 @@ export declare class ArkCxxValueTransformer extends ArkValueTransformer {
|
|
|
23
23
|
* struct Point q = (struct Point){.x = 5, .y = 8, .name = 'c'};
|
|
24
24
|
* int* arr = (int[5]){1, 2, 3, 4, 5};
|
|
25
25
|
* the right value is {},its kind is CompoundLiteralExpr or InitListExpr
|
|
26
|
-
|
|
26
|
+
*/
|
|
27
27
|
private cxxAggregateToValueAndStmts;
|
|
28
28
|
private cxxThisExpressionToValueAndStmts;
|
|
29
29
|
private isNodeRelatedToCXXLambdaFunc;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ArkValueTransformer.d.ts","sourceRoot":"","sources":["../../../../src/frontend/cppFrontend/common/ArkValueTransformer.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ArkValueTransformer.d.ts","sourceRoot":"","sources":["../../../../src/frontend/cppFrontend/common/ArkValueTransformer.ts"],"names":[],"mappings":"AAoDA,OAAO,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AAMjD,OAAO,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAI1D,OAAO,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAUxE,OAAO,EAAE,mBAAmB,EAAE,MAAM,0CAA0C,CAAC;AAK/E,OAAO,EAAmC,SAAS,EAAoB,UAAU,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAqDtI,qBAAa,sBAAuB,SAAQ,mBAAmB;IAC3D,OAAO,CAAC,mBAAmB,CAAsB;IACjD,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAqB;IAGnD,OAAO,CAAC,sBAAsB,CA4D5B;gBAEU,gBAAgB,EAAE,mBAAmB,EAAE,UAAU,EAAE,kBAAkB,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