From 2d3ba4f5a923a90c3fc290ddfba5e36c2d0a9b46 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Sat, 23 Jul 2011 17:14:25 +0000 Subject: [PATCH] Move ArrayRef to LLVM.h and eliminate now-redundant qualifiers, patch by Jon Mulder! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135855 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/clang/Basic/Diagnostic.h | 4 ++-- include/clang/Basic/LLVM.h | 4 +++- include/clang/Driver/Driver.h | 4 ++-- include/clang/Frontend/Utils.h | 2 +- include/clang/Lex/Preprocessor.h | 2 +- lib/ARCMigrate/ARCMT.cpp | 4 ++-- lib/ARCMigrate/Internals.h | 10 +++++----- lib/ARCMigrate/PlistReporter.cpp | 6 +++--- lib/ARCMigrate/TransformActions.cpp | 10 +++++----- lib/Basic/Diagnostic.cpp | 4 ++-- lib/CodeGen/CGCall.cpp | 4 ++-- lib/CodeGen/CodeGenFunction.h | 2 +- lib/CodeGen/CodeGenModule.cpp | 2 +- lib/CodeGen/CodeGenModule.h | 4 ++-- lib/Driver/Driver.cpp | 4 ++-- lib/Frontend/CreateInvocationFromCommandLine.cpp | 2 +- lib/Lex/PPMacroExpansion.cpp | 2 +- lib/Sema/SemaStmt.cpp | 2 +- tools/arcmt-test/arcmt-test.cpp | 8 ++++---- 19 files changed, 41 insertions(+), 39 deletions(-) diff --git a/include/clang/Basic/Diagnostic.h b/include/clang/Basic/Diagnostic.h index 7f6f53739c..b7a1f3a627 100644 --- a/include/clang/Basic/Diagnostic.h +++ b/include/clang/Basic/Diagnostic.h @@ -987,8 +987,8 @@ class StoredDiagnostic { StringRef Message); StoredDiagnostic(Diagnostic::Level Level, unsigned ID, StringRef Message, FullSourceLoc Loc, - llvm::ArrayRef Ranges, - llvm::ArrayRef Fixits); + ArrayRef Ranges, + ArrayRef Fixits); ~StoredDiagnostic(); /// \brief Evaluates true when this object stores a diagnostic. diff --git a/include/clang/Basic/LLVM.h b/include/clang/Basic/LLVM.h index 7db17f7659..27c459dee4 100644 --- a/include/clang/Basic/LLVM.h +++ b/include/clang/Basic/LLVM.h @@ -23,11 +23,12 @@ namespace llvm { // ADT's. class StringRef; class Twine; + template class ArrayRef; template class SmallVector; template class SmallVectorImpl; class raw_ostream; - // TODO: ArrayRef, DenseMap, ... + // TODO: DenseMap, ... } @@ -42,6 +43,7 @@ namespace clang { // ADT's. using llvm::StringRef; using llvm::Twine; + using llvm::ArrayRef; using llvm::SmallVector; using llvm::SmallVectorImpl; diff --git a/include/clang/Driver/Driver.h b/include/clang/Driver/Driver.h index 1af572a5bd..3ad3fb3ff4 100644 --- a/include/clang/Driver/Driver.h +++ b/include/clang/Driver/Driver.h @@ -223,14 +223,14 @@ class Driver { /// argument vector. A null return value does not necessarily /// indicate an error condition, the diagnostics should be queried /// to determine if an error occurred. - Compilation *BuildCompilation(llvm::ArrayRef Args); + Compilation *BuildCompilation(ArrayRef Args); /// @name Driver Steps /// @{ /// ParseArgStrings - Parse the given list of strings into an /// ArgList. - InputArgList *ParseArgStrings(llvm::ArrayRef Args); + InputArgList *ParseArgStrings(ArrayRef Args); /// BuildActions - Construct the list of actions to perform for the /// given arguments, which are only done for a single architecture. diff --git a/include/clang/Frontend/Utils.h b/include/clang/Frontend/Utils.h index 105e4eb0de..b3ecb363ba 100644 --- a/include/clang/Frontend/Utils.h +++ b/include/clang/Frontend/Utils.h @@ -100,7 +100,7 @@ void CacheTokens(Preprocessor &PP, llvm::raw_fd_ostream* OS); /// \return A CompilerInvocation, or 0 if none was built for the given /// argument vector. CompilerInvocation * -createInvocationFromCommandLine(llvm::ArrayRef Args, +createInvocationFromCommandLine(ArrayRef Args, llvm::IntrusiveRefCntPtr Diags = llvm::IntrusiveRefCntPtr()); diff --git a/include/clang/Lex/Preprocessor.h b/include/clang/Lex/Preprocessor.h index e546b69370..2a2f099548 100644 --- a/include/clang/Lex/Preprocessor.h +++ b/include/clang/Lex/Preprocessor.h @@ -1006,7 +1006,7 @@ class Preprocessor : public llvm::RefCountedBase { /// going to lex in the cache and when it finishes the tokens are removed /// from the end of the cache. Token *cacheMacroExpandedTokens(TokenLexer *tokLexer, - llvm::ArrayRef tokens); + ArrayRef tokens); void removeCachedMacroExpandedTokensOfLastLexer(); friend void TokenLexer::ExpandFunctionArguments(); diff --git a/lib/ARCMigrate/ARCMT.cpp b/lib/ARCMigrate/ARCMT.cpp index f2dba72e66..3b44702fa1 100644 --- a/lib/ARCMigrate/ARCMT.cpp +++ b/lib/ARCMigrate/ARCMT.cpp @@ -22,7 +22,7 @@ using namespace clang; using namespace arcmt; -bool CapturedDiagList::clearDiagnostic(llvm::ArrayRef IDs, +bool CapturedDiagList::clearDiagnostic(ArrayRef IDs, SourceRange range) { if (range.isInvalid()) return false; @@ -51,7 +51,7 @@ bool CapturedDiagList::clearDiagnostic(llvm::ArrayRef IDs, return cleared; } -bool CapturedDiagList::hasDiagnostic(llvm::ArrayRef IDs, +bool CapturedDiagList::hasDiagnostic(ArrayRef IDs, SourceRange range) const { if (range.isInvalid()) return false; diff --git a/lib/ARCMigrate/Internals.h b/lib/ARCMigrate/Internals.h index a9ab093f3a..61eeccb3a7 100644 --- a/lib/ARCMigrate/Internals.h +++ b/lib/ARCMigrate/Internals.h @@ -26,8 +26,8 @@ class CapturedDiagList { public: void push_back(const StoredDiagnostic &diag) { List.push_back(diag); } - bool clearDiagnostic(llvm::ArrayRef IDs, SourceRange range); - bool hasDiagnostic(llvm::ArrayRef IDs, SourceRange range) const; + bool clearDiagnostic(ArrayRef IDs, SourceRange range); + bool hasDiagnostic(ArrayRef IDs, SourceRange range) const; void reportDiagnostics(Diagnostic &diags) const; @@ -39,7 +39,7 @@ class CapturedDiagList { }; void writeARCDiagsToPlist(const std::string &outPath, - llvm::ArrayRef diags, + ArrayRef diags, SourceManager &SM, const LangOptions &LangOpts); class TransformActions { @@ -69,9 +69,9 @@ class TransformActions { void increaseIndentation(SourceRange range, SourceLocation parentIndent); - bool clearDiagnostic(llvm::ArrayRef IDs, SourceRange range); + bool clearDiagnostic(ArrayRef IDs, SourceRange range); bool clearAllDiagnostics(SourceRange range) { - return clearDiagnostic(llvm::ArrayRef(), range); + return clearDiagnostic(ArrayRef(), range); } bool clearDiagnostic(unsigned ID1, unsigned ID2, SourceRange range) { unsigned IDs[] = { ID1, ID2 }; diff --git a/lib/ARCMigrate/PlistReporter.cpp b/lib/ARCMigrate/PlistReporter.cpp index 95ef14ac59..ba74caef54 100644 --- a/lib/ARCMigrate/PlistReporter.cpp +++ b/lib/ARCMigrate/PlistReporter.cpp @@ -92,7 +92,7 @@ static raw_ostream& EmitString(raw_ostream& o, } void arcmt::writeARCDiagsToPlist(const std::string &outPath, - llvm::ArrayRef diags, + ArrayRef diags, SourceManager &SM, const LangOptions &LangOpts) { DiagnosticIDs DiagIDs; @@ -102,7 +102,7 @@ void arcmt::writeARCDiagsToPlist(const std::string &outPath, FIDMap FM; SmallVector Fids; - for (llvm::ArrayRef::iterator + for (ArrayRef::iterator I = diags.begin(), E = diags.end(); I != E; ++I) { const StoredDiagnostic &D = *I; @@ -145,7 +145,7 @@ void arcmt::writeARCDiagsToPlist(const std::string &outPath, " diagnostics\n" " \n"; - for (llvm::ArrayRef::iterator + for (ArrayRef::iterator DI = diags.begin(), DE = diags.end(); DI != DE; ++DI) { const StoredDiagnostic &D = *DI; diff --git a/lib/ARCMigrate/TransformActions.cpp b/lib/ARCMigrate/TransformActions.cpp index f521358c8e..ca72aab294 100644 --- a/lib/ARCMigrate/TransformActions.cpp +++ b/lib/ARCMigrate/TransformActions.cpp @@ -140,7 +140,7 @@ class TransformActionsImpl { void increaseIndentation(SourceRange range, SourceLocation parentIndent); - bool clearDiagnostic(llvm::ArrayRef IDs, SourceRange range); + bool clearDiagnostic(ArrayRef IDs, SourceRange range); void applyRewrites(TransformActions::RewriteReceiver &receiver); @@ -159,7 +159,7 @@ class TransformActionsImpl { void commitReplaceText(SourceLocation loc, StringRef text, StringRef replacementText); void commitIncreaseIndentation(SourceRange range,SourceLocation parentIndent); - void commitClearDiagnostic(llvm::ArrayRef IDs, SourceRange range); + void commitClearDiagnostic(ArrayRef IDs, SourceRange range); void addRemoval(CharSourceRange range); void addInsertion(SourceLocation loc, StringRef text); @@ -362,7 +362,7 @@ void TransformActionsImpl::increaseIndentation(SourceRange range, CachedActions.push_back(data); } -bool TransformActionsImpl::clearDiagnostic(llvm::ArrayRef IDs, +bool TransformActionsImpl::clearDiagnostic(ArrayRef IDs, SourceRange range) { assert(IsInTransaction && "Actions only allowed during a transaction"); if (!CapturedDiags.hasDiagnostic(IDs, range)) @@ -494,7 +494,7 @@ void TransformActionsImpl::commitIncreaseIndentation(SourceRange range, SM.getInstantiationLoc(parentIndent))); } -void TransformActionsImpl::commitClearDiagnostic(llvm::ArrayRef IDs, +void TransformActionsImpl::commitClearDiagnostic(ArrayRef IDs, SourceRange range) { CapturedDiags.clearDiagnostic(IDs, range); } @@ -661,7 +661,7 @@ void TransformActions::increaseIndentation(SourceRange range, parentIndent); } -bool TransformActions::clearDiagnostic(llvm::ArrayRef IDs, +bool TransformActions::clearDiagnostic(ArrayRef IDs, SourceRange range) { return static_cast(Impl)->clearDiagnostic(IDs, range); } diff --git a/lib/Basic/Diagnostic.cpp b/lib/Basic/Diagnostic.cpp index 48dad6f2e0..38dadce989 100644 --- a/lib/Basic/Diagnostic.cpp +++ b/lib/Basic/Diagnostic.cpp @@ -728,8 +728,8 @@ StoredDiagnostic::StoredDiagnostic(Diagnostic::Level Level, StoredDiagnostic::StoredDiagnostic(Diagnostic::Level Level, unsigned ID, StringRef Message, FullSourceLoc Loc, - llvm::ArrayRef Ranges, - llvm::ArrayRef Fixits) + ArrayRef Ranges, + ArrayRef Fixits) : ID(ID), Level(Level), Loc(Loc), Message(Message) { this->Ranges.assign(Ranges.begin(), Ranges.end()); diff --git a/lib/CodeGen/CGCall.cpp b/lib/CodeGen/CGCall.cpp index d13fd017cd..3e5b431c2e 100644 --- a/lib/CodeGen/CGCall.cpp +++ b/lib/CodeGen/CGCall.cpp @@ -1431,7 +1431,7 @@ void CodeGenFunction::EmitCallArg(CallArgList &args, const Expr *E, /// on the current state of the EH stack. llvm::CallSite CodeGenFunction::EmitCallOrInvoke(llvm::Value *Callee, - llvm::ArrayRef Args, + ArrayRef Args, const Twine &Name) { llvm::BasicBlock *InvokeDest = getInvokeDest(); if (!InvokeDest) @@ -1447,7 +1447,7 @@ CodeGenFunction::EmitCallOrInvoke(llvm::Value *Callee, llvm::CallSite CodeGenFunction::EmitCallOrInvoke(llvm::Value *Callee, const Twine &Name) { - return EmitCallOrInvoke(Callee, llvm::ArrayRef(), Name); + return EmitCallOrInvoke(Callee, ArrayRef(), Name); } static void checkArgMatches(llvm::Value *Elt, unsigned &ArgNo, diff --git a/lib/CodeGen/CodeGenFunction.h b/lib/CodeGen/CodeGenFunction.h index 0a76e46077..42864ceb63 100644 --- a/lib/CodeGen/CodeGenFunction.h +++ b/lib/CodeGen/CodeGenFunction.h @@ -2074,7 +2074,7 @@ class CodeGenFunction : public CodeGenTypeCache { ReturnValueSlot ReturnValue = ReturnValueSlot()); llvm::CallSite EmitCallOrInvoke(llvm::Value *Callee, - llvm::ArrayRef Args, + ArrayRef Args, const Twine &Name = ""); llvm::CallSite EmitCallOrInvoke(llvm::Value *Callee, const Twine &Name = ""); diff --git a/lib/CodeGen/CodeGenModule.cpp b/lib/CodeGen/CodeGenModule.cpp index d22c0efef1..a4fce926ec 100644 --- a/lib/CodeGen/CodeGenModule.cpp +++ b/lib/CodeGen/CodeGenModule.cpp @@ -1625,7 +1625,7 @@ llvm::Value *CodeGenModule::getBuiltinLibFunction(const FunctionDecl *FD, } llvm::Function *CodeGenModule::getIntrinsic(unsigned IID, - llvm::ArrayRef Tys) { + ArrayRef Tys) { return llvm::Intrinsic::getDeclaration(&getModule(), (llvm::Intrinsic::ID)IID, Tys); } diff --git a/lib/CodeGen/CodeGenModule.h b/lib/CodeGen/CodeGenModule.h index e081caa7bf..2642df73fc 100644 --- a/lib/CodeGen/CodeGenModule.h +++ b/lib/CodeGen/CodeGenModule.h @@ -573,8 +573,8 @@ class CodeGenModule : public CodeGenTypeCache { llvm::Value *getBuiltinLibFunction(const FunctionDecl *FD, unsigned BuiltinID); - llvm::Function *getIntrinsic(unsigned IID, llvm::ArrayRef Tys = - llvm::ArrayRef()); + llvm::Function *getIntrinsic(unsigned IID, ArrayRef Tys = + ArrayRef()); /// EmitTopLevelDecl - Emit code for a single top level declaration. void EmitTopLevelDecl(Decl *D); diff --git a/lib/Driver/Driver.cpp b/lib/Driver/Driver.cpp index 7a0bb6aa79..014b9152c4 100644 --- a/lib/Driver/Driver.cpp +++ b/lib/Driver/Driver.cpp @@ -96,7 +96,7 @@ Driver::~Driver() { delete Host; } -InputArgList *Driver::ParseArgStrings(llvm::ArrayRef ArgList) { +InputArgList *Driver::ParseArgStrings(ArrayRef ArgList) { llvm::PrettyStackTraceString CrashInfo("Command line argument parsing"); unsigned MissingArgIndex, MissingArgCount; InputArgList *Args = getOpts().ParseArgs(ArgList.begin(), ArgList.end(), @@ -201,7 +201,7 @@ DerivedArgList *Driver::TranslateInputArgs(const InputArgList &Args) const { return DAL; } -Compilation *Driver::BuildCompilation(llvm::ArrayRef ArgList) { +Compilation *Driver::BuildCompilation(ArrayRef ArgList) { llvm::PrettyStackTraceString CrashInfo("Compilation construction"); // FIXME: Handle environment options which effect driver behavior, somewhere diff --git a/lib/Frontend/CreateInvocationFromCommandLine.cpp b/lib/Frontend/CreateInvocationFromCommandLine.cpp index fa34334b5d..8fdc06db72 100644 --- a/lib/Frontend/CreateInvocationFromCommandLine.cpp +++ b/lib/Frontend/CreateInvocationFromCommandLine.cpp @@ -29,7 +29,7 @@ using namespace clang; /// \return A CompilerInvocation, or 0 if none was built for the given /// argument vector. CompilerInvocation * -clang::createInvocationFromCommandLine(llvm::ArrayRef ArgList, +clang::createInvocationFromCommandLine(ArrayRef ArgList, llvm::IntrusiveRefCntPtr Diags) { if (!Diags.getPtr()) { // No diagnostics engine was provided, so create our own diagnostics object diff --git a/lib/Lex/PPMacroExpansion.cpp b/lib/Lex/PPMacroExpansion.cpp index 5d31b8cb45..d4fb28046a 100644 --- a/lib/Lex/PPMacroExpansion.cpp +++ b/lib/Lex/PPMacroExpansion.cpp @@ -497,7 +497,7 @@ MacroArgs *Preprocessor::ReadFunctionLikeMacroArgs(Token &MacroName, /// going to lex in the cache and when it finishes the tokens are removed /// from the end of the cache. Token *Preprocessor::cacheMacroExpandedTokens(TokenLexer *tokLexer, - llvm::ArrayRef tokens) { + ArrayRef tokens) { assert(tokLexer); if (tokens.empty()) return 0; diff --git a/lib/Sema/SemaStmt.cpp b/lib/Sema/SemaStmt.cpp index 3b46f1dc2f..c22555e4dd 100644 --- a/lib/Sema/SemaStmt.cpp +++ b/lib/Sema/SemaStmt.cpp @@ -1883,7 +1883,7 @@ static bool CheckAsmLValue(const Expr *E, Sema &S) { /// isOperandMentioned - Return true if the specified operand # is mentioned /// anywhere in the decomposed asm string. static bool isOperandMentioned(unsigned OpNo, - llvm::ArrayRef AsmStrPieces) { + ArrayRef AsmStrPieces) { for (unsigned p = 0, e = AsmStrPieces.size(); p != e; ++p) { const AsmStmt::AsmStringPiece &Piece = AsmStrPieces[p]; if (!Piece.isOperand()) continue; diff --git a/tools/arcmt-test/arcmt-test.cpp b/tools/arcmt-test/arcmt-test.cpp index edef415edb..7477f943ee 100644 --- a/tools/arcmt-test/arcmt-test.cpp +++ b/tools/arcmt-test/arcmt-test.cpp @@ -104,7 +104,7 @@ class PrintTransforms : public MigrationProcess::RewriteListener { } // anonymous namespace static bool checkForMigration(StringRef resourcesPath, - llvm::ArrayRef Args) { + ArrayRef Args) { DiagnosticClient *DiagClient = new TextDiagnosticPrinter(llvm::errs(), DiagnosticOptions()); llvm::IntrusiveRefCntPtr DiagID(new DiagnosticIDs()); @@ -146,7 +146,7 @@ static void printResult(FileRemapper &remapper, raw_ostream &OS) { } static bool performTransformations(StringRef resourcesPath, - llvm::ArrayRef Args) { + ArrayRef Args) { // Check first. if (checkForMigration(resourcesPath, Args)) return true; @@ -215,7 +215,7 @@ static bool filesCompareEqual(StringRef fname1, StringRef fname2) { return file1->getBuffer() == file2->getBuffer(); } -static bool verifyTransformedFiles(llvm::ArrayRef resultFiles) { +static bool verifyTransformedFiles(ArrayRef resultFiles) { using namespace llvm; assert(!resultFiles.empty()); @@ -364,7 +364,7 @@ int main(int argc, const char **argv) { return 1; } - llvm::ArrayRef Args(argv+optargc+1, argc-optargc-1); + ArrayRef Args(argv+optargc+1, argc-optargc-1); if (CheckOnly) return checkForMigration(resourcesPath, Args);