Collections\ArrayBuilderExtensions.cs (25)
15public static bool Any<T>(this ArrayBuilder<T> builder, Func<T, bool> predicate)
27public static bool Any<T, A>(this ArrayBuilder<T> builder, Func<T, A, bool> predicate, A arg)
39public static bool All<T>(this ArrayBuilder<T> builder, Func<T, bool> predicate)
51public static bool All<T, A>(this ArrayBuilder<T> builder, Func<T, A, bool> predicate, A arg)
71public static ImmutableArray<TResult> SelectAsArray<TItem, TResult>(this ArrayBuilder<TItem> items, Func<TItem, TResult> map)
91var builder = ArrayBuilder<TResult>.GetInstance(items.Count);
111public static ImmutableArray<TResult> SelectAsArray<TItem, TArg, TResult>(this ArrayBuilder<TItem> items, Func<TItem, TArg, TResult> map, TArg arg)
131var builder = ArrayBuilder<TResult>.GetInstance(items.Count);
151public static ImmutableArray<TResult> SelectAsArrayWithIndex<TItem, TArg, TResult>(this ArrayBuilder<TItem> items, Func<TItem, int, TArg, TResult> map, TArg arg)
171var builder = ArrayBuilder<TResult>.GetInstance(items.Count);
181public static void AddOptional<T>(this ArrayBuilder<T> builder, T? item)
193public static void Push<T>(this ArrayBuilder<T> builder, T e)
198public static T Pop<T>(this ArrayBuilder<T> builder)
205public static bool TryPop<T>(this ArrayBuilder<T> builder, [MaybeNullWhen(false)] out T result)
217public static T Peek<T>(this ArrayBuilder<T> builder)
222public static ImmutableArray<T> ToImmutableOrEmptyAndFree<T>(this ArrayBuilder<T>? builder)
227public static void AddIfNotNull<T>(this ArrayBuilder<T> builder, T? value)
236public static void AddIfNotNull<T>(this ArrayBuilder<T> builder, T? value)
245public static void FreeAll<T>(this ArrayBuilder<T> builder, Func<T, ArrayBuilder<T>?> getNested)
259public static OneOrMany<T> ToOneOrManyAndFree<T>(this ArrayBuilder<T> builder)
275public static void RemoveWhere<TItem, TArg>(this ArrayBuilder<TItem> builder, Func<TItem, int, TArg, bool> filter, TArg arg)
CommandLine\AnalyzerConfigSet.cs (21)
128var sortedAnalyzerConfigs = ArrayBuilder<AnalyzerConfig>.GetInstance(analyzerConfigs.Count);
141var allMatchers = ArrayBuilder<ImmutableArray<SectionNameMatcher?>>.GetInstance(_analyzerConfigs.Length);
147var builder = ArrayBuilder<SectionNameMatcher?>.GetInstance(config.NamedSections.Length);
245var diagnosticBuilder = ArrayBuilder<Diagnostic>.GetInstance();
373var diagnosticBuilder = ArrayBuilder<Diagnostic>.GetInstance();
395private static void ParseSectionOptions(Section section, TreeOptions.Builder treeBuilder, AnalyzerOptions.Builder analyzerBuilder, ArrayBuilder<Diagnostic> diagnosticBuilder, string analyzerConfigPath, ConcurrentDictionary<ReadOnlyMemory<char>, string> diagIdCache)
450/// <param name="analyzerConfigs">An <see cref="ArrayBuilder{T}"/> of <see cref="AnalyzerConfig"/> containing a mix of regular and unmerged partial global configs</param>
453internal static GlobalAnalyzerConfig MergeGlobalConfigs(ArrayBuilder<AnalyzerConfig> analyzerConfigs, out ImmutableArray<Diagnostic> diagnostics)
478private ImmutableDictionary<string, ImmutableDictionary<string, (int globalLevel, ArrayBuilder<string> configPaths)>.Builder>.Builder? _duplicates;
488_duplicates = ImmutableDictionary.CreateBuilder<string, ImmutableDictionary<string, (int, ArrayBuilder<string>)>.Builder>(Section.NameEqualityComparer);
524foreach ((var keyName, (_, var configPaths)) in keys)
540ArrayBuilder<Section> namedSectionBuilder = new ArrayBuilder<Section>(_values.Count);
582(int globalLevel, ArrayBuilder<string> configPaths) duplicateValue = default;
608duplicateDict = ImmutableDictionary.CreateBuilder<string, (int, ArrayBuilder<string>)>(Section.PropertiesKeyComparer);
613ArrayBuilder<string> configList = duplicateValue.configPaths ?? ArrayBuilder<string>.GetInstance();
CommandLine\CommandLineParser.cs (21)
212var parts = ArrayBuilder<ReadOnlyMemory<char>>.GetInstance();
345var pathMapBuilder = ArrayBuilder<KeyValuePair<string, string>>.GetInstance();
391var result = ArrayBuilder<string>.GetInstance();
492ArrayBuilder<string> processedArgs,
501var args = ArrayBuilder<string>.GetInstance();
831var parts = ArrayBuilder<ReadOnlyMemory<char>>.GetInstance();
1032var builder = ArrayBuilder<ReadOnlyMemory<char>>.GetInstance();
1037internal static void ParseSeparatedPathsEx(ReadOnlyMemory<char>? str, ArrayBuilder<ReadOnlyMemory<char>> builder)
1049internal static void ParseSeparatedStrings(ReadOnlyMemory<char>? strMemory, char[] separators, bool removeEmptyEntries, ArrayBuilder<ReadOnlyMemory<char>> builder)
1121internal void ParseFileArgument(ReadOnlyMemory<char> arg, string? baseDirectory, ArrayBuilder<string> filePathBuilder, IList<Diagnostic> errors)
1153private protected void ParseSeparatedFileArgument(ReadOnlyMemory<char> value, string? baseDirectory, ArrayBuilder<string> filePathBuilder, IList<Diagnostic> errors)
1155var pathBuilder = ArrayBuilder<ReadOnlyMemory<char>>.GetInstance();
1171var builder = ArrayBuilder<string>.GetInstance();
DiagnosticAnalyzer\AnalyzerDriver.cs (37)
901var builder = ArrayBuilder<(DiagnosticDescriptor Descriptor, DiagnosticDescriptorErrorLoggerInfo Info)>.GetInstance();
1065var builder = ArrayBuilder<Diagnostic>.GetInstance(reportedDiagnostics.Length);
1099var tasks = ArrayBuilder<Task>.GetInstance();
1154var programmaticSuppressionsBuilder = PooledDictionary<Diagnostic, ArrayBuilder<Suppression>>.GetInstance();
1158if (!programmaticSuppressionsBuilder.TryGetValue(programmaticSuppression.SuppressedDiagnostic, out var array))
1160array = ArrayBuilder<Suppression>.GetInstance();
1328var declarationInfoBuilder = ArrayBuilder<DeclarationInfo>.GetInstance();
1455var builder = ArrayBuilder<(DiagnosticAnalyzer, ImmutableArray<ImmutableArray<SymbolAnalyzerAction>>)>.GetInstance();
1457var actionsByKindBuilder = ArrayBuilder<ArrayBuilder<SymbolAnalyzerAction>>.GetInstance();
1469actionsByKindBuilder.Add(ArrayBuilder<SymbolAnalyzerAction>.GetInstance());
1487var builder = ArrayBuilder<(DiagnosticAnalyzer, ImmutableArray<TAnalyzerAction>)>.GetInstance();
1828var completedAnalyzers = ArrayBuilder<DiagnosticAnalyzer>.GetInstance();
2544var builder = ArrayBuilder<DeclarationInfo>.GetInstance();
2556private static void ComputeDeclarationsInNode(SemanticModel semanticModel, ISymbol declaredSymbol, SyntaxNode declaringReferenceSyntax, SyntaxNode topmostNodeForAnalysis, ArrayBuilder<DeclarationInfo> builder, CancellationToken cancellationToken)
2606var nodesToAnalyze = declarationAnalysisData.DescendantNodesToAnalyze;
2612void executeNodeActionsByKind(ArrayBuilder<SyntaxNode> nodesToAnalyze, GroupedAnalyzerActions groupedActions, bool arePerSymbolActions)
2629var filteredNodesToAnalyze = ArrayBuilder<SyntaxNode>.GetInstance(nodesToAnalyze.Count);
2648ArrayBuilder<SyntaxNode> filteredNodesToAnalyze)
2667var executableCodeBlockActionsBuilder = ArrayBuilder<ExecutableCodeBlockAnalyzerActions>.GetInstance();
2826ArrayBuilder<ExecutableCodeBlockAnalyzerActions> builder)
2844ArrayBuilder<SyntaxNode> nodesToAnalyze,
2920ArrayBuilder<IOperation> operationBlocksToAnalyze = ArrayBuilder<IOperation>.GetInstance();
2936ArrayBuilder<IOperation> operationsToAnalyze = ArrayBuilder<IOperation>.GetInstance();
Emit\EditAndContinue\DeltaMetadataWriter.cs (31)
38private readonly IReadOnlyDictionary<ITypeDefinition, ArrayBuilder<IMethodDefinition>> _deletedMethodDefs;
56private readonly ArrayBuilder<int> _customAttributeRowIds;
78IReadOnlyDictionary<ITypeDefinition, ArrayBuilder<IMethodDefinition>> deletedMethodDefs,
118_customAttributeRowIds = ArrayBuilder<int>.GetInstance();
277public void GetUpdatedMethodTokens(ArrayBuilder<MethodDefinitionHandle> methods)
292public void GetChangedTypeTokens(ArrayBuilder<TypeDefinitionHandle> types)
495internal static IReadOnlyDictionary<ITypeDefinition, ArrayBuilder<IMethodDefinition>> CreateDeletedMethodsDefs(EmitContext context, SymbolChanges changes)
497var result = new Dictionary<ITypeDefinition, ArrayBuilder<IMethodDefinition>>(ReferenceEqualityComparer.Instance);
509var deletedMethodDefs = getDeletedMethodDefs(typeDef);
521ArrayBuilder<IMethodDefinition>? getDeletedMethodDefs(ITypeDefinition typeDef)
529var newMethodDefs = ArrayBuilder<IMethodDefinition>.GetInstance();
657if (_deletedMethodDefs.TryGetValue(typeDef, out var newMethodDefs))
679var implementingMethods = ArrayBuilder<int>.GetInstance();
856var encInfos = ArrayBuilder<EncLocalInfo>.GetInstance();
1074var paramEncMapRows = ArrayBuilder<int>.GetInstance();
1083private void PopulateEncLogTableRows(ImmutableArray<int> rowCounts, ArrayBuilder<int> paramEncMapRows)
1179private void PopulateEncLogTableParameters(ArrayBuilder<int> paramEncMapRows)
1238private void PopulateEncMapTableRows(ImmutableArray<int> rowCounts, ArrayBuilder<int> paramEncMapRows)
1244var tokens = ArrayBuilder<EntityHandle>.GetInstance();
1321var debugTokens = ArrayBuilder<EntityHandle>.GetInstance();
1390ArrayBuilder<EntityHandle> builder,
1398private static void AddReferencedTokens(ArrayBuilder<EntityHandle> tokens, TableIndex tableIndex, int firstRowId, int nTokens)
1406private static void AddDefinitionTokens<T>(ArrayBuilder<EntityHandle> tokens, TableIndex tableIndex, DefinitionIndex<T> index)
1415private static void AddRowNumberTokens(ArrayBuilder<EntityHandle> tokens, TableIndex tableIndex, ArrayBuilder<int> rowNumbers)
Operations\ControlFlowGraphBuilder.cs (78)
33private readonly ArrayBuilder<BasicBlockBuilder> _blocks;
41private readonly ArrayBuilder<(EvalStackFrame? frameOpt, IOperation? operationOpt)> _evalStack;
63private ControlFlowGraphBuilder(Compilation compilation, CaptureIdDispenser? captureIdDispenser, ArrayBuilder<BasicBlockBuilder> blocks)
70_evalStack = ArrayBuilder<(EvalStackFrame? frameOpt, IOperation? operationOpt)>.GetInstance();
113var blocks = ArrayBuilder<BasicBlockBuilder>.GetInstance();
149var localFunctions = ArrayBuilder<IMethodSymbol>.GetInstance();
172private static ImmutableArray<BasicBlock> ToImmutableBlocks(ArrayBuilder<BasicBlockBuilder> blockBuilders)
174var builder = ArrayBuilder<BasicBlock>.GetInstance(blockBuilders.Count);
223private static void MarkReachableBlocks(ArrayBuilder<BasicBlockBuilder> blocks)
240ArrayBuilder<BasicBlockBuilder> blocks,
243ArrayBuilder<BasicBlockBuilder>? outOfRangeBlocksToVisit,
249var toVisit = ArrayBuilder<BasicBlockBuilder>.GetInstance();
494private static void Pack(ArrayBuilder<BasicBlockBuilder> blocks, RegionBuilder root, PooledDictionary<BasicBlockBuilder, RegionBuilder> regionMap)
511private static bool PackRegions(RegionBuilder root, ArrayBuilder<BasicBlockBuilder> blocks, PooledDictionary<BasicBlockBuilder, RegionBuilder> regionMap)
614private static void MergeSubRegionAndFree(RegionBuilder subRegion, ArrayBuilder<BasicBlockBuilder> blocks, PooledDictionary<BasicBlockBuilder, RegionBuilder> regionMap, bool canHaveEmptyRegion = false)
670private static bool PackBlocks(ArrayBuilder<BasicBlockBuilder> blocks, PooledDictionary<BasicBlockBuilder, RegionBuilder> regionMap)
672ArrayBuilder<RegionBuilder>? fromCurrent = null;
673ArrayBuilder<RegionBuilder>? fromDestination = null;
674ArrayBuilder<RegionBuilder>? fromPredecessor = null;
675ArrayBuilder<BasicBlockBuilder>? predecessorsBuilder = null;
893predecessorsBuilder = ArrayBuilder<BasicBlockBuilder>.GetInstance();
1101bool checkBranchesFromPredecessors(ArrayBuilder<BasicBlockBuilder> predecessors, RegionBuilder currentRegion, RegionBuilder? destinationRegionOpt)
1148void collectAncestorsAndSelf([DisallowNull] RegionBuilder? from, [NotNull] ref ArrayBuilder<RegionBuilder>? builder)
1152builder = ArrayBuilder<RegionBuilder>.GetInstance();
1170int getIndexOfLastLeftRegion(ArrayBuilder<RegionBuilder> from, ArrayBuilder<RegionBuilder> to)
1186private static void CheckUnresolvedBranches(ArrayBuilder<BasicBlockBuilder> blocks, PooledDictionary<ILabelSymbol, BasicBlockBuilder>? labeledBlocks)
2007var builder = ArrayBuilder<T>.GetInstance(numElements);
2047ArrayBuilder<IInterpolatedStringHandlerCreationOperation>? interpolatedStringBuilder = null;
2055interpolatedStringBuilder ??= ArrayBuilder<IInterpolatedStringHandlerCreationOperation>.GetInstance();
2204var stack = ArrayBuilder<(IBinaryOperation, EvalStackFrame)>.GetInstance();
2794var stack = ArrayBuilder<(IOperation? condition, BasicBlockBuilder dest, bool jumpIfTrue)>.GetInstance();
3369var operations = ArrayBuilder<IOperation>.GetInstance();
3741var predecessors = ArrayBuilder<BasicBlockBuilder>.GetInstance();
3969var resourceQueue = ArrayBuilder<(IVariableDeclarationOperation, IVariableDeclaratorOperation)>.GetInstance(declarationGroup.Declarations.Length);
4008void processQueue(ArrayBuilder<(IVariableDeclarationOperation, IVariableDeclaratorOperation)>? resourceQueueOpt)
4030void processResource(IOperation resource, ArrayBuilder<(IVariableDeclarationOperation, IVariableDeclaratorOperation)>? resourceQueueOpt)
4793var builder = ArrayBuilder<IOperation>.GetInstance(--parametersCount, fillWithValue: null!);
4806var builder = ArrayBuilder<IArgumentOperation>.GetInstance(parametersCount, fillWithValue: null!);
6386var initializerBuilder = ArrayBuilder<IOperation>.GetInstance(operation.Initializers.Length);
6519var builder = ArrayBuilder<IOperation>.GetInstance(initializer.ElementValues.Length);
6697var elementBuilder = ArrayBuilder<IOperation>.GetInstance(numElements);
6849var appendCalls = ArrayBuilder<IInterpolatedStringAppendOperation>.GetInstance();
6892static void collectAppendCalls(IInterpolatedStringHandlerCreationOperation creation, ArrayBuilder<IInterpolatedStringAppendOperation> appendCalls)
6901var stack = ArrayBuilder<IInterpolatedStringAdditionOperation>.GetInstance();
6933static void appendStringCalls(IInterpolatedStringOperation interpolatedString, ArrayBuilder<IInterpolatedStringAppendOperation> appendCalls)
6941static void pushLeftNodes(IInterpolatedStringAdditionOperation addition, ArrayBuilder<IInterpolatedStringAdditionOperation> stack)
7045var partsBuilder = ArrayBuilder<IInterpolatedStringContentOperation>.GetInstance(operation.Parts.Length);
7247var builder = ArrayBuilder<IArgumentOperation>.GetInstance(propertySymbol.Parameters.Length);
7445var children = ArrayBuilder<IOperation>.GetInstance();
7574var stack = ArrayBuilder<IBinaryPatternOperation>.GetInstance();
7818ArrayBuilder<IOperation> statementsBuilder = ArrayBuilder<IOperation>.GetInstance(statements.Length);
7819ArrayBuilder<IOperation>? localFunctionsBuilder = null;
7825(localFunctionsBuilder ??= ArrayBuilder<IOperation>.GetInstance()).Add(statement);
7976var initializerBuilder = ArrayBuilder<IOperation>.GetInstance(initializers.Length);
SourceGeneration\ISyntaxHelper.cs (6)
20void AddAttributeTargets(SyntaxNode node, ArrayBuilder<SyntaxNode> targets);
32void AddAliases(GreenNode node, ArrayBuilder<(string aliasName, string symbolName)> aliases, bool global);
33void AddAliases(CompilationOptions options, ArrayBuilder<(string aliasName, string symbolName)> aliases);
53public abstract void AddAttributeTargets(SyntaxNode node, ArrayBuilder<SyntaxNode> targets);
57public abstract void AddAliases(GreenNode node, ArrayBuilder<(string aliasName, string symbolName)> aliases, bool global);
58public abstract void AddAliases(CompilationOptions options, ArrayBuilder<(string aliasName, string symbolName)> aliases);
FlowAnalysis\NullableWalker.cs (32)
247/// The delegate is invoked by <see cref="VisitConversion(BoundConversion, BoundExpression, Conversion, TypeWithAnnotations, TypeWithState, bool, bool, bool, AssignmentKind, ParameterSymbol, bool, bool, bool, bool, Optional<LocalState>,bool, Location, ArrayBuilder<VisitResult>)"/>.
954var builder = ArrayBuilder<Symbol>.GetInstance(members.Length + baseRequiredMembers.Count);
2788var members = ArrayBuilder<(VariableIdentifier, int)>.GetInstance();
2808var members = ArrayBuilder<(VariableIdentifier, int)>.GetInstance();
3131var localFuncs = ArrayBuilder<BoundLocalFunctionStatement?>.GetInstance();
3755var resultBuilder = ArrayBuilder<VisitResult>.GetInstance(node.Elements.Length);
3756var elementConversionCompletions = ArrayBuilder<Func<TypeWithAnnotations, TypeWithState>>.GetInstance();
4449var builder = ArrayBuilder<VisitResult>.GetInstance(argumentResults.Length);
4628var expressions = ArrayBuilder<BoundExpression>.GetInstance(initialization.Initializers.Length);
4653var expressionsNoConversions = ArrayBuilder<BoundExpression>.GetInstance(n);
4654var conversions = ArrayBuilder<Conversion>.GetInstance(n);
4655var expressionTypes = ArrayBuilder<TypeWithState>.GetInstance(n);
4656var placeholderBuilder = ArrayBuilder<BoundExpression>.GetInstance(n);
4782var resultTypes = ArrayBuilder<TypeWithAnnotations>.GetInstance(n);
4783var placeholdersBuilder = ArrayBuilder<BoundExpression>.GetInstance(n);
5341var slotBuilder = ArrayBuilder<int>.GetInstance();
5482var slotBuilder = ArrayBuilder<int>.GetInstance();
6239var calls = ArrayBuilder<BoundCall>.GetInstance();
6910var conversionResultsBuilder = ArrayBuilder<VisitResult>.GetInstance(results.Length);
7099var argumentsBuilder = ArrayBuilder<BoundExpression>.GetInstance(arguments.Length + elements.Length - 1);
7107var argsToParamsBuilder = ArrayBuilder<int>.GetInstance(argsToParamsOpt.Length + elements.Length - 1);
7116var refKindsBuilder = ArrayBuilder<RefKind>.GetInstance(refKindsOpt.Length + elements.Length - 1);
7291var resultsBuilder = ArrayBuilder<VisitResult>.GetInstance(n);
7803var argumentsBuilder = ArrayBuilder<BoundExpression>.GetInstance(n);
7804var conversionsBuilder = ArrayBuilder<Conversion>.GetInstance(n);
7888var refKinds = ArrayBuilder<RefKind>.GetInstance();
7995var builder = ArrayBuilder<BoundExpression>.GetInstance(n);
8024var elementsBuilder = ArrayBuilder<BoundNode>.GetInstance(collectionExpressionVisitResults.Length);
8071var diagnosticsBuilder = ArrayBuilder<TypeParameterDiagnosticInfo>.GetInstance();
8072var nullabilityBuilder = ArrayBuilder<TypeParameterDiagnosticInfo>.GetInstance();
9878var arguments = ArrayBuilder<BoundExpression>.GetInstance();
10412var builder = ArrayBuilder<DeconstructionVariable>.GetInstance(arguments.Length);