Browse Source

Added support for -verify-ignore-unexpected

Tristan Labelle 7 years ago
parent
commit
b21fbe5ecf

+ 4 - 8
tools/clang/lib/Frontend/ASTUnit.cpp

@@ -2054,14 +2054,10 @@ ASTUnit *ASTUnit::LoadFromCommandLine(
   AST.reset(new ASTUnit(false));
   // HLSL Change Starts
   AST->HlslLangExtensions = HlslLangExtensions;
-  // Enable -verify on the libclang initialization path.
-  bool VerifyDiagnostics = false;
-  for (const char** Arg = ArgBegin; Arg != ArgEnd; ++Arg) {
-    if (strcmp(*Arg, "-verify") == 0) {
-      VerifyDiagnostics = true;
-      break;
-    }
-  }
+  // Enable -verify and -verify-ignore-unexpected on the libclang initialization path.
+  bool VerifyDiagnostics = CI->getDiagnosticOpts().VerifyDiagnostics;
+  Diags->getDiagnosticOptions().setVerifyIgnoreUnexpected(
+	  CI->getDiagnosticOpts().getVerifyIgnoreUnexpected());
   // HLSL Change Ends
   ConfigureDiags(Diags, *AST, CaptureDiagnostics, VerifyDiagnostics); // HLSL Change
   AST->Diagnostics = Diags;

+ 2 - 1
tools/clang/test/HLSL/conversions-between-type-shapes.hlsl

@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -Wno-unused-value -fsyntax-only -ffreestanding -verify %s
+// RUN: %clang_cc1 -Wno-unused-value -fsyntax-only -ffreestanding -verify -verify-ignore-unexpected=note %s
 
 // Tests all implicit conversions and explicit casts between type shapes
 // (scalars, vectors, matrices, arrays and structs).
@@ -16,6 +16,7 @@ struct S2 { int a, b; };
 struct S4 { int a, b, c, d; };
 struct S5 { int a, b, c, d, e; };
 
+// Clang generates a bunch of "notes" about overload candidates here, but we're not testing for these
 void to_i(int i) {}
 void to_v1(int1 v) {}
 void to_v2(int2 v) {}