Create a new method to return string name or number to DRY code.
diff --git a/glslang/Include/Common.h b/glslang/Include/Common.h
index 4c59a37..3bfbe7c 100644
--- a/glslang/Include/Common.h
+++ b/glslang/Include/Common.h
@@ -190,6 +190,13 @@
 
 struct TSourceLoc {
     void init() { name = nullptr; string = 0; line = 0; column = 0; }
+    // Returns the name if it exists. Otherwise, returns the string number.
+    std::string getStringNameOrNum(bool quoteStringName = true) const
+    {
+        if (name != nullptr)
+            return quoteStringName ? ("\"" + std::string(name) + "\"") : name;
+        return std::to_string(string);
+    }
     const char* name; // descriptive name for this string
     int string;
     int line;
diff --git a/glslang/Include/InfoSink.h b/glslang/Include/InfoSink.h
index 61f0cd6..a321ebc 100644
--- a/glslang/Include/InfoSink.h
+++ b/glslang/Include/InfoSink.h
@@ -98,12 +98,8 @@
     void location(const TSourceLoc& loc) {
         const int maxSize = 24;
         char locText[maxSize];
-        if (loc.name != nullptr) {
-            append(loc.name);
-            snprintf(locText, maxSize, ":%d", loc.line);
-        } else {
-            snprintf(locText, maxSize, "%d:%d", loc.string, loc.line);
-        }
+        snprintf(locText, maxSize, ":%d", loc.line);
+        append(loc.getStringNameOrNum(false).c_str());
         append(locText);
         append(": ");
     }
diff --git a/glslang/MachineIndependent/preprocessor/Pp.cpp b/glslang/MachineIndependent/preprocessor/Pp.cpp
index df2de58..63dede7 100644
--- a/glslang/MachineIndependent/preprocessor/Pp.cpp
+++ b/glslang/MachineIndependent/preprocessor/Pp.cpp
@@ -620,13 +620,7 @@
                     std::ostringstream content;
                     content << "#line " << forNextLine << " " << "\"" << sourceName << "\"\n";
                     content << replacement << (replacement.back() == '\n' ? "" : "\n");
-                    content << "#line " << directiveLoc.line + forNextLine << " ";
-                    if (directiveLoc.name != nullptr) {
-                        content << "\"" << directiveLoc.name << "\"";
-                    } else {
-                        content << directiveLoc.string;
-                    }
-                    content << "\n";
+                    content << "#line " << directiveLoc.line + forNextLine << " " << directiveLoc.getStringNameOrNum() << "\n";
                     pushInput(new TokenizableString(directiveLoc, content.str(), this));
                 }
                 // At EOF, there's no "current" location anymore.
@@ -1015,13 +1009,9 @@
         return 1;
 
     case PpAtomFileMacro: {
-        if (const char* current_file = parseContext.getCurrentLoc().name) {
+        if (parseContext.getCurrentLoc().name)
             parseContext.ppRequireExtensions(ppToken->loc, 1, &E_GL_GOOGLE_cpp_style_line_directive, "filename-based __FILE__");
-            sprintf(ppToken->name, "\"%s\"", current_file);
-        } else {
-            ppToken->ival = parseContext.getCurrentLoc().string;
-            sprintf(ppToken->name, "%d", ppToken->ival);
-        }
+        sprintf(ppToken->name, "%s", ppToken->loc.getStringNameOrNum().c_str());
         UngetToken(PpAtomConstInt, ppToken);
         return 1;
     }