remove unneeded llvm:: namespace qualifiers on some core types now that LLVM.h imports
them into the clang namespace.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135852 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Basic/Builtins.cpp b/lib/Basic/Builtins.cpp
index 7df24a0..57b771a 100644
--- a/lib/Basic/Builtins.cpp
+++ b/lib/Basic/Builtins.cpp
@@ -59,7 +59,7 @@
 }
 
 void
-Builtin::Context::GetBuiltinNames(llvm::SmallVectorImpl<const char *> &Names,
+Builtin::Context::GetBuiltinNames(SmallVectorImpl<const char *> &Names,
                                   bool NoBuiltins) {
   // Final all target-independent names
   for (unsigned i = Builtin::NotBuiltin+1; i != Builtin::FirstTSBuiltin; ++i)
diff --git a/lib/Basic/Diagnostic.cpp b/lib/Basic/Diagnostic.cpp
index c12651a..48dad6f 100644
--- a/lib/Basic/Diagnostic.cpp
+++ b/lib/Basic/Diagnostic.cpp
@@ -25,9 +25,9 @@
                                const char *Argument, unsigned ArgLen,
                                const Diagnostic::ArgumentValue *PrevArgs,
                                unsigned NumPrevArgs,
-                               llvm::SmallVectorImpl<char> &Output,
+                               SmallVectorImpl<char> &Output,
                                void *Cookie,
-                               llvm::SmallVectorImpl<intptr_t> &QualTypeVals) {
+                               SmallVectorImpl<intptr_t> &QualTypeVals) {
   const char *Str = "<can't format argument>";
   Output.append(Str, Str+strlen(Str));
 }
@@ -112,8 +112,8 @@
   PushDiagStatePoint(&DiagStates.back(), SourceLocation());
 }
 
