Browse Source

[spirv] Extended instruction set source location.

Ehsan Nasiri 6 years ago
parent
commit
c5f7d8d57b

+ 1 - 1
tools/clang/include/clang/SPIRV/SpirvBuilder.h

@@ -454,7 +454,7 @@ public:
   /// \brief If not added already, adds an OpExtInstImport (import of extended
   /// instruction set) of the GLSL instruction set. Returns the  the imported
   /// GLSL instruction set.
-  SpirvExtInstImport *getGLSLExtInstSet(SourceLocation loc = {});
+  SpirvExtInstImport *getGLSLExtInstSet();
 
   /// \brief Adds a stage input/ouput variable whose value is of the given type.
   ///

+ 5 - 2
tools/clang/lib/SPIRV/SpirvBuilder.cpp

@@ -820,10 +820,13 @@ void SpirvBuilder::addModuleProcessed(llvm::StringRef process) {
   module->addModuleProcessed(new (context) SpirvModuleProcessed({}, process));
 }
 
-SpirvExtInstImport *SpirvBuilder::getGLSLExtInstSet(SourceLocation loc) {
+SpirvExtInstImport *SpirvBuilder::getGLSLExtInstSet() {
   SpirvExtInstImport *glslSet = module->getGLSLExtInstSet();
   if (!glslSet) {
-    glslSet = new (context) SpirvExtInstImport(loc, "GLSL.std.450");
+    // The extended instruction set is likely required for several different
+    // reasons. We can't pinpoint the source location for one specific function.
+    glslSet =
+        new (context) SpirvExtInstImport(/*SourceLocation*/ {}, "GLSL.std.450");
     module->addExtInstSet(glslSet);
   }
   return glslSet;