mirror of
https://github.com/github/codeql.git
synced 2026-04-24 08:15:14 +02:00
C#: Extract stackalloc information
This commit is contained in:
@@ -90,6 +90,12 @@ namespace Semmle.Extraction.CSharp.Entities.Expressions
|
||||
|
||||
public override InitializerExpressionSyntax Initializer => Syntax.Initializer;
|
||||
|
||||
protected override void PopulateExpression(TextWriter trapFile)
|
||||
{
|
||||
base.PopulateExpression(trapFile);
|
||||
trapFile.stackalloc_array_creation(this);
|
||||
}
|
||||
|
||||
public static Expression Create(ExpressionNodeInfo info) => new StackAllocArrayCreation(info).TryPopulate();
|
||||
}
|
||||
|
||||
@@ -103,6 +109,7 @@ namespace Semmle.Extraction.CSharp.Entities.Expressions
|
||||
{
|
||||
ArrayInitializer.Create(new ExpressionNodeInfo(cx, Syntax.Initializer, this, -1));
|
||||
trapFile.implicitly_typed_array_creation(this);
|
||||
trapFile.stackalloc_array_creation(this);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -466,6 +466,11 @@ namespace Semmle.Extraction.CSharp
|
||||
trapFile.WriteTuple("specific_type_parameter_nullability", constraints, baseType, nullability);
|
||||
}
|
||||
|
||||
internal static void stackalloc_array_creation(this TextWriter trapFile, Expression array)
|
||||
{
|
||||
trapFile.WriteTuple("stackalloc_array_creation", array);
|
||||
}
|
||||
|
||||
internal static void stmt_location(this TextWriter trapFile, Statement stmt, Location location)
|
||||
{
|
||||
trapFile.WriteTuple("stmt_location", stmt, location);
|
||||
|
||||
Reference in New Issue
Block a user