-void Diagnostic::SetDelayedDiagnostic(unsigned DiagID, llvm::StringRef Arg1,
-                                      llvm::StringRef Arg2) {
+void Diagnostic::SetDelayedDiagnostic(unsigned DiagID, StringRef Arg1,
+                                      StringRef Arg2) {
   if (DelayedDiagID)
     return;
 
@@ -339,7 +339,7 @@
 /// This is very useful for certain classes of variant diagnostics.
 static void HandleSelectModifier(const DiagnosticInfo &DInfo, unsigned ValNo,
                                  const char *Argument, unsigned ArgumentLen,
-                                 llvm::SmallVectorImpl<char> &OutStr) {
+                                 SmallVectorImpl<char> &OutStr) {
   const char *ArgumentEnd = Argument+ArgumentLen;
 
   // Skip over 'ValNo' |'s.
@@ -362,7 +362,7 @@
 /// letter 's' to the string if the value is not 1.  This is used in cases like
 /// this:  "you idiot, you have %4 parameter%s4!".
 static void HandleIntegerSModifier(unsigned ValNo,
-                                   llvm::SmallVectorImpl<char> &OutStr) {
+                                   SmallVectorImpl<char> &OutStr) {
   if (ValNo != 1)
     OutStr.push_back('s');
 }
@@ -372,7 +372,7 @@
 /// to the first ordinal.  Currently this is hard-coded to use the
 /// English form.
 static void HandleOrdinalModifier(unsigned ValNo,
-                                  llvm::SmallVectorImpl<char> &OutStr) {
+                                  SmallVectorImpl<char> &OutStr) {
   assert(ValNo != 0 && "ValNo must be strictly positive!");
 
   llvm::raw_svector_ostream Out(OutStr);
@@ -497,7 +497,7 @@
 /// {1:form0|%100=[10,20]:form2|%10=[2,4]:form1|:form2}
 static void HandlePluralModifier(const DiagnosticInfo &DInfo, unsigned ValNo,
                                  const char *Argument, unsigned ArgumentLen,
-                                 llvm::SmallVectorImpl<char> &OutStr) {
+                                 SmallVectorImpl<char> &OutStr) {
   const char *ArgumentEnd = Argument + ArgumentLen;
   while (1) {
     assert(Argument < ArgumentEnd && "Plural expression didn't match.");
@@ -524,13 +524,13 @@
 /// formal arguments into the %0 slots.  The result is appended onto the Str
 /// array.
 void DiagnosticInfo::
-FormatDiagnostic(llvm::SmallVectorImpl<char> &OutStr) const {
+FormatDiagnostic(SmallVectorImpl<char> &OutStr) const {
   if (!StoredDiagMessage.empty()) {
     OutStr.append(StoredDiagMessage.begin(), StoredDiagMessage.end());
     return;
   }
 
-  llvm::StringRef Diag = 
+  StringRef Diag = 
     getDiags()->getDiagnosticIDs()->getDescription(getID());
 
   FormatDiagnostic(Diag.begin(), Diag.end(), OutStr);
@@ -538,17 +538,17 @@
 
 void DiagnosticInfo::
 FormatDiagnostic(const char *DiagStr, const char *DiagEnd,
-                 llvm::SmallVectorImpl<char> &OutStr) const {
+                 SmallVectorImpl<char> &OutStr) const {
 
   /// FormattedArgs - Keep track of all of the arguments formatted by
   /// ConvertArgToString and pass them into subsequent calls to
   /// ConvertArgToString, allowing the implementation to avoid redundancies in
   /// obvious cases.
-  llvm::SmallVector<Diagnostic::ArgumentValue, 8> FormattedArgs;
+  SmallVector<Diagnostic::ArgumentValue, 8> FormattedArgs;
 
   /// QualTypeVals - Pass a vector of arrays so that QualType names can be
   /// compared to see if more information is needed to be printed.
-  llvm::SmallVector<intptr_t, 2> QualTypeVals;
+  SmallVector<intptr_t, 2> QualTypeVals;
   for (unsigned i = 0, e = getNumArgs(); i < e; ++i)
     if (getArgKind(i) == Diagnostic::ak_qualtype)
       QualTypeVals.push_back(getRawArg(i));
@@ -702,7 +702,7 @@
 StoredDiagnostic::StoredDiagnostic() { }
 
 StoredDiagnostic::StoredDiagnostic(Diagnostic::Level Level, unsigned ID,
-                                   llvm::StringRef Message)
+                                   StringRef Message)
   : ID(ID), Level(Level), Loc(), Message(Message) { }
 
 StoredDiagnostic::StoredDiagnostic(Diagnostic::Level Level, 
@@ -727,7 +727,7 @@
 }
 
 StoredDiagnostic::StoredDiagnostic(Diagnostic::Level Level, unsigned ID, 
-                                   llvm::StringRef Message, FullSourceLoc Loc,
+                                   StringRef Message, FullSourceLoc Loc,
                                    llvm::ArrayRef<CharSourceRange> Ranges,
                                    llvm::ArrayRef<FixItHint> Fixits)
   : ID(ID), Level(Level), Loc(Loc), Message(Message) 
diff --git a/lib/Basic/DiagnosticIDs.cpp b/lib/Basic/DiagnosticIDs.cpp
index 147ba7e..19f627e 100644
--- a/lib/Basic/DiagnosticIDs.cpp
+++ b/lib/Basic/DiagnosticIDs.cpp
@@ -61,21 +61,21 @@
   const char *BriefExplanationStr;
   const char *FullExplanationStr;
 
-  llvm::StringRef getName() const {
-    return llvm::StringRef(NameStr, NameLen);
+  StringRef getName() const {
+    return StringRef(NameStr, NameLen);
   }
-  llvm::StringRef getOptionGroup() const {
-    return llvm::StringRef(OptionGroupStr, OptionGroupLen);
+  StringRef getOptionGroup() const {
+    return StringRef(OptionGroupStr, OptionGroupLen);
   }
 
-  llvm::StringRef getDescription() const {
-    return llvm::StringRef(DescriptionStr, DescriptionLen);
+  StringRef getDescription() const {
+    return StringRef(DescriptionStr, DescriptionLen);
   }
-  llvm::StringRef getBriefExplanation() const {
-    return llvm::StringRef(BriefExplanationStr, BriefExplanationLen);
+  StringRef getBriefExplanation() const {
+    return StringRef(BriefExplanationStr, BriefExplanationLen);
   }
-  llvm::StringRef getFullExplanation() const {
-    return llvm::StringRef(FullExplanationStr, FullExplanationLen);
+  StringRef getFullExplanation() const {
+    return StringRef(FullExplanationStr, FullExplanationLen);
   }
 
   bool operator<(const StaticDiagInfoRec &RHS) const {
@@ -88,8 +88,8 @@
   unsigned short DiagID;
   uint8_t NameLen;
 
-  llvm::StringRef getName() const {
-    return llvm::StringRef(NameStr, NameLen);
+  StringRef getName() const {
+    return StringRef(NameStr, NameLen);
   }
 
   bool operator<(const StaticDiagNameIndexRec &RHS) const {
@@ -186,10 +186,10 @@
 /// getWarningOptionForDiag - Return the lowest-level warning option that
 /// enables the specified diagnostic.  If there is no -Wfoo flag that controls
 /// the diagnostic, this returns null.
-llvm::StringRef DiagnosticIDs::getWarningOptionForDiag(unsigned DiagID) {
+StringRef DiagnosticIDs::getWarningOptionForDiag(unsigned DiagID) {
   if (const StaticDiagInfoRec *Info = GetDiagInfo(DiagID))
     return Info->getOptionGroup();
-  return llvm::StringRef();
+  return StringRef();
 }
 
 /// getCategoryNumberForDiag - Return the category number that a specified
@@ -206,8 +206,8 @@
     const char *NameStr;
     uint8_t NameLen;
 
-    llvm::StringRef getName() const {
-      return llvm::StringRef(NameStr, NameLen);
+    StringRef getName() const {
+      return StringRef(NameStr, NameLen);
     }
   };
 }
@@ -228,9 +228,9 @@
 /// getCategoryNameFromID - Given a category ID, return the name of the
 /// category, an empty string if CategoryID is zero, or null if CategoryID is
 /// invalid.
-llvm::StringRef DiagnosticIDs::getCategoryNameFromID(unsigned CategoryID) {
+StringRef DiagnosticIDs::getCategoryNameFromID(unsigned CategoryID) {
   if (CategoryID >= getNumberOfCategories())
-   return llvm::StringRef();
+   return StringRef();
   return CategoryNameTable[CategoryID].getName();
 }
 
@@ -256,14 +256,14 @@
 }
 
 /// getName - Given a diagnostic ID, return its name
-llvm::StringRef DiagnosticIDs::getName(unsigned DiagID) {
+StringRef DiagnosticIDs::getName(unsigned DiagID) {
   if (const StaticDiagInfoRec *Info = GetDiagInfo(DiagID))
     return Info->getName();
-  return llvm::StringRef();
+  return StringRef();
 }
 
 /// getIdFromName - Given a diagnostic name, return its ID, or 0
-unsigned DiagnosticIDs::getIdFromName(llvm::StringRef Name) {
+unsigned DiagnosticIDs::getIdFromName(StringRef Name) {
   const StaticDiagNameIndexRec *StaticDiagNameIndexEnd =
     StaticDiagNameIndex + StaticDiagNameIndexSize;
   
@@ -282,18 +282,18 @@
 
 /// getBriefExplanation - Given a diagnostic ID, return a brief explanation
 /// of the issue
-llvm::StringRef DiagnosticIDs::getBriefExplanation(unsigned DiagID) {
+StringRef DiagnosticIDs::getBriefExplanation(unsigned DiagID) {
   if (const StaticDiagInfoRec *Info = GetDiagInfo(DiagID))
     return Info->getBriefExplanation();
-  return llvm::StringRef();
+  return StringRef();
 }
 
 /// getFullExplanation - Given a diagnostic ID, return a full explanation
 /// of the issue
-llvm::StringRef DiagnosticIDs::getFullExplanation(unsigned DiagID) {
+StringRef DiagnosticIDs::getFullExplanation(unsigned DiagID) {
   if (const StaticDiagInfoRec *Info = GetDiagInfo(DiagID))
     return Info->getFullExplanation();
-  return llvm::StringRef();
+  return StringRef();
 }
 
 /// getBuiltinDiagClass - Return the class field of the diagnostic.
@@ -318,7 +318,7 @@
 
       /// getDescription - Return the description of the specified custom
       /// diagnostic.
-      llvm::StringRef getDescription(unsigned DiagID) const {
+      StringRef getDescription(unsigned DiagID) const {
         assert(this && DiagID-DIAG_UPPER_LIMIT < DiagInfo.size() &&
                "Invalid diagnosic ID");
         return DiagInfo[DiagID-DIAG_UPPER_LIMIT].second;
@@ -331,7 +331,7 @@
         return DiagInfo[DiagID-DIAG_UPPER_LIMIT].first;
       }
 
-      unsigned getOrCreateDiagID(DiagnosticIDs::Level L, llvm::StringRef Message,
+      unsigned getOrCreateDiagID(DiagnosticIDs::Level L, StringRef Message,
                                  DiagnosticIDs &Diags) {
         DiagDesc D(L, Message);
         // Check to see if it already exists.
@@ -366,7 +366,7 @@
 /// getCustomDiagID - Return an ID for a diagnostic with the specified message
 /// and level.  If this is the first request for this diagnosic, it is
 /// registered and created, otherwise the existing ID is returned.
-unsigned DiagnosticIDs::getCustomDiagID(Level L, llvm::StringRef Message) {
+unsigned DiagnosticIDs::getCustomDiagID(Level L, StringRef Message) {
   if (CustomDiagInfo == 0)
     CustomDiagInfo = new diag::CustomDiagInfo();
   return CustomDiagInfo->getOrCreateDiagID(L, Message, *this);
@@ -406,7 +406,7 @@
 
 /// getDescription - Given a diagnostic ID, return a description of the
 /// issue.
-llvm::StringRef DiagnosticIDs::getDescription(unsigned DiagID) const {
+StringRef DiagnosticIDs::getDescription(unsigned DiagID) const {
   if (const StaticDiagInfoRec *Info = GetDiagInfo(DiagID))
     return Info->getDescription();
   return CustomDiagInfo->getDescription(DiagID);
@@ -556,8 +556,8 @@
     const short *Members;
     const short *SubGroups;
 
-    llvm::StringRef getName() const {
-      return llvm::StringRef(NameStr, NameLen);
+    StringRef getName() const {
+      return StringRef(NameStr, NameLen);
     }
   };
 }
@@ -598,7 +598,7 @@
 /// setDiagnosticGroupMapping - Change an entire diagnostic group (e.g.
 /// "unknown-pragmas" to have the specified mapping.  This returns true and
 /// ignores the request if "Group" was unknown, false otherwise.
-bool DiagnosticIDs::setDiagnosticGroupMapping(llvm::StringRef Group,
+bool DiagnosticIDs::setDiagnosticGroupMapping(StringRef Group,
                                               diag::Mapping Map,
                                               SourceLocation Loc,
                                               Diagnostic &Diag) const {
diff --git a/lib/Basic/FileManager.cpp b/lib/Basic/FileManager.cpp
index f747c53..4ac8e4d 100644
--- a/lib/Basic/FileManager.cpp
+++ b/lib/Basic/FileManager.cpp
@@ -217,14 +217,14 @@
 /// \brief Retrieve the directory that the given file name resides in.
 /// Filename can point to either a real file or a virtual file.
 static const DirectoryEntry *getDirectoryFromFile(FileManager &FileMgr,
-                                                  llvm::StringRef Filename) {
+                                                  StringRef Filename) {
   if (Filename.empty())
     return NULL;
 
   if (llvm::sys::path::is_separator(Filename[Filename.size() - 1]))
     return NULL;  // If Filename is a directory.
 
-  llvm::StringRef DirName = llvm::sys::path::parent_path(Filename);
+  StringRef DirName = llvm::sys::path::parent_path(Filename);
   // Use the current directory if file has no path component.
   if (DirName.empty())
     DirName = ".";
@@ -234,8 +234,8 @@
 
 /// Add all ancestors of the given path (pointing to either a file or
 /// a directory) as virtual directories.
-void FileManager::addAncestorsAsVirtualDirs(llvm::StringRef Path) {
-  llvm::StringRef DirName = llvm::sys::path::parent_path(Path);
+void FileManager::addAncestorsAsVirtualDirs(StringRef Path) {
+  StringRef DirName = llvm::sys::path::parent_path(Path);
   if (DirName.empty())
     return;
 
@@ -263,7 +263,7 @@
 /// (real or virtual).  This returns NULL if the directory doesn't
 /// exist.
 ///
-const DirectoryEntry *FileManager::getDirectory(llvm::StringRef DirName) {
+const DirectoryEntry *FileManager::getDirectory(StringRef DirName) {
   ++NumDirLookups;
   llvm::StringMapEntry<DirectoryEntry *> &NamedDirEnt =
     SeenDirEntries.GetOrCreateValue(DirName);
@@ -309,7 +309,7 @@
 /// getFile - Lookup, cache, and verify the specified file (real or
 /// virtual).  This returns NULL if the file doesn't exist.
 ///
-const FileEntry *FileManager::getFile(llvm::StringRef Filename, bool openFile) {
+const FileEntry *FileManager::getFile(StringRef Filename, bool openFile) {
   ++NumFileLookups;
 
   // See if there is already an entry in the map.
@@ -381,7 +381,7 @@
 }
 
 const FileEntry *
-FileManager::getVirtualFile(llvm::StringRef Filename, off_t Size,
+FileManager::getVirtualFile(StringRef Filename, off_t Size,
                             time_t ModificationTime) {
   ++NumFileLookups;
 
@@ -451,8 +451,8 @@
   return UFE;
 }
 
-void FileManager::FixupRelativePath(llvm::SmallVectorImpl<char> &path) const {
-  llvm::StringRef pathRef(path.data(), path.size());
+void FileManager::FixupRelativePath(SmallVectorImpl<char> &path) const {
+  StringRef pathRef(path.data(), path.size());
 
   if (FileSystemOpts.WorkingDir.empty() 
       || llvm::sys::path::is_absolute(pathRef))
@@ -499,7 +499,7 @@
 }
 
 llvm::MemoryBuffer *FileManager::
-getBufferForFile(llvm::StringRef Filename, std::string *ErrorStr) {
+getBufferForFile(StringRef Filename, std::string *ErrorStr) {
   llvm::OwningPtr<llvm::MemoryBuffer> Result;
   llvm::error_code ec;
   if (FileSystemOpts.WorkingDir.empty()) {
@@ -537,7 +537,7 @@
                                   StatCache.get());
 }
 
-bool FileManager::getNoncachedStatValue(llvm::StringRef Path, 
+bool FileManager::getNoncachedStatValue(StringRef Path, 
                                         struct stat &StatBuf) {
   llvm::SmallString<128> FilePath(Path);
   FixupRelativePath(FilePath);
@@ -546,7 +546,7 @@
 }
 
 void FileManager::GetUniqueIDMapping(
-                   llvm::SmallVectorImpl<const FileEntry *> &UIDToFiles) const {
+                   SmallVectorImpl<const FileEntry *> &UIDToFiles) const {
   UIDToFiles.clear();
   UIDToFiles.resize(NextFileUID);
   
@@ -558,7 +558,7 @@
       UIDToFiles[FE->getValue()->getUID()] = FE->getValue();
   
   // Map virtual file entries
-  for (llvm::SmallVector<FileEntry*, 4>::const_iterator 
+  for (SmallVector<FileEntry*, 4>::const_iterator 
          VFE = VirtualFileEntries.begin(), VFEEnd = VirtualFileEntries.end();
        VFE != VFEEnd; ++VFE)
     if (*VFE && *VFE != NON_EXISTENT_FILE)
diff --git a/lib/Basic/IdentifierTable.cpp b/lib/Basic/IdentifierTable.cpp
index 188e2d4..edf2e99 100644
--- a/lib/Basic/IdentifierTable.cpp
+++ b/lib/Basic/IdentifierTable.cpp
@@ -55,7 +55,7 @@
   class EmptyLookupIterator : public IdentifierIterator
   {
   public:
-    virtual llvm::StringRef Next() { return llvm::StringRef(); }
+    virtual StringRef Next() { return StringRef(); }
   };
 }
 
@@ -106,7 +106,7 @@
 /// enabled in the specified langauge, set to 1 if it is an extension
 /// in the specified language, and set to 0 if disabled in the
 /// specified language.
-static void AddKeyword(llvm::StringRef Keyword,
+static void AddKeyword(StringRef Keyword,
                        tok::TokenKind TokenCode, unsigned Flags,
                        const LangOptions &LangOpts, IdentifierTable &Table) {
   unsigned AddResult = 0;
@@ -133,7 +133,7 @@
 
 /// AddCXXOperatorKeyword - Register a C++ operator keyword alternative
 /// representations.
-static void AddCXXOperatorKeyword(llvm::StringRef Keyword,
+static void AddCXXOperatorKeyword(StringRef Keyword,
                                   tok::TokenKind TokenCode,
                                   IdentifierTable &Table) {
   IdentifierInfo &Info = Table.get(Keyword, TokenCode);
@@ -142,7 +142,7 @@
 
 /// AddObjCKeyword - Register an Objective-C @keyword like "class" "selector" or
 /// "property".
-static void AddObjCKeyword(llvm::StringRef Name,
+static void AddObjCKeyword(StringRef Name,
                            tok::ObjCKeywordKind ObjCID,
                            IdentifierTable &Table) {
   Table.get(Name).setObjCKeywordID(ObjCID);
@@ -153,20 +153,20 @@
 void IdentifierTable::AddKeywords(const LangOptions &LangOpts) {
   // Add keywords and tokens for the current language.
 #define KEYWORD(NAME, FLAGS) \
-  AddKeyword(llvm::StringRef(#NAME), tok::kw_ ## NAME,  \
+  AddKeyword(StringRef(#NAME), tok::kw_ ## NAME,  \
              FLAGS, LangOpts, *this);
 #define ALIAS(NAME, TOK, FLAGS) \
-  AddKeyword(llvm::StringRef(NAME), tok::kw_ ## TOK,  \
+  AddKeyword(StringRef(NAME), tok::kw_ ## TOK,  \
              FLAGS, LangOpts, *this);
 #define CXX_KEYWORD_OPERATOR(NAME, ALIAS) \
   if (LangOpts.CXXOperatorNames)          \
-    AddCXXOperatorKeyword(llvm::StringRef(#NAME), tok::ALIAS, *this);
+    AddCXXOperatorKeyword(StringRef(#NAME), tok::ALIAS, *this);
 #define OBJC1_AT_KEYWORD(NAME) \
   if (LangOpts.ObjC1)          \
-    AddObjCKeyword(llvm::StringRef(#NAME), tok::objc_##NAME, *this);
+    AddObjCKeyword(StringRef(#NAME), tok::objc_##NAME, *this);
 #define OBJC2_AT_KEYWORD(NAME) \
   if (LangOpts.ObjC2)          \
-    AddObjCKeyword(llvm::StringRef(#NAME), tok::objc_##NAME, *this);
+    AddObjCKeyword(StringRef(#NAME), tok::objc_##NAME, *this);
 #define TESTING_KEYWORD(NAME, FLAGS)
 #include "clang/Basic/TokenKinds.def"
 
@@ -336,9 +336,9 @@
   return SI->getIdentifierInfoForSlot(argIndex);
 }
 
-llvm::StringRef Selector::getNameForSlot(unsigned int argIndex) const {
+StringRef Selector::getNameForSlot(unsigned int argIndex) const {
   IdentifierInfo *II = getIdentifierInfoForSlot(argIndex);
-  return II? II->getName() : llvm::StringRef();
+  return II? II->getName() : StringRef();
 }
 
 std::string MultiKeywordSelector::getName() const {
@@ -377,7 +377,7 @@
 /// Interpreting the given string using the normal CamelCase
 /// conventions, determine whether the given string starts with the
 /// given "word", which is assumed to end in a lowercase letter.
-static bool startsWithWord(llvm::StringRef name, llvm::StringRef word) {
+static bool startsWithWord(StringRef name, StringRef word) {
   if (name.size() < word.size()) return false;
   return ((name.size() == word.size() ||
            !islower(name[word.size()]))
@@ -388,7 +388,7 @@
   IdentifierInfo *first = sel.getIdentifierInfoForSlot(0);
   if (!first) return OMF_None;
 
-  llvm::StringRef name = first->getName();
+  StringRef name = first->getName();
   if (sel.isUnarySelector()) {
     if (name == "autorelease") return OMF_autorelease;
     if (name == "dealloc") return OMF_dealloc;
diff --git a/lib/Basic/SourceLocation.cpp b/lib/Basic/SourceLocation.cpp
index 5062d43..cf89edb 100644
--- a/lib/Basic/SourceLocation.cpp
+++ b/lib/Basic/SourceLocation.cpp
@@ -23,7 +23,7 @@
 // PrettyStackTraceLoc
 //===----------------------------------------------------------------------===//
 
-void PrettyStackTraceLoc::print(llvm::raw_ostream &OS) const {
+void PrettyStackTraceLoc::print(raw_ostream &OS) const {
   if (Loc.isValid()) {
     Loc.print(OS, SM);
     OS << ": ";
@@ -35,7 +35,7 @@
 // SourceLocation
 //===----------------------------------------------------------------------===//
 
-void SourceLocation::print(llvm::raw_ostream &OS, const SourceManager &SM)const{
+void SourceLocation::print(raw_ostream &OS, const SourceManager &SM)const{
   if (!isValid()) {
     OS << "<invalid loc>";
     return;
@@ -125,7 +125,7 @@
   return SrcMgr->getBuffer(SrcMgr->getFileID(*this), Invalid);
 }
 
-llvm::StringRef FullSourceLoc::getBufferData(bool *Invalid) const {
+StringRef FullSourceLoc::getBufferData(bool *Invalid) const {
   return getBuffer(Invalid)->getBuffer();
 }
 
diff --git a/lib/Basic/SourceManager.cpp b/lib/Basic/SourceManager.cpp
index ee13f62..cbac7ff 100644
--- a/lib/Basic/SourceManager.cpp
+++ b/lib/Basic/SourceManager.cpp
@@ -105,7 +105,7 @@
   // that we are in an inconsistent situation and error out as quickly as
   // possible.
   if (!Buffer.getPointer()) {
-    const llvm::StringRef FillStr("<<<MISSING SOURCE FILE>>>\n");
+    const StringRef FillStr("<<<MISSING SOURCE FILE>>>\n");
     Buffer.setPointer(MemoryBuffer::getNewMemBuffer(ContentsEntry->getSize(), 
                                                     "<invalid>"));
     char *Ptr = const_cast<char*>(Buffer.getPointer()->getBufferStart());
@@ -143,7 +143,7 @@
   // If the buffer is valid, check to see if it has a UTF Byte Order Mark
   // (BOM).  We only support UTF-8 with and without a BOM right now.  See
   // http://en.wikipedia.org/wiki/Byte_order_mark for more information.
-  llvm::StringRef BufStr = Buffer.getPointer()->getBuffer();
+  StringRef BufStr = Buffer.getPointer()->getBuffer();
   const char *InvalidBOM = llvm::StringSwitch<const char *>(BufStr)
     .StartsWith("\xFE\xFF", "UTF-16 (BE)")
     .StartsWith("\xFF\xFE", "UTF-16 (LE)")
@@ -169,7 +169,7 @@
   return Buffer.getPointer();
 }
 
-unsigned LineTableInfo::getLineTableFilenameID(llvm::StringRef Name) {
+unsigned LineTableInfo::getLineTableFilenameID(StringRef Name) {
   // Look up the filename in the string table, returning the pre-existing value
   // if it exists.
   llvm::StringMapEntry<unsigned> &Entry =
@@ -277,7 +277,7 @@
 
 /// getLineTableFilenameID - Return the uniqued ID for the specified filename.
 ///
-unsigned SourceManager::getLineTableFilenameID(llvm::StringRef Name) {
+unsigned SourceManager::getLineTableFilenameID(StringRef Name) {
   if (LineTable == 0)
     LineTable = new LineTableInfo();
   return LineTable->getLineTableFilenameID(Name);
@@ -588,7 +588,7 @@
   OverriddenFiles[SourceFile] = NewFile;
 }
 
-llvm::StringRef SourceManager::getBufferData(FileID FID, bool *Invalid) const {
+StringRef SourceManager::getBufferData(FileID FID, bool *Invalid) const {
   bool MyInvalid = false;
   const SLocEntry &SLoc = getSLocEntry(FID, &MyInvalid);
   if (!SLoc.isFile() || MyInvalid) {
@@ -986,7 +986,7 @@
 
   // Find the file offsets of all of the *physical* source lines.  This does
   // not look at trigraphs, escaped newlines, or anything else tricky.
-  llvm::SmallVector<unsigned, 256> LineOffsets;
+  SmallVector<unsigned, 256> LineOffsets;
 
   // Line #1 starts at char 0.
   LineOffsets.push_back(0);
@@ -1316,7 +1316,7 @@
   // First, check the main file ID, since it is common to look for a
   // location in the main file.
   llvm::Optional<ino_t> SourceFileInode;
-  llvm::Optional<llvm::StringRef> SourceFileName;
+  llvm::Optional<StringRef> SourceFileName;
   if (!MainFileID.isInvalid()) {
     bool Invalid = false;
     const SLocEntry &MainSLoc = getSLocEntry(MainFileID, &Invalid);
diff --git a/lib/Basic/TargetInfo.cpp b/lib/Basic/TargetInfo.cpp
index 30a9bdb..7ea5146 100644
--- a/lib/Basic/TargetInfo.cpp
+++ b/lib/Basic/TargetInfo.cpp
@@ -174,7 +174,7 @@
 //===----------------------------------------------------------------------===//
 
 
-static llvm::StringRef removeGCCRegisterPrefix(llvm::StringRef Name) {
+static StringRef removeGCCRegisterPrefix(StringRef Name) {
   if (Name[0] == '%' || Name[0] == '#')
     Name = Name.substr(1);
 
@@ -184,7 +184,7 @@
 /// isValidClobber - Returns whether the passed in string is
 /// a valid clobber in an inline asm statement. This is used by
 /// Sema.
-bool TargetInfo::isValidClobber(llvm::StringRef Name) const {
+bool TargetInfo::isValidClobber(StringRef Name) const {
   return (isValidGCCRegisterName(Name) ||
 	  Name == "memory" || Name == "cc");
 }
@@ -192,7 +192,7 @@
 /// isValidGCCRegisterName - Returns whether the passed in string
 /// is a valid register name according to GCC. This is used by Sema for
 /// inline asm statements.
-bool TargetInfo::isValidGCCRegisterName(llvm::StringRef Name) const {
+bool TargetInfo::isValidGCCRegisterName(StringRef Name) const {
   if (Name.empty())
     return false;
 
@@ -248,8 +248,8 @@
   return false;
 }
 
-llvm::StringRef
-TargetInfo::getNormalizedGCCRegisterName(llvm::StringRef Name) const {
+StringRef
+TargetInfo::getNormalizedGCCRegisterName(StringRef Name) const {
   assert(isValidGCCRegisterName(Name) && "Invalid register passed in");
 
   // Get rid of any register prefix.
diff --git a/lib/Basic/Targets.cpp b/lib/Basic/Targets.cpp
index 0414d19..3aebc41 100644
--- a/lib/Basic/Targets.cpp
+++ b/lib/Basic/Targets.cpp
@@ -37,7 +37,7 @@
 /// DefineStd - Define a macro name and standard variants.  For example if
 /// MacroName is "unix", then this will define "__unix", "__unix__", and "unix"
 /// when in GNU mode.
-static void DefineStd(MacroBuilder &Builder, llvm::StringRef MacroName,
+static void DefineStd(MacroBuilder &Builder, StringRef MacroName,
                       const LangOptions &Opts) {
   assert(MacroName[0] != '_' && "Identifier should be in the user's namespace");
 
@@ -77,7 +77,7 @@
 
 static void getDarwinDefines(MacroBuilder &Builder, const LangOptions &Opts,
                              const llvm::Triple &Triple,
-                             llvm::StringRef &PlatformName,
+                             StringRef &PlatformName,
                              VersionTuple &PlatformMinVersion) {
   Builder.defineMacro("__APPLE_CC__", "5621");
   Builder.defineMacro("__APPLE__");
@@ -202,9 +202,9 @@
       this->MCountName = "\01mcount";
     }
 
-  virtual std::string isValidSectionSpecifier(llvm::StringRef SR) const {
+  virtual std::string isValidSectionSpecifier(StringRef SR) const {
     // Let MCSectionMachO validate this.
-    llvm::StringRef Segment, Section;
+    StringRef Segment, Section;
     unsigned TAA, StubSize;
     bool HasTAA;
     return llvm::MCSectionMachO::ParseSectionSpecifier(SR, Segment, Section,
@@ -247,7 +247,7 @@
     // FreeBSD defines; list based off of gcc output
 
     // FIXME: Move version number handling to llvm::Triple.
-    llvm::StringRef Release = Triple.getOSName().substr(strlen("freebsd"), 1);
+    StringRef Release = Triple.getOSName().substr(strlen("freebsd"), 1);
 
     Builder.defineMacro("__FreeBSD__", Release);
     Builder.defineMacro("__FreeBSD_cc_version", Release + "00001");
@@ -503,7 +503,7 @@
       Builder.defineMacro("_MT");
 
     if (Opts.MSCVersion != 0)
-      Builder.defineMacro("_MSC_VER", llvm::Twine(Opts.MSCVersion));
+      Builder.defineMacro("_MSC_VER", Twine(Opts.MSCVersion));
 
     if (Opts.Microsoft) {
       Builder.defineMacro("_MSC_EXTENSIONS");
@@ -1429,13 +1429,13 @@
     case SSSE3:
     case SSE3:
     case SSE2:
-      Builder.defineMacro("_M_IX86_FP", llvm::Twine(2));
+      Builder.defineMacro("_M_IX86_FP", Twine(2));
       break;
     case SSE1:
-      Builder.defineMacro("_M_IX86_FP", llvm::Twine(1));
+      Builder.defineMacro("_M_IX86_FP", Twine(1));
       break;
     default:
-      Builder.defineMacro("_M_IX86_FP", llvm::Twine(0));
+      Builder.defineMacro("_M_IX86_FP", Twine(0));
     }
   }
 
@@ -1706,7 +1706,7 @@
     // RTEMS defines; list based off of gcc output
 
     // FIXME: Move version number handling to llvm::Triple.
-    llvm::StringRef Release = Triple.getOSName().substr(strlen("rtems"), 1);
+    StringRef Release = Triple.getOSName().substr(strlen("rtems"), 1);
 
     Builder.defineMacro("__rtems__");
     Builder.defineMacro("__ELF__");
@@ -2035,7 +2035,7 @@
       Features.erase(it);
   }
 
-  static const char *getCPUDefineSuffix(llvm::StringRef Name) {
+  static const char *getCPUDefineSuffix(StringRef Name) {
     return llvm::StringSwitch<const char*>(Name)
       .Cases("arm8", "arm810", "4")
       .Cases("strongarm", "strongarm110", "strongarm1100", "strongarm1110", "4")
@@ -2074,7 +2074,7 @@
     Builder.defineMacro("__LITTLE_ENDIAN__");
     Builder.defineMacro("__REGISTER_PREFIX__", "");
 
-    llvm::StringRef CPUArch = getCPUDefineSuffix(CPU);
+    StringRef CPUArch = getCPUDefineSuffix(CPU);
     Builder.defineMacro("__ARM_ARCH_" + CPUArch + "__");
 
     // Subtarget options.
diff --git a/lib/Basic/Version.cpp b/lib/Basic/Version.cpp
index 86d4aa5..10b9364 100644
--- a/lib/Basic/Version.cpp
+++ b/lib/Basic/Version.cpp
@@ -12,6 +12,7 @@
 //===----------------------------------------------------------------------===//
 
 #include "clang/Basic/Version.h"
+#include "clang/Basic/LLVM.h"
 #include "llvm/Support/raw_ostream.h"
 #include "llvm/Config/config.h"
 #include <cstring>
@@ -24,14 +25,14 @@
   return CLANG_REPOSITORY_STRING;
 #else
 #ifdef SVN_REPOSITORY
-  llvm::StringRef URL(SVN_REPOSITORY);
+  StringRef URL(SVN_REPOSITORY);
 #else
-  llvm::StringRef URL("");
+  StringRef URL("");
 #endif
 
   // If the SVN_REPOSITORY is empty, try to use the SVN keyword. This helps us
   // pick up a tag in an SVN export, for example.
-  static llvm::StringRef SVNRepository("$URL$");
+  static StringRef SVNRepository("$URL$");
   if (URL.empty()) {
     URL = SVNRepository.slice(SVNRepository.find(':'),
                               SVNRepository.find("/lib/Basic"));
@@ -42,7 +43,7 @@
 
   // Trim path prefix off, assuming path came from standard cfe path.
   size_t Start = URL.find("cfe/");
-  if (Start != llvm::StringRef::npos)
+  if (Start != StringRef::npos)
     URL = URL.substr(Start + 4);
 
   return URL;
diff --git a/lib/Basic/VersionTuple.cpp b/lib/Basic/VersionTuple.cpp
index d5cf126..77aad39 100644
--- a/lib/Basic/VersionTuple.cpp
+++ b/lib/Basic/VersionTuple.cpp
@@ -25,7 +25,7 @@
   return Result;
 }
 
-llvm::raw_ostream& clang::operator<<(llvm::raw_ostream &Out, 
+raw_ostream& clang::operator<<(raw_ostream &Out, 
                                      const VersionTuple &V) {
   Out << V.getMajor();
   if (llvm::Optional<unsigned> Minor = V.getMinor())