diff options
author | Chris Lattner <sabre@nondot.org> | 2011-07-23 10:55:15 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2011-07-23 10:55:15 +0000 |
commit | 5f9e272e632e951b1efe824cd16acb4d96077930 (patch) | |
tree | 3268557d12b85d0c2e72de5329ec83d4fc0bca48 /lib/Basic | |
parent | d47d3b0cfeb7e8564ff77f48130fe63282b6d127 (diff) |
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
Diffstat (limited to 'lib/Basic')
-rw-r--r-- | lib/Basic/Builtins.cpp | 2 | ||||
-rw-r--r-- | lib/Basic/Diagnostic.cpp | 30 | ||||
-rw-r--r-- | lib/Basic/DiagnosticIDs.cpp | 64 | ||||
-rw-r--r-- | lib/Basic/FileManager.cpp | 26 | ||||
-rw-r--r-- | lib/Basic/IdentifierTable.cpp | 26 | ||||
-rw-r--r-- | lib/Basic/SourceLocation.cpp | 6 | ||||
-rw-r--r-- | lib/Basic/SourceManager.cpp | 14 | ||||
-rw-r--r-- | lib/Basic/TargetInfo.cpp | 10 | ||||
-rw-r--r-- | lib/Basic/Targets.cpp | 24 | ||||
-rw-r--r-- | lib/Basic/Version.cpp | 9 | ||||
-rw-r--r-- | lib/Basic/VersionTuple.cpp | 2 |
11 files changed, 107 insertions, 106 deletions
diff --git a/lib/Basic/Builtins.cpp b/lib/Basic/Builtins.cpp index 7df24a03b0..57b771ab5b 100644 --- a/lib/Basic/Builtins.cpp +++ b/lib/Basic/Builtins.cpp @@ -59,7 +59,7 @@ void Builtin::Context::InitializeBuiltins(IdentifierTable &Table, } 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 c12651a3f9..48dad6f2e0 100644 --- a/lib/Basic/Diagnostic.cpp +++ b/lib/Basic/Diagnostic.cpp @@ -25,9 +25,9 @@ static void DummyArgToStringFn(Diagnostic::ArgumentKind AK, intptr_t QT, 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 @@ void Diagnostic::Reset() { 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 @@ static const char *ScanFormat(const char *I, const char *E, char Target) { /// 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 @@ static void HandleSelectModifier(const DiagnosticInfo &DInfo, unsigned ValNo, /// 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 @@ static void HandleIntegerSModifier(unsigned ValNo, /// 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 @@ static bool EvalPluralExpr(unsigned ValNo, const char *Start, const char *End) { /// {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 @@ static void HandlePluralModifier(const DiagnosticInfo &DInfo, unsigned ValNo, /// 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 @@ FormatDiagnostic(llvm::SmallVectorImpl<char> &OutStr) const { 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 @@ FormatDiagnostic(const char *DiagStr, const char *DiagEnd, 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, } 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 147ba7e99e..19f627e804 100644 --- a/lib/Basic/DiagnosticIDs.cpp +++ b/lib/Basic/DiagnosticIDs.cpp @@ -61,21 +61,21 @@ struct StaticDiagInfoRec { 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 @@ struct StaticDiagNameIndexRec { 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 @@ static unsigned GetDefaultDiagMapping(unsigned DiagID) { /// 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 @@ namespace { 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 @@ unsigned DiagnosticIDs::getNumberOfCategories() { /// 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 @@ DiagnosticIDs::getDiagnosticSFINAEResponse(unsigned DiagID) { } /// 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 @@ unsigned DiagnosticIDs::getIdFromName(llvm::StringRef Name) { /// 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 @@ namespace clang { /// 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 @@ namespace clang { 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 @@ DiagnosticIDs::~DiagnosticIDs() { /// 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 @@ bool DiagnosticIDs::isBuiltinExtensionDiag(unsigned DiagID, /// 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 @@ namespace { 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 @@ static void MapGroupMembers(const WarningOption *Group, diag::Mapping Mapping, /// 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 f747c534c0..4ac8e4da1d 100644 --- a/lib/Basic/FileManager.cpp +++ b/lib/Basic/FileManager.cpp @@ -217,14 +217,14 @@ void FileManager::removeStatCache(FileSystemStatCache *statCache) { /// \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 @@ static const DirectoryEntry *getDirectoryFromFile(FileManager &FileMgr, /// 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 @@ void FileManager::addAncestorsAsVirtualDirs(llvm::StringRef Path) { /// (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 @@ const DirectoryEntry *FileManager::getDirectory(llvm::StringRef DirName) { /// 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::getFile(llvm::StringRef Filename, bool openFile) { } 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 @@ FileManager::getVirtualFile(llvm::StringRef Filename, off_t Size, 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 @@ getBufferForFile(const FileEntry *Entry, std::string *ErrorStr) { } 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 @@ bool FileManager::getStatValue(const char *Path, struct stat &StatBuf, 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 @@ bool FileManager::getNoncachedStatValue(llvm::StringRef Path, } void FileManager::GetUniqueIDMapping( - llvm::SmallVectorImpl<const FileEntry *> &UIDToFiles) const { + SmallVectorImpl<const FileEntry *> &UIDToFiles) const { UIDToFiles.clear(); UIDToFiles.resize(NextFileUID); @@ -558,7 +558,7 @@ void FileManager::GetUniqueIDMapping( 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 188e2d46f5..edf2e99a51 100644 --- a/lib/Basic/IdentifierTable.cpp +++ b/lib/Basic/IdentifierTable.cpp @@ -55,7 +55,7 @@ namespace { class EmptyLookupIterator : public IdentifierIterator { public: - virtual llvm::StringRef Next() { return llvm::StringRef(); } + virtual StringRef Next() { return StringRef(); } }; } @@ -106,7 +106,7 @@ namespace { /// 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 @@ static void AddKeyword(llvm::StringRef Keyword, /// 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 @@ static void AddCXXOperatorKeyword(llvm::StringRef Keyword, /// 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 @@ static void AddObjCKeyword(llvm::StringRef Name, 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 @@ IdentifierInfo *Selector::getIdentifierInfoForSlot(unsigned argIndex) const { 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 @@ std::string Selector::getAsString() const { /// 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 @@ ObjCMethodFamily Selector::getMethodFamilyImpl(Selector sel) { 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 5062d43f58..cf89edb935 100644 --- a/lib/Basic/SourceLocation.cpp +++ b/lib/Basic/SourceLocation.cpp @@ -23,7 +23,7 @@ using namespace clang; // 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 @@ void PrettyStackTraceLoc::print(llvm::raw_ostream &OS) const { // 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 @@ const llvm::MemoryBuffer* FullSourceLoc::getBuffer(bool *Invalid) const { 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 ee13f621b5..cbac7ffa31 100644 --- a/lib/Basic/SourceManager.cpp +++ b/lib/Basic/SourceManager.cpp @@ -105,7 +105,7 @@ const llvm::MemoryBuffer *ContentCache::getBuffer(Diagnostic &Diag, // 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 @@ const llvm::MemoryBuffer *ContentCache::getBuffer(Diagnostic &Diag, // 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 @@ const llvm::MemoryBuffer *ContentCache::getBuffer(Diagnostic &Diag, 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 @@ void LineTableInfo::AddEntry(int FID, /// 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 @@ void SourceManager::overrideFileContents(const FileEntry *SourceFile, 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 @@ static void ComputeLineNumbers(Diagnostic &Diag, ContentCache *FI, // 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 @@ SourceLocation SourceManager::getLocation(const FileEntry *SourceFile, // 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 30a9bdb317..7ea51467c1 100644 --- a/lib/Basic/TargetInfo.cpp +++ b/lib/Basic/TargetInfo.cpp @@ -174,7 +174,7 @@ void TargetInfo::setForcedLangOptions(LangOptions &Opts) { //===----------------------------------------------------------------------===// -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 @@ static llvm::StringRef removeGCCRegisterPrefix(llvm::StringRef Name) { /// 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 @@ bool TargetInfo::isValidClobber(llvm::StringRef Name) const { /// 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 @@ bool TargetInfo::isValidGCCRegisterName(llvm::StringRef Name) const { 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 0414d196d4..3aebc41d71 100644 --- a/lib/Basic/Targets.cpp +++ b/lib/Basic/Targets.cpp @@ -37,7 +37,7 @@ using namespace clang; /// 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 @@ public: 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 @@ public: 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 @@ protected: // 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 @@ protected: 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 @@ void X86TargetInfo::getTargetDefines(const LangOptions &Opts, 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 @@ protected: // 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 @@ public: 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 @@ public: 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 86d4aa5dfb..10b9364587 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 @@ std::string getClangRepositoryPath() { 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, |