Pārlūkot izejas kodu

Changed default compilation options to honor #line directives and added tests. (#1665)

Tristan Labelle 6 gadi atpakaļ
vecāks
revīzija
182067cafd

+ 1 - 1
tools/clang/include/clang/Basic/DiagnosticOptions.def

@@ -56,7 +56,7 @@ DIAGOPT(ShowCarets, 1, 1)       /// Show carets in diagnostics.
 DIAGOPT(ShowFixits, 1, 1)       /// Show fixit information.
 DIAGOPT(ShowFixits, 1, 1)       /// Show fixit information.
 DIAGOPT(ShowSourceRanges, 1, 0) /// Show source ranges in numeric form.
 DIAGOPT(ShowSourceRanges, 1, 0) /// Show source ranges in numeric form.
 DIAGOPT(ShowParseableFixits, 1, 0) /// Show machine parseable fix-its.
 DIAGOPT(ShowParseableFixits, 1, 0) /// Show machine parseable fix-its.
-DIAGOPT(ShowPresumedLoc, 1, 0)  /// Show presumed location for diagnostics.
+DIAGOPT(ShowPresumedLoc, 1, 1)  /// Show presumed location for diagnostics.
 DIAGOPT(ShowOptionNames, 1, 0)  /// Show the option name for mappable
 DIAGOPT(ShowOptionNames, 1, 0)  /// Show the option name for mappable
                                 /// diagnostics.
                                 /// diagnostics.
 DIAGOPT(ShowNoteIncludeStack, 1, 0) /// Show include stacks for notes.
 DIAGOPT(ShowNoteIncludeStack, 1, 0) /// Show include stacks for notes.

+ 10 - 0
tools/clang/test/CodeGenHLSL/quick-test/line_directive.hlsl

@@ -0,0 +1,10 @@
+// RUN: %dxc -E main -T ps_6_0 2> %s | FileCheck %s
+
+// #line directive should be honored
+// CHECK: renamed.hlsl:42
+
+float4 main() : SV_Target
+{
+#line 42 "renamed.hlsl"
+  return foo; // Undeclared identifier
+}

+ 10 - 0
tools/clang/test/CodeGenHLSL/quick-test/line_directive_ignored.hlsl

@@ -0,0 +1,10 @@
+// RUN: %dxc -E main -T ps_6_0 -ignore-line-directives 2> %s | FileCheck %s
+
+// #line directive should be ignored due to -ignore-line-directives
+// CHECK-NOT: renamed.hlsl:42
+
+float4 main() : SV_Target
+{
+#line 42 "renamed.hlsl"
+  return foo; // Undeclared identifier
+}