[Preprocessor] When checking if we can concatenate two tokens, check
if they were already concatenated in source using the spelling locations
even if they came from a macro expansion.

This fixes an issue where a GUID passed as macro argument ends up
malformed after preprocessing because we added spaces inside it.

rdar://13016645

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173826 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Lex/TokenConcatenation.cpp b/lib/Lex/TokenConcatenation.cpp
index f7b5945..30dc8f1 100644
--- a/lib/Lex/TokenConcatenation.cpp
+++ b/lib/Lex/TokenConcatenation.cpp
@@ -156,9 +156,10 @@
   // First, check to see if the tokens were directly adjacent in the original
   // source.  If they were, it must be okay to stick them together: if there
   // were an issue, the tokens would have been lexed differently.
-  if (PrevTok.getLocation().isFileID() && Tok.getLocation().isFileID() &&
-      PrevTok.getLocation().getLocWithOffset(PrevTok.getLength()) ==
-        Tok.getLocation())
+  SourceManager &SM = PP.getSourceManager();
+  SourceLocation PrevSpellLoc = SM.getSpellingLoc(PrevTok.getLocation());
+  SourceLocation SpellLoc = SM.getSpellingLoc(Tok.getLocation());
+  if (PrevSpellLoc.getLocWithOffset(PrevTok.getLength()) == SpellLoc)
     return false;
 
   tok::TokenKind PrevKind = PrevTok.getKind();