mirror of
https://github.com/github/codeql.git
synced 2026-04-29 18:55:14 +02:00
C#: Follow line directives when getting element location
This commit is contained in:
@@ -27,7 +27,13 @@ namespace Semmle.Extraction.CSharp.Entities
|
||||
if (trivia.Line.IsKind(SyntaxKind.NumericLiteralToken))
|
||||
{
|
||||
var value = (int)trivia.Line.Value;
|
||||
trapFile.directive_line_values(this, value, trivia.File.ValueText);
|
||||
trapFile.directive_line_value(this, value);
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(trivia.File.ValueText))
|
||||
{
|
||||
var file = Extraction.Entities.File.Create(cx, trivia.File.ValueText);
|
||||
trapFile.directive_line_file(this, file);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,8 @@ namespace Semmle.Extraction.CSharp.Entities
|
||||
|
||||
protected override void PopulatePreprocessor(TextWriter trapFile)
|
||||
{
|
||||
trapFile.pragma_checksums(this, trivia.File.ToString(), trivia.Guid.ToString(), trivia.Bytes.ToString());
|
||||
var file = Extraction.Entities.File.Create(cx, trivia.File.ValueText);
|
||||
trapFile.pragma_checksums(this, file, trivia.Guid.ToString(), trivia.Bytes.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -624,7 +624,7 @@ namespace Semmle.Extraction.CSharp
|
||||
trapFile.WriteTuple("pragma_warning_error_codes", pragma, errorCode, child);
|
||||
}
|
||||
|
||||
internal static void pragma_checksums(this TextWriter trapFile, PragmaChecksumDirective pragma, string file, string guid, string bytes)
|
||||
internal static void pragma_checksums(this TextWriter trapFile, PragmaChecksumDirective pragma, Extraction.Entities.File file, string guid, string bytes)
|
||||
{
|
||||
trapFile.WriteTuple("pragma_checksums", pragma, file, guid, bytes);
|
||||
}
|
||||
@@ -659,9 +659,14 @@ namespace Semmle.Extraction.CSharp
|
||||
trapFile.WriteTuple("directive_lines", directive, kind);
|
||||
}
|
||||
|
||||
internal static void directive_line_values(this TextWriter trapFile, LineDirective directive, int line, string file)
|
||||
internal static void directive_line_value(this TextWriter trapFile, LineDirective directive, int line)
|
||||
{
|
||||
trapFile.WriteTuple("directive_line_values", directive, line, file);
|
||||
trapFile.WriteTuple("directive_line_value", directive, line);
|
||||
}
|
||||
|
||||
internal static void directive_line_file(this TextWriter trapFile, LineDirective directive, Extraction.Entities.File file)
|
||||
{
|
||||
trapFile.WriteTuple("directive_line_file", directive, file);
|
||||
}
|
||||
|
||||
internal static void directive_regions(this TextWriter trapFile, RegionDirective directive, string name)
|
||||
|
||||
Reference in New Issue
Block a user