Browse Source

[spirv] use std::ostringstream to build string.

Ehsan Nasiri 6 years ago
parent
commit
59d6973a84

+ 0 - 2
tools/clang/lib/SPIRV/LowerTypeVisitor.cpp

@@ -297,10 +297,8 @@ const SpirvType *LowerTypeVisitor::lowerType(QualType type,
         // LowerTypeVisitor is invoked. We should error out if we encounter a
         // literal type.
         case BuiltinType::LitInt:
-          // emitError("found literal int type when lowering types", srcLoc);
           return spvContext.getUIntType(64);
         case BuiltinType::LitFloat: {
-          // emitError("found literal float type when lowering types", srcLoc);
           return spvContext.getFloatType(64);
 
         default:

+ 1 - 1
tools/clang/lib/SPIRV/SpirvEmitter.cpp

@@ -1,4 +1,4 @@
-//===------- SpirvEmitter.h - SPIR-V Binary Code Emitter --------*- C++ -*-===//
+//===------- SpirvEmitter.cpp - SPIR-V Binary Code Emitter ------*- C++ -*-===//
 //
 //                     The LLVM Compiler Infrastructure
 //

+ 5 - 3
tools/clang/lib/SPIRV/SpirvType.cpp

@@ -12,6 +12,8 @@
 
 #include "clang/SPIRV/SpirvType.h"
 
+#include <sstream>
+
 namespace clang {
 namespace spirv {
 
@@ -167,9 +169,9 @@ std::string ImageType::getImageName(spv::Dim dim, bool arrayed) {
   default:
     break;
   }
-  std::string name =
-      std::string("type.") + dimStr + "image" + (arrayed ? ".array" : "");
-  return name;
+  std::ostringstream name;
+  name << "type." << dimStr << "image" << (arrayed ? ".array" : "");
+  return name.str();
 }
 
 bool ImageType::operator==(const ImageType &that) const {