To not treat macro invocation locations as part of the include stack
when reporting a diagnostic.

llvm-svn: 38577
diff --git a/clang/Basic/SourceManager.cpp b/clang/Basic/SourceManager.cpp
index 7a6542e..e1357f3 100644
--- a/clang/Basic/SourceManager.cpp
+++ b/clang/Basic/SourceManager.cpp
@@ -129,6 +129,18 @@
   return 0;
 }
 
+/// getIncludeLoc - Return the location of the #include for the specified
+/// FileID.
+SourceLocation SourceManager::getIncludeLoc(unsigned FileID) const {
+  const SrcMgr::FileIDInfo *FIDInfo = getFIDInfo(FileID);
+
+  // For Macros, the physical loc is specified by the MacroTokenFileID.
+  if (FIDInfo->IDType == SrcMgr::FileIDInfo::MacroExpansion)
+    FIDInfo = &FileIDs[FIDInfo->u.MacroTokenFileID-1];
+  
+  return FIDInfo->IncludeLoc;
+}  
+
 
 /// getColumnNumber - Return the column # for the specified include position.
 /// this is significantly cheaper to compute than the line number.  This returns
diff --git a/clang/include/clang/Basic/SourceManager.h b/clang/include/clang/Basic/SourceManager.h
index 0daa1c0..c4f3eb2 100644
--- a/clang/include/clang/Basic/SourceManager.h
+++ b/clang/include/clang/Basic/SourceManager.h
@@ -189,10 +189,7 @@
   
   /// getIncludeLoc - Return the location of the #include for the specified
   /// FileID.
-  SourceLocation getIncludeLoc(unsigned FileID) const {
-    assert(FileID-1 < FileIDs.size() && "Invalid FileID!");
-    return FileIDs[FileID-1].IncludeLoc;
-  }
+  SourceLocation getIncludeLoc(unsigned FileID) const;
   
   /// getFilePos - This (efficient) method returns the offset from the start of
   /// the file that the specified SourceLocation represents.  This returns the