diff options
Diffstat (limited to 'clang/lib/Frontend')
20 files changed, 239 insertions, 239 deletions
diff --git a/clang/lib/Frontend/ASTConsumers.cpp b/clang/lib/Frontend/ASTConsumers.cpp index 28d312a2219..b0746b290cf 100644 --- a/clang/lib/Frontend/ASTConsumers.cpp +++ b/clang/lib/Frontend/ASTConsumers.cpp @@ -31,11 +31,11 @@ using namespace clang; namespace { class ASTPrinter : public ASTConsumer { - llvm::raw_ostream &Out; + raw_ostream &Out; bool Dump; public: - ASTPrinter(llvm::raw_ostream* o = NULL, bool Dump = false) + ASTPrinter(raw_ostream* o = NULL, bool Dump = false) : Out(o? *o : llvm::outs()), Dump(Dump) { } virtual void HandleTranslationUnit(ASTContext &Context) { @@ -46,7 +46,7 @@ namespace { }; } // end anonymous namespace -ASTConsumer *clang::CreateASTPrinter(llvm::raw_ostream* out) { +ASTConsumer *clang::CreateASTPrinter(raw_ostream* out) { return new ASTPrinter(out); } @@ -95,7 +95,7 @@ ASTConsumer *clang::CreateASTViewer() { return new ASTViewer(); } namespace { class DeclContextPrinter : public ASTConsumer { - llvm::raw_ostream& Out; + raw_ostream& Out; public: DeclContextPrinter() : Out(llvm::errs()) {} @@ -404,10 +404,10 @@ ASTConsumer *clang::CreateDeclContextPrinter() { namespace { class ASTDumpXML : public ASTConsumer { - llvm::raw_ostream &OS; + raw_ostream &OS; public: - ASTDumpXML(llvm::raw_ostream &OS) : OS(OS) {} + ASTDumpXML(raw_ostream &OS) : OS(OS) {} void HandleTranslationUnit(ASTContext &C) { C.getTranslationUnitDecl()->dumpXML(OS); @@ -415,6 +415,6 @@ public: }; } -ASTConsumer *clang::CreateASTDumperXML(llvm::raw_ostream &OS) { +ASTConsumer *clang::CreateASTDumperXML(raw_ostream &OS) { return new ASTDumpXML(OS); } diff --git a/clang/lib/Frontend/ASTMerge.cpp b/clang/lib/Frontend/ASTMerge.cpp index 3905b99b02a..df4650e68f6 100644 --- a/clang/lib/Frontend/ASTMerge.cpp +++ b/clang/lib/Frontend/ASTMerge.cpp @@ -17,12 +17,12 @@ using namespace clang; ASTConsumer *ASTMergeAction::CreateASTConsumer(CompilerInstance &CI, - llvm::StringRef InFile) { + StringRef InFile) { return AdaptedAction->CreateASTConsumer(CI, InFile); } bool ASTMergeAction::BeginSourceFileAction(CompilerInstance &CI, - llvm::StringRef Filename) { + StringRef Filename) { // FIXME: This is a hack. We need a better way to communicate the // AST file, compiler instance, and file name than member variables // of FrontendAction. diff --git a/clang/lib/Frontend/ASTUnit.cpp b/clang/lib/Frontend/ASTUnit.cpp index e43bdb42269..cd4627bc995 100644 --- a/clang/lib/Frontend/ASTUnit.cpp +++ b/clang/lib/Frontend/ASTUnit.cpp @@ -66,7 +66,7 @@ namespace { Start = TimeRecord::getCurrentTime(); } - void setOutput(const llvm::Twine &Output) { + void setOutput(const Twine &Output) { if (WantTiming) this->Output = Output.str(); } @@ -237,7 +237,7 @@ void ASTUnit::CacheCodeCompletionResults() { // Gather the set of global code completions. typedef CodeCompletionResult Result; - llvm::SmallVector<Result, 8> Results; + SmallVector<Result, 8> Results; CachedCompletionAllocator = new GlobalCodeCompletionAllocator; TheSema->GatherGlobalCodeCompletions(*CachedCompletionAllocator, Results); @@ -396,13 +396,13 @@ public: return false; } - virtual bool ReadTargetTriple(llvm::StringRef Triple) { + virtual bool ReadTargetTriple(StringRef Triple) { TargetTriple = Triple; return false; } virtual bool ReadPredefinesBuffer(const PCHPredefinesBlocks &Buffers, - llvm::StringRef OriginalFileName, + StringRef OriginalFileName, std::string &SuggestedPredefines, FileManager &FileMgr) { Predefines = Buffers[0].Data; @@ -422,11 +422,11 @@ public: }; class StoredDiagnosticClient : public DiagnosticClient { - llvm::SmallVectorImpl<StoredDiagnostic> &StoredDiags; + SmallVectorImpl<StoredDiagnostic> &StoredDiags; public: explicit StoredDiagnosticClient( - llvm::SmallVectorImpl<StoredDiagnostic> &StoredDiags) + SmallVectorImpl<StoredDiagnostic> &StoredDiags) : StoredDiags(StoredDiags) { } virtual void HandleDiagnostic(Diagnostic::Level Level, @@ -442,7 +442,7 @@ class CaptureDroppedDiagnostics { public: CaptureDroppedDiagnostics(bool RequestCapture, Diagnostic &Diags, - llvm::SmallVectorImpl<StoredDiagnostic> &StoredDiags) + SmallVectorImpl<StoredDiagnostic> &StoredDiags) : Diags(Diags), Client(StoredDiags), PreviousClient(0) { if (RequestCapture || Diags.getClient() == 0) { @@ -478,7 +478,7 @@ const std::string &ASTUnit::getASTFileName() { return static_cast<ASTReader *>(Ctx->getExternalSource())->getFileName(); } -llvm::MemoryBuffer *ASTUnit::getBufferForFile(llvm::StringRef Filename, +llvm::MemoryBuffer *ASTUnit::getBufferForFile(StringRef Filename, std::string *ErrorStr) { assert(FileMgr); return FileMgr->getBufferForFile(Filename, ErrorStr); @@ -711,7 +711,7 @@ void AddTopLevelDeclarationToHash(Decl *D, unsigned &Hash) { return; } - if (ObjCClassDecl *Class = llvm::dyn_cast<ObjCClassDecl>(D)) { + if (ObjCClassDecl *Class = dyn_cast<ObjCClassDecl>(D)) { for (ObjCClassDecl::iterator I = Class->begin(), IEnd = Class->end(); I != IEnd; ++I) AddTopLevelDeclarationToHash(I->getInterface(), Hash); @@ -753,7 +753,7 @@ public: ASTUnit &Unit; virtual ASTConsumer *CreateASTConsumer(CompilerInstance &CI, - llvm::StringRef InFile) { + StringRef InFile) { CI.getPreprocessor().addPPCallbacks( new MacroDefinitionTrackerPPCallbacks(Unit.getCurrentTopLevelHashValue())); return new TopLevelDeclTrackerConsumer(Unit, @@ -778,7 +778,7 @@ class PrecompilePreambleConsumer : public PCHGenerator, public: PrecompilePreambleConsumer(ASTUnit &Unit, const Preprocessor &PP, bool Chaining, - StringRef isysroot, llvm::raw_ostream *Out) + StringRef isysroot, raw_ostream *Out) : PCHGenerator(PP, "", Chaining, isysroot, Out), Unit(Unit), Hash(Unit.getCurrentTopLevelHashValue()) { Hash = 0; @@ -828,10 +828,10 @@ public: explicit PrecompilePreambleAction(ASTUnit &Unit) : Unit(Unit) {} virtual ASTConsumer *CreateASTConsumer(CompilerInstance &CI, - llvm::StringRef InFile) { + StringRef InFile) { std::string Sysroot; std::string OutputFile; - llvm::raw_ostream *OS = 0; + raw_ostream *OS = 0; bool Chaining; if (GeneratePCHAction::ComputeASTConsumerArguments(CI, InFile, Sysroot, OutputFile, @@ -1132,7 +1132,7 @@ ASTUnit::ComputePreamble(CompilerInvocation &Invocation, static llvm::MemoryBuffer *CreatePaddedMainFileBuffer(llvm::MemoryBuffer *Old, unsigned NewSize, - llvm::StringRef NewName) { + StringRef NewName) { llvm::MemoryBuffer *Result = llvm::MemoryBuffer::getNewUninitMemBuffer(NewSize, NewName); memcpy(const_cast<char*>(Result->getBufferStart()), @@ -1565,7 +1565,7 @@ unsigned ASTUnit::getMaxPCHLevel() const { return 0; } -llvm::StringRef ASTUnit::getMainFileName() const { +StringRef ASTUnit::getMainFileName() const { return Invocation->getFrontendOpts().Inputs[0].second; } @@ -1758,7 +1758,7 @@ ASTUnit *ASTUnit::LoadFromCompilerInvocation(CompilerInvocation *CI, ASTUnit *ASTUnit::LoadFromCommandLine(const char **ArgBegin, const char **ArgEnd, llvm::IntrusiveRefCntPtr<Diagnostic> Diags, - llvm::StringRef ResourceFilesPath, + StringRef ResourceFilesPath, bool OnlyLocalDecls, bool CaptureDiagnostics, RemappedFile *RemappedFiles, @@ -1778,7 +1778,7 @@ ASTUnit *ASTUnit::LoadFromCommandLine(const char **ArgBegin, ArgBegin); } - llvm::SmallVector<StoredDiagnostic, 4> StoredDiagnostics; + SmallVector<StoredDiagnostic, 4> StoredDiagnostics; llvm::IntrusiveRefCntPtr<CompilerInvocation> CI; @@ -2064,7 +2064,7 @@ void AugmentedCodeCompleteConsumer::ProcessCodeCompleteResults(Sema &S, // Contains the set of names that are hidden by "local" completion results. llvm::StringSet<llvm::BumpPtrAllocator> HiddenNames; typedef CodeCompletionResult Result; - llvm::SmallVector<Result, 8> AllResults; + SmallVector<Result, 8> AllResults; for (ASTUnit::cached_completion_iterator C = AST.cached_completion_begin(), CEnd = AST.cached_completion_end(); @@ -2146,7 +2146,7 @@ void AugmentedCodeCompleteConsumer::ProcessCodeCompleteResults(Sema &S, -void ASTUnit::CodeComplete(llvm::StringRef File, unsigned Line, unsigned Column, +void ASTUnit::CodeComplete(StringRef File, unsigned Line, unsigned Column, RemappedFile *RemappedFiles, unsigned NumRemappedFiles, bool IncludeMacros, @@ -2154,14 +2154,14 @@ void ASTUnit::CodeComplete(llvm::StringRef File, unsigned Line, unsigned Column, CodeCompleteConsumer &Consumer, Diagnostic &Diag, LangOptions &LangOpts, SourceManager &SourceMgr, FileManager &FileMgr, - llvm::SmallVectorImpl<StoredDiagnostic> &StoredDiagnostics, - llvm::SmallVectorImpl<const llvm::MemoryBuffer *> &OwnedBuffers) { + SmallVectorImpl<StoredDiagnostic> &StoredDiagnostics, + SmallVectorImpl<const llvm::MemoryBuffer *> &OwnedBuffers) { if (!Invocation) return; SimpleTimer CompletionTimer(WantTiming); CompletionTimer.setOutput("Code completion @ " + File + ":" + - llvm::Twine(Line) + ":" + llvm::Twine(Column)); + Twine(Line) + ":" + Twine(Column)); llvm::IntrusiveRefCntPtr<CompilerInvocation> CCInvocation(new CompilerInvocation(*Invocation)); @@ -2303,7 +2303,7 @@ void ASTUnit::CodeComplete(llvm::StringRef File, unsigned Line, unsigned Column, } } -CXSaveError ASTUnit::Save(llvm::StringRef File) { +CXSaveError ASTUnit::Save(StringRef File) { if (getDiagnostics().hasUnrecoverableErrorOccurred()) return CXSaveError_TranslationErrors; @@ -2341,7 +2341,7 @@ CXSaveError ASTUnit::Save(llvm::StringRef File) { return CXSaveError_None; } -bool ASTUnit::serialize(llvm::raw_ostream &OS) { +bool ASTUnit::serialize(raw_ostream &OS) { if (getDiagnostics().hasErrorOccurred()) return true; @@ -2368,17 +2368,17 @@ static void TranslateSLoc(SourceLocation &L, SLocRemap &Remap) { void ASTUnit::TranslateStoredDiagnostics( ASTReader *MMan, - llvm::StringRef ModName, + StringRef ModName, SourceManager &SrcMgr, - const llvm::SmallVectorImpl<StoredDiagnostic> &Diags, - llvm::SmallVectorImpl<StoredDiagnostic> &Out) { + const SmallVectorImpl<StoredDiagnostic> &Diags, + SmallVectorImpl<StoredDiagnostic> &Out) { // The stored diagnostic has the old source manager in it; update // the locations to refer into the new source manager. We also need to remap // all the locations to the new view. This includes the diag location, any // associated source ranges, and the source ranges of associated fix-its. // FIXME: There should be a cleaner way to do this. - llvm::SmallVector<StoredDiagnostic, 4> Result; + SmallVector<StoredDiagnostic, 4> Result; Result.reserve(Diags.size()); assert(MMan && "Don't have a module manager"); serialization::Module *Mod = MMan->Modules.lookup(ModName); @@ -2391,7 +2391,7 @@ void ASTUnit::TranslateStoredDiagnostics( TranslateSLoc(L, Remap); FullSourceLoc Loc(L, SrcMgr); - llvm::SmallVector<CharSourceRange, 4> Ranges; + SmallVector<CharSourceRange, 4> Ranges; Ranges.reserve(SD.range_size()); for (StoredDiagnostic::range_iterator I = SD.range_begin(), E = SD.range_end(); @@ -2403,7 +2403,7 @@ void ASTUnit::TranslateStoredDiagnostics( Ranges.push_back(CharSourceRange(SourceRange(BL, EL), I->isTokenRange())); } - llvm::SmallVector<FixItHint, 2> FixIts; + SmallVector<FixItHint, 2> FixIts; FixIts.reserve(SD.fixit_size()); for (StoredDiagnostic::fixit_iterator I = SD.fixit_begin(), E = SD.fixit_end(); diff --git a/clang/lib/Frontend/CacheTokens.cpp b/clang/lib/Frontend/CacheTokens.cpp index 20b51893fcc..8195445fe0e 100644 --- a/clang/lib/Frontend/CacheTokens.cpp +++ b/clang/lib/Frontend/CacheTokens.cpp @@ -71,13 +71,13 @@ public: bool isFile() const { return Kind == IsFE; } - llvm::StringRef getString() const { + StringRef getString() const { return Kind == IsFE ? FE->getName() : Path; } unsigned getKind() const { return (unsigned) Kind; } - void EmitData(llvm::raw_ostream& Out) { + void EmitData(raw_ostream& Out) { switch (Kind) { case IsFE: // Emit stat information. @@ -119,7 +119,7 @@ public: } static std::pair<unsigned,unsigned> - EmitKeyDataLength(llvm::raw_ostream& Out, PTHEntryKeyVariant V, + EmitKeyDataLength(raw_ostream& Out, PTHEntryKeyVariant V, const PTHEntry& E) { unsigned n = V.getString().size() + 1 + 1; @@ -131,14 +131,14 @@ public: return std::make_pair(n, m); } - static void EmitKey(llvm::raw_ostream& Out, PTHEntryKeyVariant V, unsigned n){ + static void EmitKey(raw_ostream& Out, PTHEntryKeyVariant V, unsigned n){ // Emit the entry kind. ::Emit8(Out, (unsigned) V.getKind()); // Emit the string. Out.write(V.getString().data(), n - 1); } - static void EmitData(llvm::raw_ostream& Out, PTHEntryKeyVariant V, + static void EmitData(raw_ostream& Out, PTHEntryKeyVariant V, const PTHEntry& E, unsigned) { @@ -197,7 +197,7 @@ class PTHWriter { Out.write(Ptr, NumBytes); } - void EmitString(llvm::StringRef V) { + void EmitString(StringRef V) { ::Emit16(Out, V.size()); EmitBuf(V.data(), V.size()); } @@ -247,7 +247,7 @@ void PTHWriter::EmitToken(const Token& T) { } else { // We cache *un-cleaned* spellings. This gives us 100% fidelity with the // source code. - llvm::StringRef s(T.getLiteralData(), T.getLength()); + StringRef s(T.getLiteralData(), T.getLength()); // Get the string entry. llvm::StringMapEntry<OffsetOpt> *E = &CachedStrs.GetOrCreateValue(s); @@ -584,20 +584,20 @@ public: } static std::pair<unsigned,unsigned> - EmitKeyDataLength(llvm::raw_ostream& Out, const PTHIdKey* key, uint32_t) { + EmitKeyDataLength(raw_ostream& Out, const PTHIdKey* key, uint32_t) { unsigned n = key->II->getLength() + 1; ::Emit16(Out, n); return std::make_pair(n, sizeof(uint32_t)); } - static void EmitKey(llvm::raw_ostream& Out, PTHIdKey* key, unsigned n) { + static void EmitKey(raw_ostream& Out, PTHIdKey* key, unsigned n) { // Record the location of the key data. This is used when generating // the mapping from persistent IDs to strings. key->FileOffset = Out.tell(); Out.write(key->II->getNameStart(), n); } - static void EmitData(llvm::raw_ostream& Out, PTHIdKey*, uint32_t pID, + static void EmitData(raw_ostream& Out, PTHIdKey*, uint32_t pID, unsigned) { ::Emit32(Out, pID); } diff --git a/clang/lib/Frontend/CompilerInstance.cpp b/clang/lib/Frontend/CompilerInstance.cpp index 8bf9ed9f9da..ef0796ab01c 100644 --- a/clang/lib/Frontend/CompilerInstance.cpp +++ b/clang/lib/Frontend/CompilerInstance.cpp @@ -89,7 +89,7 @@ static void SetUpBuildDumpLog(const DiagnosticOptions &DiagOpts, unsigned argc, const char* const *argv, Diagnostic &Diags) { std::string ErrorInfo; - llvm::OwningPtr<llvm::raw_ostream> OS( + llvm::OwningPtr<raw_ostream> OS( new llvm::raw_fd_ostream(DiagOpts.DumpBuildInformation.c_str(), ErrorInfo)); if (!ErrorInfo.empty()) { Diags.Report(diag::err_fe_unable_to_open_logfile) @@ -113,7 +113,7 @@ static void SetUpDiagnosticLog(const DiagnosticOptions &DiagOpts, Diagnostic &Diags) { std::string ErrorInfo; bool OwnsStream = false; - llvm::raw_ostream *OS = &llvm::errs(); + raw_ostream *OS = &llvm::errs(); if (DiagOpts.DiagnosticLogFile != "-") { // Create the output stream. llvm::raw_fd_ostream *FileOS( @@ -241,7 +241,7 @@ CompilerInstance::createPreprocessor(Diagnostic &Diags, if (DepOpts.ShowHeaderIncludes) AttachHeaderIncludeGen(*PP); if (!DepOpts.HeaderIncludeOutputFile.empty()) { - llvm::StringRef OutputPath = DepOpts.HeaderIncludeOutputFile; + StringRef OutputPath = DepOpts.HeaderIncludeOutputFile; if (OutputPath == "-") OutputPath = ""; AttachHeaderIncludeGen(*PP, /*ShowAllHeaders=*/true, OutputPath, @@ -263,7 +263,7 @@ void CompilerInstance::createASTContext() { // ExternalASTSource -void CompilerInstance::createPCHExternalASTSource(llvm::StringRef Path, +void CompilerInstance::createPCHExternalASTSource(StringRef Path, bool DisablePCHValidation, bool DisableStatCache, void *DeserializationListener){ @@ -280,7 +280,7 @@ void CompilerInstance::createPCHExternalASTSource(llvm::StringRef Path, } ExternalASTSource * -CompilerInstance::createPCHExternalASTSource(llvm::StringRef Path, +CompilerInstance::createPCHExternalASTSource(StringRef Path, const std::string &Sysroot, bool DisablePCHValidation, bool DisableStatCache, @@ -373,7 +373,7 @@ CompilerInstance::createCodeCompletionConsumer(Preprocessor &PP, bool ShowMacros, bool ShowCodePatterns, bool ShowGlobals, - llvm::raw_ostream &OS) { + raw_ostream &OS) { if (EnableCodeCompletion(PP, Filename, Line, Column)) return 0; @@ -427,17 +427,17 @@ void CompilerInstance::clearOutputFiles(bool EraseFiles) { llvm::raw_fd_ostream * CompilerInstance::createDefaultOutputFile(bool Binary, - llvm::StringRef InFile, - llvm::StringRef Extension) { + StringRef InFile, + StringRef Extension) { return createOutputFile(getFrontendOpts().OutputFile, Binary, /*RemoveFileOnSignal=*/true, InFile, Extension); } llvm::raw_fd_ostream * -CompilerInstance::createOutputFile(llvm::StringRef OutputPath, +CompilerInstance::createOutputFile(StringRef OutputPath, bool Binary, bool RemoveFileOnSignal, - llvm::StringRef InFile, - llvm::StringRef Extension) { + StringRef InFile, + StringRef Extension) { std::string Error, OutputPathName, TempPathName; llvm::raw_fd_ostream *OS = createOutputFile(OutputPath, Error, Binary, RemoveFileOnSignal, @@ -459,12 +459,12 @@ CompilerInstance::createOutputFile(llvm::StringRef OutputPath, } llvm::raw_fd_ostream * -CompilerInstance::createOutputFile(llvm::StringRef OutputPath, +CompilerInstance::createOutputFile(StringRef OutputPath, std::string &Error, bool Binary, bool RemoveFileOnSignal, - llvm::StringRef InFile, - llvm::StringRef Extension, + StringRef InFile, + StringRef Extension, std::string *ResultPathName, std::string *TempPathName) { std::string OutFile, TempFile; @@ -519,12 +519,12 @@ CompilerInstance::createOutputFile(llvm::StringRef OutputPath, // Initialization Utilities -bool CompilerInstance::InitializeSourceManager(llvm::StringRef InputFile) { +bool CompilerInstance::InitializeSourceManager(StringRef InputFile) { return InitializeSourceManager(InputFile, getDiagnostics(), getFileManager(), getSourceManager(), getFrontendOpts()); } -bool CompilerInstance::InitializeSourceManager(llvm::StringRef InputFile, +bool CompilerInstance::InitializeSourceManager(StringRef InputFile, Diagnostic &Diags, FileManager &FileMgr, SourceManager &SourceMgr, @@ -567,7 +567,7 @@ bool CompilerInstance::ExecuteAction(FrontendAction &Act) { // FIXME: Take this as an argument, once all the APIs we used have moved to // taking it as an input instead of hard-coding llvm::errs. - llvm::raw_ostream &OS = llvm::errs(); + raw_ostream &OS = llvm::errs(); // Create the target instance. setTarget(TargetInfo::CreateTargetInfo(getDiagnostics(), getTargetOpts())); diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp index d2cdde01d97..8967d5280bb 100644 --- a/clang/lib/Frontend/CompilerInvocation.cpp +++ b/clang/lib/Frontend/CompilerInvocation.cpp @@ -878,7 +878,7 @@ static void ParseAnalyzerArgs(AnalyzerOptions &Opts, ArgList &Args, using namespace cc1options; if (Arg *A = Args.getLastArg(OPT_analyzer_store)) { - llvm::StringRef Name = A->getValue(Args); + StringRef Name = A->getValue(Args); AnalysisStores Value = llvm::StringSwitch<AnalysisStores>(Name) #define ANALYSIS_STORE(NAME, CMDFLAG, DESC, CREATFN) \ .Case(CMDFLAG, NAME##Model) @@ -893,7 +893,7 @@ static void ParseAnalyzerArgs(AnalyzerOptions &Opts, ArgList &Args, } if (Arg *A = Args.getLastArg(OPT_analyzer_constraints)) { - llvm::StringRef Name = A->getValue(Args); + StringRef Name = A->getValue(Args); AnalysisConstraints Value = llvm::StringSwitch<AnalysisConstraints>(Name) #define ANALYSIS_CONSTRAINTS(NAME, CMDFLAG, DESC, CREATFN) \ .Case(CMDFLAG, NAME##Model) @@ -908,7 +908,7 @@ static void ParseAnalyzerArgs(AnalyzerOptions &Opts, ArgList &Args, } if (Arg *A = Args.getLastArg(OPT_analyzer_output)) { - llvm::StringRef Name = A->getValue(Args); + StringRef Name = A->getValue(Args); AnalysisDiagClients Value = llvm::StringSwitch<AnalysisDiagClients>(Name) #define ANALYSIS_DIAGNOSTICS(NAME, CMDFLAG, DESC, CREATFN, AUTOCREAT) \ .Case(CMDFLAG, PD_##NAME) @@ -950,8 +950,8 @@ static void ParseAnalyzerArgs(AnalyzerOptions &Opts, ArgList &Args, bool enable = (A->getOption().getID() == OPT_analyzer_checker); // We can have a list of comma separated checker names, e.g: // '-analyzer-checker=cocoa,unix' - llvm::StringRef checkerList = A->getValue(Args); - llvm::SmallVector<llvm::StringRef, 4> checkers; + StringRef checkerList = A->getValue(Args); + SmallVector<StringRef, 4> checkers; checkerList.split(checkers, ","); for (unsigned i = 0, e = checkers.size(); i != e; ++i) Opts.CheckersControlList.push_back(std::make_pair(checkers[i], enable)); @@ -1034,7 +1034,7 @@ static void ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args, InputKind IK, Opts.CoverageFile = Args.getLastArgValue(OPT_coverage_file); if (Arg *A = Args.getLastArg(OPT_fobjc_dispatch_method_EQ)) { - llvm::StringRef Name = A->getValue(Args); + StringRef Name = A->getValue(Args); unsigned Method = llvm::StringSwitch<unsigned>(Name) .Case("legacy", CodeGenOptions::Legacy) .Case("non-legacy", CodeGenOptions::NonLegacy) @@ -1084,7 +1084,7 @@ static void ParseDiagnosticArgs(DiagnosticOptions &Opts, ArgList &Args, if (A->getOption().matches(OPT_fdiagnostics_show_note_include_stack)) Opts.ShowNoteIncludeStack = true; - llvm::StringRef ShowOverloads = + StringRef ShowOverloads = Args.getLastArgValue(OPT_fshow_overloads_EQ, "all"); if (ShowOverloads == "best") Opts.ShowOverloads = Diagnostic::Ovl_Best; @@ -1095,7 +1095,7 @@ static void ParseDiagnosticArgs(DiagnosticOptions &Opts, ArgList &Args, << Args.getLastArg(OPT_fshow_overloads_EQ)->getAsString(Args) << ShowOverloads; - llvm::StringRef ShowCategory = + StringRef ShowCategory = Args.getLastArgValue(OPT_fdiagnostics_show_category, "none"); if (ShowCategory == "none") Opts.ShowCategories = 0; @@ -1108,7 +1108,7 @@ static void ParseDiagnosticArgs(DiagnosticOptions &Opts, ArgList &Args, << Args.getLastArg(OPT_fdiagnostics_show_category)->getAsString(Args) << ShowCategory; - llvm::StringRef Format = + StringRef Format = Args.getLastArgValue(OPT_fdiagnostics_format, "clang"); if (Format == "clang") Opts.Format = DiagnosticOptions::Clang; @@ -1325,7 +1325,7 @@ static InputKind ParseFrontendArgs(FrontendOptions &Opts, ArgList &Args, InputKind IK = DashX; if (IK == IK_None) { IK = FrontendOptions::getInputKindForExtension( - llvm::StringRef(Inputs[i]).rsplit('.').second); + StringRef(Inputs[i]).rsplit('.').second); // FIXME: Remove this hack. if (i == 0) DashX = IK; @@ -1371,7 +1371,7 @@ static void ParseHeaderSearchArgs(HeaderSearchOptions &Opts, ArgList &Args) { /*IsFramework=*/ (*it)->getOption().matches(OPT_F), false); // Add -iprefix/-iwith-prefix/-iwithprefixbefore options. - llvm::StringRef Prefix = ""; // FIXME: This isn't the correct default prefix. + StringRef Prefix = ""; // FIXME: This isn't the correct default prefix. for (arg_iterator it = Args.filtered_begin(OPT_iprefix, OPT_iwithprefix, OPT_iwithprefixbefore), ie = Args.filtered_end(); it != ie; ++it) { @@ -1593,7 +1593,7 @@ static void ParseLangArgs(LangOptions &Opts, ArgList &Args, InputKind IK, if (Args.hasArg(OPT_fdelayed_template_parsing)) Opts.DelayedTemplateParsing = 1; - llvm::StringRef Vis = Args.getLastArgValue(OPT_fvisibility, "default"); + StringRef Vis = Args.getLastArgValue(OPT_fvisibility, "default"); if (Vis == "default") Opts.setVisibilityMode(DefaultVisibility); else if (Vis == "hidden") @@ -1731,12 +1731,12 @@ static void ParsePreprocessorArgs(PreprocessorOptions &Opts, ArgList &Args, } if (const Arg *A = Args.getLastArg(OPT_preamble_bytes_EQ)) { - llvm::StringRef Value(A->getValue(Args)); + StringRef Value(A->getValue(Args)); size_t Comma = Value.find(','); unsigned Bytes = 0; unsigned EndOfLine = 0; - if (Comma == llvm::StringRef::npos || + if (Comma == StringRef::npos || Value.substr(0, Comma).getAsInteger(10, Bytes) || Value.substr(Comma + 1).getAsInteger(10, EndOfLine)) Diags.Report(diag::err_drv_preamble_format); @@ -1787,8 +1787,8 @@ static void ParsePreprocessorArgs(PreprocessorOptions &Opts, ArgList &Args, for (arg_iterator it = Args.filtered_begin(OPT_remap_file), ie = Args.filtered_end(); it != ie; ++it) { const Arg *A = *it; - std::pair<llvm::StringRef,llvm::StringRef> Split = - llvm::StringRef(A->getValue(Args)).split(';'); + std::pair<StringRef,StringRef> Split = + StringRef(A->getValue(Args)).split(';'); if (Split.second.empty()) { Diags.Report(diag::err_drv_invalid_remap_file) << A->getAsString(Args); @@ -1799,7 +1799,7 @@ static void ParsePreprocessorArgs(PreprocessorOptions &Opts, ArgList &Args, } if (Arg *A = Args.getLastArg(OPT_fobjc_arc_cxxlib_EQ)) { - llvm::StringRef Name = A->getValue(Args); + StringRef Name = A->getValue(Args); unsigned Library = llvm::StringSwitch<unsigned>(Name) .Case("libc++", ARCXX_libcxx) .Case("libstdc++", ARCXX_libstdcxx) diff --git a/clang/lib/Frontend/CreateInvocationFromCommandLine.cpp b/clang/lib/Frontend/CreateInvocationFromCommandLine.cpp index 42b648aa641..fa34334b5d1 100644 --- a/clang/lib/Frontend/CreateInvocationFromCommandLine.cpp +++ b/clang/lib/Frontend/CreateInvocationFromCommandLine.cpp @@ -39,7 +39,7 @@ clang::createInvocationFromCommandLine(llvm::ArrayRef<const char *> ArgList, ArgList.begin()); } - llvm::SmallVector<const char *, 16> Args; + SmallVector<const char *, 16> Args; Args.push_back("<clang>"); // FIXME: Remove dummy argument. Args.insert(Args.end(), ArgList.begin(), ArgList.end()); @@ -74,7 +74,7 @@ clang::createInvocationFromCommandLine(llvm::ArrayRef<const char *> ArgList, } const driver::Command *Cmd = cast<driver::Command>(*Jobs.begin()); - if (llvm::StringRef(Cmd->getCreator().getName()) != "clang") { + if (StringRef(Cmd->getCreator().getName()) != "clang") { Diags->Report(diag::err_fe_expected_clang_command); return 0; } diff --git a/clang/lib/Frontend/DependencyFile.cpp b/clang/lib/Frontend/DependencyFile.cpp index 1edd09b06c4..9cffed2b357 100644 --- a/clang/lib/Frontend/DependencyFile.cpp +++ b/clang/lib/Frontend/DependencyFile.cpp @@ -32,19 +32,19 @@ class DependencyFileCallback : public PPCallbacks { llvm::StringSet<> FilesSet; const Preprocessor *PP; std::vector<std::string> Targets; - llvm::raw_ostream *OS; + raw_ostream *OS; bool IncludeSystemHeaders; bool PhonyTarget; bool AddMissingHeaderDeps; private: bool FileMatchesDepCriteria(const char *Filename, SrcMgr::CharacteristicKind FileType); - void AddFilename(llvm::StringRef Filename); + void AddFilename(StringRef Filename); void OutputDependencyFile(); public: DependencyFileCallback(const Preprocessor *_PP, - llvm::raw_ostream *_OS, + raw_ostream *_OS, const DependencyOutputOptions &Opts) : PP(_PP), Targets(Opts.Targets), OS(_OS), IncludeSystemHeaders(Opts.IncludeSystemHeaders), @@ -55,12 +55,12 @@ public: SrcMgr::CharacteristicKind FileType); virtual void InclusionDirective(SourceLocation HashLoc, const Token &IncludeTok, - llvm::StringRef FileName, + StringRef FileName, bool IsAngled, const FileEntry *File, SourceLocation EndLoc, - llvm::StringRef SearchPath, - llvm::StringRef RelativePath); + StringRef SearchPath, + StringRef RelativePath); virtual void EndOfMainFile() { OutputDependencyFile(); @@ -78,7 +78,7 @@ void clang::AttachDependencyFileGen(Preprocessor &PP, } std::string Err; - llvm::raw_ostream *OS(new llvm::raw_fd_ostream(Opts.OutputFile.c_str(), Err)); + raw_ostream *OS(new llvm::raw_fd_ostream(Opts.OutputFile.c_str(), Err)); if (!Err.empty()) { PP.getDiagnostics().Report(diag::err_fe_error_opening) << Opts.OutputFile << Err; @@ -126,7 +126,7 @@ void DependencyFileCallback::FileChanged(SourceLocation Loc, SM.getFileEntryForID(SM.getFileID(SM.getInstantiationLoc(Loc))); if (FE == 0) return; - llvm::StringRef Filename = FE->getName(); + StringRef Filename = FE->getName(); if (!FileMatchesDepCriteria(Filename.data(), FileType)) return; @@ -143,24 +143,24 @@ void DependencyFileCallback::FileChanged(SourceLocation Loc, void DependencyFileCallback::InclusionDirective(SourceLocation HashLoc, const Token &IncludeTok, - llvm::StringRef FileName, + StringRef FileName, bool IsAngled, const FileEntry *File, SourceLocation EndLoc, - llvm::StringRef SearchPath, - llvm::StringRef RelativePath) { + StringRef SearchPath, + StringRef RelativePath) { if (AddMissingHeaderDeps && !File) AddFilename(FileName); } -void DependencyFileCallback::AddFilename(llvm::StringRef Filename) { +void DependencyFileCallback::AddFilename(StringRef Filename) { if (FilesSet.insert(Filename)) Files.push_back(Filename); } /// PrintFilename - GCC escapes spaces, but apparently not ' or " or other /// scary characters. -static void PrintFilename(llvm::raw_ostream &OS, llvm::StringRef Filename) { +static void PrintFilename(raw_ostream &OS, StringRef Filename) { for (unsigned i = 0, e = Filename.size(); i != e; ++i) { if (Filename[i] == ' ') OS << '\\'; diff --git a/clang/lib/Frontend/FrontendAction.cpp b/clang/lib/Frontend/FrontendAction.cpp index 344c85627fb..89d95fc97d8 100644 --- a/clang/lib/Frontend/FrontendAction.cpp +++ b/clang/lib/Frontend/FrontendAction.cpp @@ -82,7 +82,7 @@ FrontendAction::FrontendAction() : Instance(0) {} FrontendAction::~FrontendAction() {} -void FrontendAction::setCurrentFile(llvm::StringRef Value, InputKind Kind, +void FrontendAction::setCurrentFile(StringRef Value, InputKind Kind, ASTUnit *AST) { CurrentFile = Value; CurrentFileKind = Kind; @@ -90,7 +90,7 @@ void FrontendAction::setCurrentFile(llvm::StringRef Value, InputKind Kind, } ASTConsumer* FrontendAction::CreateWrappedASTConsumer(CompilerInstance &CI, - llvm::StringRef InFile) { + StringRef InFile) { ASTConsumer* Consumer = CreateASTConsumer(CI, InFile); if (!Consumer) return 0; @@ -123,7 +123,7 @@ ASTConsumer* FrontendAction::CreateWrappedASTConsumer(CompilerInstance &CI, } bool FrontendAction::BeginSourceFile(CompilerInstance &CI, - llvm::StringRef Filename, + StringRef Filename, InputKind InputKind) { assert(!Instance && "Already processing a source file!"); assert(!Filename.empty() && "Unexpected empty filename!"); @@ -380,19 +380,19 @@ void ASTFrontendAction::ExecuteAction() { ASTConsumer * PreprocessorFrontendAction::CreateASTConsumer(CompilerInstance &CI, - llvm::StringRef InFile) { + StringRef InFile) { llvm_unreachable("Invalid CreateASTConsumer on preprocessor action!"); } ASTConsumer *WrapperFrontendAction::CreateASTConsumer(CompilerInstance &CI, - llvm::StringRef InFile) { + StringRef InFile) { return WrappedAction->CreateASTConsumer(CI, InFile); } bool WrapperFrontendAction::BeginInvocation(CompilerInstance &CI) { return WrappedAction->BeginInvocation(CI); } bool WrapperFrontendAction::BeginSourceFileAction(CompilerInstance &CI, - llvm::StringRef Filename) { + StringRef Filename) { WrappedAction->setCurrentFile(getCurrentFile(), getCurrentFileKind()); WrappedAction->setCompilerInstance(&CI); return WrappedAction->BeginSourceFileAction(CI, Filename); diff --git a/clang/lib/Frontend/FrontendActions.cpp b/clang/lib/Frontend/FrontendActions.cpp index 342a4c24652..44cd2dfe9bf 100644 --- a/clang/lib/Frontend/FrontendActions.cpp +++ b/clang/lib/Frontend/FrontendActions.cpp @@ -29,7 +29,7 @@ using namespace clang; //===----------------------------------------------------------------------===// ASTConsumer *InitOnlyAction::CreateASTConsumer(CompilerInstance &CI, - llvm::StringRef InFile) { + StringRef InFile) { return new ASTConsumer(); } @@ -41,20 +41,20 @@ void InitOnlyAction::ExecuteAction() { //===----------------------------------------------------------------------===// ASTConsumer *ASTPrintAction::CreateASTConsumer(CompilerInstance &CI, - llvm::StringRef InFile) { - if (llvm::raw_ostream *OS = CI.createDefaultOutputFile(false, InFile)) + StringRef InFile) { + if (raw_ostream *OS = CI.createDefaultOutputFile(false, InFile)) return CreateASTPrinter(OS); return 0; } ASTConsumer *ASTDumpAction::CreateASTConsumer(CompilerInstance &CI, - llvm::StringRef InFile) { + StringRef InFile) { return CreateASTDumper(); } ASTConsumer *ASTDumpXMLAction::CreateASTConsumer(CompilerInstance &CI, - llvm::StringRef InFile) { - llvm::raw_ostream *OS; + StringRef InFile) { + raw_ostream *OS; if (CI.getFrontendOpts().OutputFile.empty()) OS = &llvm::outs(); else @@ -64,20 +64,20 @@ ASTConsumer *ASTDumpXMLAction::CreateASTConsumer(CompilerInstance &CI, } ASTConsumer *ASTViewAction::CreateASTConsumer(CompilerInstance &CI, - llvm::StringRef InFile) { + StringRef InFile) { return CreateASTViewer(); } ASTConsumer *DeclContextPrintAction::CreateASTConsumer(CompilerInstance &CI, - llvm::StringRef InFile) { + StringRef InFile) { return CreateDeclContextPrinter(); } ASTConsumer *GeneratePCHAction::CreateASTConsumer(CompilerInstance &CI, - llvm::StringRef InFile) { + StringRef InFile) { std::string Sysroot; std::string OutputFile; - llvm::raw_ostream *OS = 0; + raw_ostream *OS = 0; bool Chaining; if (ComputeASTConsumerArguments(CI, InFile, Sysroot, OutputFile, OS, Chaining)) return 0; @@ -89,10 +89,10 @@ ASTConsumer *GeneratePCHAction::CreateASTConsumer(CompilerInstance &CI, } bool GeneratePCHAction::ComputeASTConsumerArguments(CompilerInstance &CI, - llvm::StringRef InFile, + StringRef InFile, std::string &Sysroot, std::string &OutputFile, - llvm::raw_ostream *&OS, + raw_ostream *&OS, bool &Chaining) { Sysroot = CI.getHeaderSearchOpts().Sysroot; if (CI.getFrontendOpts().RelocatablePCH && Sysroot.empty()) { @@ -114,7 +114,7 @@ bool GeneratePCHAction::ComputeASTConsumerArguments(CompilerInstance &CI, } ASTConsumer *SyntaxOnlyAction::CreateASTConsumer(CompilerInstance &CI, - llvm::StringRef InFile) { + StringRef InFile) { return new ASTConsumer(); } @@ -185,7 +185,7 @@ void PrintPreprocessedAction::ExecuteAction() { CompilerInstance &CI = getCompilerInstance(); // Output file needs to be set to 'Binary', to avoid converting Unix style // line feeds (<LF>) to Microsoft style line feeds (<CR><LF>). - llvm::raw_ostream *OS = CI.createDefaultOutputFile(true, getCurrentFile()); + raw_ostream *OS = CI.createDefaultOutputFile(true, getCurrentFile()); if (!OS) return; DoPrintPreprocessedInput(CI.getPreprocessor(), OS, diff --git a/clang/lib/Frontend/FrontendOptions.cpp b/clang/lib/Frontend/FrontendOptions.cpp index 0a2005192a1..ea4005f7c96 100644 --- a/clang/lib/Frontend/FrontendOptions.cpp +++ b/clang/lib/Frontend/FrontendOptions.cpp @@ -11,7 +11,7 @@ #include "llvm/ADT/StringSwitch.h" using namespace clang; -InputKind FrontendOptions::getInputKindForExtension(llvm::StringRef Extension) { +InputKind FrontendOptions::getInputKindForExtension(StringRef Extension) { return llvm::StringSwitch<InputKind>(Extension) .Case("ast", IK_AST) .Case("c", IK_C) diff --git a/clang/lib/Frontend/HeaderIncludeGen.cpp b/clang/lib/Frontend/HeaderIncludeGen.cpp index 51dec967cd6..283239dde02 100644 --- a/clang/lib/Frontend/HeaderIncludeGen.cpp +++ b/clang/lib/Frontend/HeaderIncludeGen.cpp @@ -17,7 +17,7 @@ using namespace clang; namespace { class HeaderIncludesCallback : public PPCallbacks { SourceManager &SM; - llvm::raw_ostream *OutputFile; + raw_ostream *OutputFile; unsigned CurrentIncludeDepth; bool HasProcessedPredefines; bool OwnsOutputFile; @@ -26,7 +26,7 @@ class HeaderIncludesCallback : public PPCallbacks { public: HeaderIncludesCallback(const Preprocessor *PP, bool ShowAllHeaders_, - llvm::raw_ostream *OutputFile_, bool OwnsOutputFile_, + raw_ostream *OutputFile_, bool OwnsOutputFile_, bool ShowDepth_) : SM(PP->getSourceManager()), OutputFile(OutputFile_), CurrentIncludeDepth(0), HasProcessedPredefines(false), @@ -44,8 +44,8 @@ public: } void clang::AttachHeaderIncludeGen(Preprocessor &PP, bool ShowAllHeaders, - llvm::StringRef OutputPath, bool ShowDepth) { - llvm::raw_ostream *OutputFile = &llvm::errs(); + StringRef OutputPath, bool ShowDepth) { + raw_ostream *OutputFile = &llvm::errs(); bool OwnsOutputFile = false; // Open the output file, if used. diff --git a/clang/lib/Frontend/InitHeaderSearch.cpp b/clang/lib/Frontend/InitHeaderSearch.cpp index e11a415db19..ed763e27c77 100644 --- a/clang/lib/Frontend/InitHeaderSearch.cpp +++ b/clang/lib/Frontend/InitHeaderSearch.cpp @@ -52,38 +52,38 @@ class InitHeaderSearch { public: - InitHeaderSearch(HeaderSearch &HS, bool verbose, llvm::StringRef sysroot) + InitHeaderSearch(HeaderSearch &HS, bool verbose, StringRef sysroot) : Headers(HS), Verbose(verbose), IncludeSysroot(sysroot), IsNotEmptyOrRoot(!(sysroot.empty() || sysroot == "/")) { } /// AddPath - Add the specified path to the specified group list. - void AddPath(const llvm::Twine &Path, IncludeDirGroup Group, + void AddPath(const Twine &Path, IncludeDirGroup Group, bool isCXXAware, bool isUserSupplied, bool isFramework, bool IgnoreSysRoot = false); /// AddGnuCPlusPlusIncludePaths - Add the necessary paths to support a gnu /// libstdc++. - void AddGnuCPlusPlusIncludePaths(llvm::StringRef Base, - llvm::StringRef ArchDir, - llvm::StringRef Dir32, - llvm::StringRef Dir64, + void AddGnuCPlusPlusIncludePaths(StringRef Base, + StringRef ArchDir, + StringRef Dir32, + StringRef Dir64, const llvm::Triple &triple); /// AddMinGWCPlusPlusIncludePaths - Add the necessary paths to support a MinGW /// libstdc++. - void AddMinGWCPlusPlusIncludePaths(llvm::StringRef Base, - llvm::StringRef Arch, - llvm::StringRef Version); + void AddMinGWCPlusPlusIncludePaths(StringRef Base, + StringRef Arch, + StringRef Version); /// AddMinGW64CXXPaths - Add the necessary paths to support /// libstdc++ of x86_64-w64-mingw32 aka mingw-w64. - void AddMinGW64CXXPaths(llvm::StringRef Base, - llvm::StringRef Version); + void AddMinGW64CXXPaths(StringRef Base, + StringRef Version); /// AddDelimitedPaths - Add a list of paths delimited by the system PATH /// separator. The processing follows that of the CPATH variable for gcc. - void AddDelimitedPaths(llvm::StringRef String); + void AddDelimitedPaths(StringRef String); // AddDefaultCIncludePaths - Add paths that should always be searched. void AddDefaultCIncludePaths(const llvm::Triple &triple, @@ -107,7 +107,7 @@ public: } // end anonymous namespace. -void InitHeaderSearch::AddPath(const llvm::Twine &Path, +void InitHeaderSearch::AddPath(const Twine &Path, IncludeDirGroup Group, bool isCXXAware, bool isUserSupplied, bool isFramework, bool IgnoreSysRoot) { @@ -116,7 +116,7 @@ void InitHeaderSearch::AddPath(const llvm::Twine &Path, // Compute the actual path, taking into consideration -isysroot. llvm::SmallString<256> MappedPathStorage; - llvm::StringRef MappedPathStr = Path.toStringRef(MappedPathStorage); + StringRef MappedPathStr = Path.toStringRef(MappedPathStorage); // Handle isysroot. if ((Group == System || Group == CXXSystem) && !IgnoreSysRoot && @@ -168,12 +168,12 @@ void InitHeaderSearch::AddPath(const llvm::Twine &Path, } -void InitHeaderSearch::AddDelimitedPaths(llvm::StringRef at) { +void InitHeaderSearch::AddDelimitedPaths(StringRef at) { if (at.empty()) // Empty string should not add '.' path. return; - llvm::StringRef::size_type delim; - while ((delim = at.find(llvm::sys::PathSeparator)) != llvm::StringRef::npos) { + StringRef::size_type delim; + while ((delim = at.find(llvm::sys::PathSeparator)) != StringRef::npos) { if (delim == 0) AddPath(".", Angled, false, true, false); else @@ -187,10 +187,10 @@ void InitHeaderSearch::AddDelimitedPaths(llvm::StringRef at) { AddPath(at, Angled, false, true, false); } -void InitHeaderSearch::AddGnuCPlusPlusIncludePaths(llvm::StringRef Base, - llvm::StringRef ArchDir, - llvm::StringRef Dir32, - llvm::StringRef Dir64, +void InitHeaderSearch::AddGnuCPlusPlusIncludePaths(StringRef Base, + StringRef ArchDir, + StringRef Dir32, + StringRef Dir64, const llvm::Triple &triple) { // Add the base dir AddPath(Base, CXXSystem, true, false, false); @@ -207,9 +207,9 @@ void InitHeaderSearch::AddGnuCPlusPlusIncludePaths(llvm::StringRef Base, AddPath(Base + "/backward", CXXSystem, true, false, false); } -void InitHeaderSearch::AddMinGWCPlusPlusIncludePaths(llvm::StringRef Base, - llvm::StringRef Arch, - llvm::StringRef Version) { +void InitHeaderSearch::AddMinGWCPlusPlusIncludePaths(StringRef Base, + StringRef Arch, + StringRef Version) { AddPath(Base + "/" + Arch + "/" + Version + "/include/c++", CXXSystem, true, false, false); AddPath(Base + "/" + Arch + "/" + Version + "/include/c++/" + Arch, @@ -218,8 +218,8 @@ void InitHeaderSearch::AddMinGWCPlusPlusIncludePaths(llvm::StringRef Base, CXXSystem, true, false, false); } -void InitHeaderSearch::AddMinGW64CXXPaths(llvm::StringRef Base, - llvm::StringRef Version) { +void InitHeaderSearch::AddMinGW64CXXPaths(StringRef Base, + StringRef Version) { // Assumes Base is HeaderSearchOpts' ResourceDir AddPath(Base + "/../../../include/c++/" + Version, CXXSystem, true, false, false); @@ -469,11 +469,11 @@ void InitHeaderSearch::AddDefaultCIncludePaths(const llvm::Triple &triple, } // Add dirs specified via 'configure --with-c-include-dirs'. - llvm::StringRef CIncludeDirs(C_INCLUDE_DIRS); + StringRef CIncludeDirs(C_INCLUDE_DIRS); if (CIncludeDirs != "") { - llvm::SmallVector<llvm::StringRef, 5> dirs; + SmallVector<StringRef, 5> dirs; CIncludeDirs.split(dirs, ":"); - for (llvm::SmallVectorImpl<llvm::StringRef>::iterator i = dirs.begin(); + for (SmallVectorImpl<StringRef>::iterator i = dirs.begin(); i != dirs.end(); ++i) AddPath(*i, System, false, false, false); @@ -597,9 +597,9 @@ void InitHeaderSearch::AddDefaultCIncludePaths(const llvm::Triple &triple, void InitHeaderSearch:: AddDefaultCPlusPlusIncludePaths(const llvm::Triple &triple, const HeaderSearchOptions &HSOpts) { llvm::Triple::OSType os = triple.getOS(); - llvm::StringRef CxxIncludeRoot(CXX_INCLUDE_ROOT); + StringRef CxxIncludeRoot(CXX_INCLUDE_ROOT); if (CxxIncludeRoot != "") { - llvm::StringRef CxxIncludeArch(CXX_INCLUDE_ARCH); + StringRef CxxIncludeArch(CXX_INCLUDE_ARCH); if (CxxIncludeArch == "") AddGnuCPlusPlusIncludePaths(CxxIncludeRoot, triple.str().c_str(), CXX_INCLUDE_32BIT_DIR, CXX_INCLUDE_64BIT_DIR, diff --git a/clang/lib/Frontend/InitPreprocessor.cpp b/clang/lib/Frontend/InitPreprocessor.cpp index 77a1b3f396a..125242b5d49 100644 --- a/clang/lib/Frontend/InitPreprocessor.cpp +++ b/clang/lib/Frontend/InitPreprocessor.cpp @@ -30,15 +30,15 @@ using namespace clang; // Append a #define line to Buf for Macro. Macro should be of the form XXX, // in which case we emit "#define XXX 1" or "XXX=Y z W" in which case we emit // "#define XXX Y z W". To get a #define with no value, use "XXX=". -static void DefineBuiltinMacro(MacroBuilder &Builder, llvm::StringRef Macro, +static void DefineBuiltinMacro(MacroBuilder &Builder, StringRef Macro, Diagnostic &Diags) { - std::pair<llvm::StringRef, llvm::StringRef> MacroPair = Macro.split('='); - llvm::StringRef MacroName = MacroPair.first; - llvm::StringRef MacroBody = MacroPair.second; + std::pair<StringRef, StringRef> MacroPair = Macro.split('='); + StringRef MacroName = MacroPair.first; + StringRef MacroBody = MacroPair.second; if (MacroName.size() != Macro.size()) { // Per GCC -D semantics, the macro ends at \n if it exists. - llvm::StringRef::size_type End = MacroBody.find_first_of("\n\r"); - if (End != llvm::StringRef::npos) + StringRef::size_type End = MacroBody.find_first_of("\n\r"); + if (End != StringRef::npos) Diags.Report(diag::warn_fe_macro_contains_embedded_newline) << MacroName; Builder.defineMacro(MacroName, MacroBody.substr(0, End)); @@ -48,7 +48,7 @@ static void DefineBuiltinMacro(MacroBuilder &Builder, llvm::StringRef Macro, } } -std::string clang::NormalizeDashIncludePath(llvm::StringRef File, +std::string clang::NormalizeDashIncludePath(StringRef File, FileManager &FileMgr) { // Implicit include paths should be resolved relative to the current // working directory first, and then use the regular header search @@ -70,17 +70,17 @@ std::string clang::NormalizeDashIncludePath(llvm::StringRef File, /// AddImplicitInclude - Add an implicit #include of the specified file to the /// predefines buffer. -static void AddImplicitInclude(MacroBuilder &Builder, llvm::StringRef File, +static void AddImplicitInclude(MacroBuilder &Builder, StringRef File, FileManager &FileMgr) { Builder.append("#include \"" + - llvm::Twine(NormalizeDashIncludePath(File, FileMgr)) + "\""); + Twine(NormalizeDashIncludePath(File, FileMgr)) + "\""); } static void AddImplicitIncludeMacros(MacroBuilder &Builder, - llvm::StringRef File, + StringRef File, FileManager &FileMgr) { Builder.append("#__include_macros \"" + - llvm::Twine(NormalizeDashIncludePath(File, FileMgr)) + "\""); + Twine(NormalizeDashIncludePath(File, FileMgr)) + "\""); // Marker token to stop the __include_macros fetch loop. Builder.append("##"); // ##? } @@ -88,7 +88,7 @@ static void AddImplicitIncludeMacros(MacroBuilder &Builder, /// AddImplicitIncludePTH - Add an implicit #include using the original file /// used to generate a PTH cache. static void AddImplicitIncludePTH(MacroBuilder &Builder, Preprocessor &PP, - llvm::StringRef ImplicitIncludePTH) { + StringRef ImplicitIncludePTH) { PTHManager *P = PP.getPTHManager(); // Null check 'P' in the corner case where it couldn't be created. const char *OriginalFile = P ? P->getOriginalSourceFile() : 0; @@ -120,7 +120,7 @@ static T PickFP(const llvm::fltSemantics *Sem, T IEEESingleVal, return IEEEQuadVal; } -static void DefineFloatMacros(MacroBuilder &Builder, llvm::StringRef Prefix, +static void DefineFloatMacros(MacroBuilder &Builder, StringRef Prefix, const llvm::fltSemantics *Sem) { const char *DenormMin, *Epsilon, *Max, *Min; DenormMin = PickFP(Sem, "1.40129846e-45F", "4.9406564584124654e-324", @@ -153,27 +153,27 @@ static void DefineFloatMacros(MacroBuilder &Builder, llvm::StringRef Prefix, Builder.defineMacro(DefPrefix + "DENORM_MIN__", DenormMin); Builder.defineMacro(DefPrefix + "HAS_DENORM__"); - Builder.defineMacro(DefPrefix + "DIG__", llvm::Twine(Digits)); - Builder.defineMacro(DefPrefix + "EPSILON__", llvm::Twine(Epsilon)); + Builder.defineMacro(DefPrefix + "DIG__", Twine(Digits)); + Builder.defineMacro(DefPrefix + "EPSILON__", Twine(Epsilon)); Builder.defineMacro(DefPrefix + "HAS_INFINITY__"); Builder.defineMacro(DefPrefix + "HAS_QUIET_NAN__"); - Builder.defineMacro(DefPrefix + "MANT_DIG__", llvm::Twine(MantissaDigits)); + Builder.defineMacro(DefPrefix + "MANT_DIG__", Twine(MantissaDigits)); - Builder.defineMacro(DefPrefix + "MAX_10_EXP__", llvm::Twine(Max10Exp)); - Builder.defineMacro(DefPrefix + "MAX_EXP__", llvm::Twine(MaxExp)); - Builder.defineMacro(DefPrefix + "MAX__", llvm::Twine(Max)); + Builder.defineMacro(DefPrefix + "MAX_10_EXP__", Twine(Max10Exp)); + Builder.defineMacro(DefPrefix + "MAX_EXP__", Twine(MaxExp)); + Builder.defineMacro(DefPrefix + "MAX__", Twine(Max)); - Builder.defineMacro(DefPrefix + "MIN_10_EXP__","("+llvm::Twine(Min10Exp)+")"); - Builder.defineMacro(DefPrefix + "MIN_EXP__", "("+llvm::Twine(MinExp)+")"); - Builder.defineMacro(DefPrefix + "MIN__", llvm::Twine(Min)); + Builder.defineMacro(DefPrefix + "MIN_10_EXP__","("+Twine(Min10Exp)+")"); + Builder.defineMacro(DefPrefix + "MIN_EXP__", "("+Twine(MinExp)+")"); + Builder.defineMacro(DefPrefix + "MIN__", Twine(Min)); } /// DefineTypeSize - Emit a macro to the predefines buffer that declares a macro /// named MacroName with the max value for a type with width 'TypeWidth' a /// signedness of 'isSigned' and with a value suffix of 'ValSuffix' (e.g. LL). -static void DefineTypeSize(llvm::StringRef MacroName, unsigned TypeWidth, - llvm::StringRef ValSuffix, bool isSigned, +static void DefineTypeSize(StringRef MacroName, unsigned TypeWidth, + StringRef ValSuffix, bool isSigned, MacroBuilder &Builder) { llvm::APInt MaxVal = isSigned ? llvm::APInt::getSignedMaxValue(TypeWidth) : llvm::APInt::getMaxValue(TypeWidth); @@ -182,26 +182,26 @@ static void DefineTypeSize(llvm::StringRef MacroName, unsigned TypeWidth, /// DefineTypeSize - An overloaded helper that uses TargetInfo to determine /// the width, suffix, and signedness of the given type -static void DefineTypeSize(llvm::StringRef MacroName, TargetInfo::IntType Ty, +static void DefineTypeSize(StringRef MacroName, TargetInfo::IntType Ty, const TargetInfo &TI, MacroBuilder &Builder) { DefineTypeSize(MacroName, TI.getTypeWidth(Ty), TI.getTypeConstantSuffix(Ty), TI.isTypeSigned(Ty), Builder); } -static void DefineType(const llvm::Twine &MacroName, TargetInfo::IntType Ty, +static void DefineType(const Twine &MacroName, TargetInfo::IntType Ty, MacroBuilder &Builder) { Builder.defineMacro(MacroName, TargetInfo::getTypeName(Ty)); } -static void DefineTypeWidth(llvm::StringRef MacroName, TargetInfo::IntType Ty, +static void DefineTypeWidth(StringRef MacroName, TargetInfo::IntType Ty, const TargetInfo &TI, MacroBuilder &Builder) { - Builder.defineMacro(MacroName, llvm::Twine(TI.getTypeWidth(Ty))); + Builder.defineMacro(MacroName, Twine(TI.getTypeWidth(Ty))); } -static void DefineTypeSizeof(llvm::StringRef MacroName, unsigned BitWidth, +static void DefineTypeSizeof(StringRef MacroName, unsigned BitWidth, const TargetInfo &TI, MacroBuilder &Builder) { Builder.defineMacro(MacroName, - llvm::Twine(BitWidth / TI.getCharWidth())); + Twine(BitWidth / TI.getCharWidth())); } static void DefineExactWidthIntType(TargetInfo::IntType Ty, @@ -213,11 +213,11 @@ static void DefineExactWidthIntType(TargetInfo::IntType Ty, if (TypeWidth == 64) Ty = TI.getInt64Type(); - DefineType("__INT" + llvm::Twine(TypeWidth) + "_TYPE__", Ty, Builder); + DefineType("__INT" + Twine(TypeWidth) + "_TYPE__", Ty, Builder); - llvm::StringRef ConstSuffix(TargetInfo::getTypeConstantSuffix(Ty)); + StringRef ConstSuffix(TargetInfo::getTypeConstantSuffix(Ty)); if (!ConstSuffix.empty()) - Builder.defineMacro("__INT" + llvm::Twine(TypeWidth) + "_C_SUFFIX__", + Builder.defineMacro("__INT" + Twine(TypeWidth) + "_C_SUFFIX__", ConstSuffix); } @@ -412,7 +412,7 @@ static void InitializePredefinedMacros(const TargetInfo &TI, // checks that it is necessary to report 4.2.1 (the base GCC version we claim // compatibility with) first. Builder.defineMacro("__VERSION__", "\"4.2.1 Compatible " + - llvm::Twine(getClangFullCPPVersion()) + "\""); + Twine(getClangFullCPPVersion()) + "\""); // Initialize language-specific preprocessor defines. @@ -546,7 +546,7 @@ static void InitializePredefinedMacros(const TargetInfo &TI, // Define a __POINTER_WIDTH__ macro for stdint.h. Builder.defineMacro("__POINTER_WIDTH__", - llvm::Twine((int)TI.getPointerWidth(0))); + Twine((int)TI.getPointerWidth(0))); if (!LangOpts.CharIsSigned) Builder.defineMacro("__CHAR_UNSIGNED__"); @@ -558,7 +558,7 @@ static void InitializePredefinedMacros(const TargetInfo &TI, Builder.defineMacro("__WCHAR_UNSIGNED__"); // Define exact-width integer types for stdint.h - Builder.defineMacro("__INT" + llvm::Twine(TI.getCharWidth()) + "_TYPE__", + Builder.defineMacro("__INT" + Twine(TI.getCharWidth()) + "_TYPE__", "char"); if (TI.getShortWidth() > TI.getCharWidth()) @@ -592,15 +592,15 @@ static void InitializePredefinedMacros(const TargetInfo &TI, Builder.defineMacro("__NO_INLINE__"); if (unsigned PICLevel = LangOpts.PICLevel) { - Builder.defineMacro("__PIC__", llvm::Twine(PICLevel)); - Builder.defineMacro("__pic__", llvm::Twine(PICLevel)); + Builder.defineMacro("__PIC__", Twine(PICLevel)); + Builder.defineMacro("__pic__", Twine(PICLevel)); } // Macros to control C99 numerics and <float.h> Builder.defineMacro("__FLT_EVAL_METHOD__", "0"); Builder.defineMacro("__FLT_RADIX__", "2"); int Dig = PickFP(&TI.getLongDoubleFormat(), -1/*FIXME*/, 17, 21, 33, 36); - Builder.defineMacro("__DECIMAL_DIG__", llvm::Twine(Dig)); + Builder.defineMacro("__DECIMAL_DIG__", Twine(Dig)); if (LangOpts.getStackProtectorMode() == LangOptions::SSPOn) Builder.defineMacro("__SSP__"); diff --git a/clang/lib/Frontend/LangStandards.cpp b/clang/lib/Frontend/LangStandards.cpp index af1721d0f9e..abb521ba27f 100644 --- a/clang/lib/Frontend/LangStandards.cpp +++ b/clang/lib/Frontend/LangStandards.cpp @@ -29,7 +29,7 @@ const LangStandard &LangStandard::getLangStandardForKind(Kind K) { } } -const LangStandard *LangStandard::getLangStandardForName(llvm::StringRef Name) { +const LangStandard *LangStandard::getLangStandardForName(StringRef Name) { Kind K = llvm::StringSwitch<Kind>(Name) #define LANGSTANDARD(id, name, desc, features) \ .Case(name, lang_##id) diff --git a/clang/lib/Frontend/LogDiagnosticPrinter.cpp b/clang/lib/Frontend/LogDiagnosticPrinter.cpp index 78eb1b21283..52e40efb820 100644 --- a/clang/lib/Frontend/LogDiagnosticPrinter.cpp +++ b/clang/lib/Frontend/LogDiagnosticPrinter.cpp @@ -14,7 +14,7 @@ #include "llvm/Support/raw_ostream.h" using namespace clang; -LogDiagnosticPrinter::LogDiagnosticPrinter(llvm::raw_ostream &os, +LogDiagnosticPrinter::LogDiagnosticPrinter(raw_ostream &os, const DiagnosticOptions &diags, bool _OwnsOutputStream) : OS(os), LangOpts(0), DiagOpts(&diags), @@ -26,7 +26,7 @@ LogDiagnosticPrinter::~LogDiagnosticPrinter() { delete &OS; } -static llvm::StringRef getLevelName(Diagnostic::Level Level) { +static StringRef getLevelName(Diagnostic::Level Level) { switch (Level) { default: return "<unknown>"; diff --git a/clang/lib/Frontend/PrintPreprocessedOutput.cpp b/clang/lib/Frontend/PrintPreprocessedOutput.cpp index c892960a18b..0bfb6a27f38 100644 --- a/clang/lib/Frontend/PrintPreprocessedOutput.cpp +++ b/clang/lib/Frontend/PrintPreprocessedOutput.cpp @@ -33,7 +33,7 @@ using namespace clang; /// PrintMacroDefinition - Print a macro definition in a form that will be /// properly accepted back as a definition. static void PrintMacroDefinition(const IdentifierInfo &II, const MacroInfo &MI, - Preprocessor &PP, llvm::raw_ostream &OS) { + Preprocessor &PP, raw_ostream &OS) { OS << "#define " << II.getName(); if (MI.isFunctionLike()) { @@ -83,7 +83,7 @@ class PrintPPOutputPPCallbacks : public PPCallbacks { SourceManager &SM; TokenConcatenation ConcatInfo; public: - llvm::raw_ostream &OS; + raw_ostream &OS; private: unsigned CurLine; @@ -96,7 +96,7 @@ private: bool DumpDefines; bool UseLineDirective; public: - PrintPPOutputPPCallbacks(Preprocessor &pp, llvm::raw_ostream &os, + PrintPPOutputPPCallbacks(Preprocessor &pp, raw_ostream &os, bool lineMarkers, bool defines) : PP(pp), SM(PP.getSourceManager()), ConcatInfo(PP), OS(os), DisableLineMarkers(lineMarkers), @@ -122,13 +122,13 @@ public: virtual void Ident(SourceLocation Loc, const std::string &str); virtual void PragmaComment(SourceLocation Loc, const IdentifierInfo *Kind, const std::string &Str); - virtual void PragmaMessage(SourceLocation Loc, llvm::StringRef Str); + virtual void PragmaMessage(SourceLocation Loc, StringRef Str); virtual void PragmaDiagnosticPush(SourceLocation Loc, - llvm::StringRef Namespace); + StringRef Namespace); virtual void PragmaDiagnosticPop(SourceLocation Loc, - llvm::StringRef Namespace); - virtual void PragmaDiagnostic(SourceLocation Loc, llvm::StringRef Namespace, - diag::Mapping Map, llvm::StringRef Str); + StringRef Namespace); + virtual void PragmaDiagnostic(SourceLocation Loc, StringRef Namespace, + diag::Mapping Map, StringRef Str); bool HandleFirstTokOnLine(Token &Tok); bool MoveToLine(SourceLocation Loc) { @@ -346,7 +346,7 @@ void PrintPPOutputPPCallbacks::PragmaComment(SourceLocation Loc, } void PrintPPOutputPPCallbacks::PragmaMessage(SourceLocation Loc, - llvm::StringRef Str) { + StringRef Str) { MoveToLine(Loc); OS << "#pragma message("; @@ -369,22 +369,22 @@ void PrintPPOutputPPCallbacks::PragmaMessage(SourceLocation Loc, } void PrintPPOutputPPCallbacks:: -PragmaDiagnosticPush(SourceLocation Loc, llvm::StringRef Namespace) { +PragmaDiagnosticPush(SourceLocation Loc, StringRef Namespace) { MoveToLine(Loc); OS << "#pragma " << Namespace << " diagnostic push"; EmittedTokensOnThisLine = true; } void PrintPPOutputPPCallbacks:: -PragmaDiagnosticPop(SourceLocation Loc, llvm::StringRef Namespace) { +PragmaDiagnosticPop(SourceLocation Loc, StringRef Namespace) { MoveToLine(Loc); OS << "#pragma " << Namespace << " diagnostic pop"; EmittedTokensOnThisLine = true; } void PrintPPOutputPPCallbacks:: -PragmaDiagnostic(SourceLocation Loc, llvm::StringRef Namespace, - diag::Mapping Map, llvm::StringRef Str) { +PragmaDiagnostic(SourceLocation Loc, StringRef Namespace, + diag::Mapping Map, StringRef Str) { MoveToLine(Loc); OS << "#pragma " << Namespace << " diagnostic "; switch (Map) { @@ -491,7 +491,7 @@ struct UnknownPragmaHandler : public PragmaHandler { static void PrintPreprocessedTokens(Preprocessor &PP, Token &Tok, PrintPPOutputPPCallbacks *Callbacks, - llvm::raw_ostream &OS) { + raw_ostream &OS) { char Buffer[256]; Token PrevPrevTok, PrevTok; PrevPrevTok.startToken(); @@ -550,7 +550,7 @@ static int MacroIDCompare(const void* a, const void* b) { return LHS->first->getName().compare(RHS->first->getName()); } -static void DoPrintMacros(Preprocessor &PP, llvm::raw_ostream *OS) { +static void DoPrintMacros(Preprocessor &PP, raw_ostream *OS) { // Ignore unknown pragmas. PP.AddPragmaHandler(new EmptyPragmaHandler()); @@ -562,7 +562,7 @@ static void DoPrintMacros(Preprocessor &PP, llvm::raw_ostream *OS) { do PP.Lex(Tok); while (Tok.isNot(tok::eof)); - llvm::SmallVector<id_macro_pair, 128> + SmallVector<id_macro_pair, 128> MacrosByID(PP.macro_begin(), PP.macro_end()); llvm::array_pod_sort(MacrosByID.begin(), MacrosByID.end(), MacroIDCompare); @@ -578,7 +578,7 @@ static void DoPrintMacros(Preprocessor &PP, llvm::raw_ostream *OS) { /// DoPrintPreprocessedInput - This implements -E mode. /// -void clang::DoPrintPreprocessedInput(Preprocessor &PP, llvm::raw_ostream *OS, +void clang::DoPrintPreprocessedInput(Preprocessor &PP, raw_ostream *OS, const PreprocessorOutputOptions &Opts) { // Show macros with no output is handled specially. if (!Opts.ShowCPP) { diff --git a/clang/lib/Frontend/TextDiagnosticPrinter.cpp b/clang/lib/Frontend/TextDiagnosticPrinter.cpp index e49e19a17c8..83a1a371881 100644 --- a/clang/lib/Frontend/TextDiagnosticPrinter.cpp +++ b/clang/lib/Frontend/TextDiagnosticPrinter.cpp @@ -23,24 +23,24 @@ #include <algorithm> using namespace clang; -static const enum llvm::raw_ostream::Colors noteColor = - llvm::raw_ostream::BLACK; -static const enum llvm::raw_ostream::Colors fixitColor = - llvm::raw_ostream::GREEN; -static const enum llvm::raw_ostream::Colors caretColor = - llvm::raw_ostream::GREEN; -static const enum llvm::raw_ostream::Colors warningColor = - llvm::raw_ostream::MAGENTA; -static const enum llvm::raw_ostream::Colors errorColor = llvm::raw_ostream::RED; -static const enum llvm::raw_ostream::Colors fatalColor = llvm::raw_ostream::RED; +static const enum raw_ostream::Colors noteColor = + raw_ostream::BLACK; +static const enum raw_ostream::Colors fixitColor = + raw_ostream::GREEN; +static const enum raw_ostream::Colors caretColor = + raw_ostream::GREEN; +static const enum raw_ostream::Colors warningColor = + raw_ostream::MAGENTA; +static const enum raw_ostream::Colors errorColor = raw_ostream::RED; +static const enum raw_ostream::Colors fatalColor = raw_ostream::RED; // Used for changing only the bold attribute. -static const enum llvm::raw_ostream::Colors savedColor = - llvm::raw_ostream::SAVEDCOLOR; +static const enum raw_ostream::Colors savedColor = + raw_ostream::SAVEDCOLOR; /// \brief Number of spaces to indent when word-wrapping. const unsigned WordWrapIndentation = 6; -TextDiagnosticPrinter::TextDiagnosticPrinter(llvm::raw_ostream &os, +TextDiagnosticPrinter::TextDiagnosticPrinter(raw_ostream &os, const DiagnosticOptions &diags, bool _OwnsOutputStream) : OS(os), LangOpts(0), DiagOpts(&diags), @@ -660,7 +660,7 @@ void TextDiagnosticPrinter::EmitCaretDiagnostic(SourceLocation Loc, /// greater than or equal to Idx or, if no such character exists, /// returns the end of the string. static unsigned skipWhitespace(unsigned Idx, - const llvm::SmallVectorImpl<char> &Str, + const SmallVectorImpl<char> &Str, unsigned Length) { while (Idx < Length && isspace(Str[Idx])) ++Idx; @@ -693,7 +693,7 @@ static inline char findMatchingPunctuation(char c) { /// \returns the index pointing one character past the end of the /// word. static unsigned findEndOfWord(unsigned Start, - const llvm::SmallVectorImpl<char> &Str, + const SmallVectorImpl<char> &Str, unsigned Length, unsigned Column, unsigned Columns) { assert(Start < Str.size() && "Invalid start position!"); @@ -764,8 +764,8 @@ static unsigned findEndOfWord(unsigned Start, /// /// \returns true if word-wrapping was required, or false if the /// string fit on the first line. -static bool PrintWordWrapped(llvm::raw_ostream &OS, - const llvm::SmallVectorImpl<char> &Str, +static bool PrintWordWrapped(raw_ostream &OS, + const SmallVectorImpl<char> &Str, unsigned Columns, unsigned Column = 0, unsigned Indentation = WordWrapIndentation) { @@ -1010,7 +1010,7 @@ void TextDiagnosticPrinter::HandleDiagnostic(Diagnostic::Level Level, OptionName += "-Werror"; } - llvm::StringRef Opt = DiagnosticIDs::getWarningOptionForDiag(Info.getID()); + StringRef Opt = DiagnosticIDs::getWarningOptionForDiag(Info.getID()); if (!Opt.empty()) { if (!OptionName.empty()) OptionName += ','; diff --git a/clang/lib/Frontend/VerifyDiagnosticsClient.cpp b/clang/lib/Frontend/VerifyDiagnosticsClient.cpp index fff417e20dc..9ffb0f676a5 100644 --- a/clang/lib/Frontend/VerifyDiagnosticsClient.cpp +++ b/clang/lib/Frontend/VerifyDiagnosticsClient.cpp @@ -163,7 +163,7 @@ public: : Begin(Begin), End(End), C(Begin), P(Begin), PEnd(NULL) { } // Return true if string literal is next. - bool Next(llvm::StringRef S) { + bool Next(StringRef S) { P = C; PEnd = C + S.size(); if (PEnd > End) @@ -189,7 +189,7 @@ public: // Return true if string literal is found. // When true, P marks begin-position of S in content. - bool Search(llvm::StringRef S) { + bool Search(StringRef S) { P = std::search(C, End, S.begin(), S.end()); PEnd = P + S.size(); return P != End; @@ -296,11 +296,11 @@ static void ParseDirective(const char *CommentStart, unsigned CommentLen, // build directive text; convert \n to newlines std::string Text; - llvm::StringRef NewlineStr = "\\n"; - llvm::StringRef Content(ContentBegin, ContentEnd-ContentBegin); + StringRef NewlineStr = "\\n"; + StringRef Content(ContentBegin, ContentEnd-ContentBegin); size_t CPos = 0; size_t FPos; - while ((FPos = Content.find(NewlineStr, CPos)) != llvm::StringRef::npos) { + while ((FPos = Content.find(NewlineStr, CPos)) != StringRef::npos) { Text += Content.substr(CPos, FPos-CPos); Text += '\n'; CPos = FPos + NewlineStr.size(); diff --git a/clang/lib/Frontend/Warnings.cpp b/clang/lib/Frontend/Warnings.cpp index f12b484c05e..215f8f8b22b 100644 --- a/clang/lib/Frontend/Warnings.cpp +++ b/clang/lib/Frontend/Warnings.cpp @@ -55,7 +55,7 @@ void clang::ProcessWarningOptions(Diagnostic &Diags, Diags.setExtensionHandlingBehavior(Diagnostic::Ext_Ignore); for (unsigned i = 0, e = Opts.Warnings.size(); i != e; ++i) { - llvm::StringRef Opt = Opts.Warnings[i]; + StringRef Opt = Opts.Warnings[i]; // Check to see if this warning starts with "no-", if so, this is a negative // form of the option. @@ -79,7 +79,7 @@ void clang::ProcessWarningOptions(Diagnostic &Diags, // -Werror/-Wno-error is a special case, not controlled by the option table. // It also has the "specifier" form of -Werror=foo and -Werror-foo. if (Opt.startswith("error")) { - llvm::StringRef Specifier; + StringRef Specifier; if (Opt.size() > 5) { // Specifier must be present. if ((Opt[5] != '=' && Opt[5] != '-') || Opt.size() == 6) { Diags.Report(diag::warn_unknown_warning_specifier) @@ -101,7 +101,7 @@ void clang::ProcessWarningOptions(Diagnostic &Diags, // -Wfatal-errors is yet another special case. if (Opt.startswith("fatal-errors")) { - llvm::StringRef Specifier; + StringRef Specifier; if (Opt.size() != 12) { if ((Opt[12] != '=' && Opt[12] != '-') || Opt.size() == 13) { Diags.Report(diag::warn_unknown_warning_specifier) |