mirror of
https://github.com/github/codeql.git
synced 2026-04-26 09:15:12 +02:00
C#: Add shared base class for line and line span pragmas.
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
using Microsoft.CodeAnalysis;
|
||||
using Microsoft.CodeAnalysis.CSharp;
|
||||
using Microsoft.CodeAnalysis.CSharp.Syntax;
|
||||
using System.IO;
|
||||
|
||||
namespace Semmle.Extraction.CSharp.Entities
|
||||
{
|
||||
internal enum LineDirectiveKind
|
||||
{
|
||||
Default = 0,
|
||||
Hidden = 1,
|
||||
Numeric = 2,
|
||||
Span = 3
|
||||
}
|
||||
|
||||
internal abstract class LineOrSpanDirective<T> : PreprocessorDirective<T> where T : LineOrSpanDirectiveTriviaSyntax
|
||||
{
|
||||
protected LineOrSpanDirective(Context cx, T trivia)
|
||||
: base(cx, trivia)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void PopulatePreprocessor(TextWriter trapFile)
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(Symbol.File.ValueText))
|
||||
{
|
||||
var file = File.Create(Context, Symbol.File.ValueText);
|
||||
trapFile.directive_line_file(this, file);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user