diff options
author | Axel Naumann <Axel.Naumann@cern.ch> | 2010-10-11 09:18:43 +0000 |
---|---|---|
committer | Axel Naumann <Axel.Naumann@cern.ch> | 2010-10-11 09:18:43 +0000 |
commit | b151c3c2d637d9f6c3e7342c5dba5993d1d195c1 (patch) | |
tree | 662f5f5929657057f49712967236d107381eaefc | |
parent | 89c31490d8896dbb6a9794de28a874a84268f541 (diff) | |
download | bcm5719-llvm-b151c3c2d637d9f6c3e7342c5dba5993d1d195c1.tar.gz bcm5719-llvm-b151c3c2d637d9f6c3e7342c5dba5993d1d195c1.zip |
Declare argv parameters as const char* const* instead of to char** to clarify that they are not modified, and to allow for string literals as arguments.
llvm-svn: 116200
-rw-r--r-- | clang/include/clang/Driver/ArgList.h | 2 | ||||
-rw-r--r-- | clang/include/clang/Driver/OptTable.h | 4 | ||||
-rw-r--r-- | clang/include/clang/Frontend/CompilerInvocation.h | 6 | ||||
-rw-r--r-- | clang/lib/Driver/ArgList.cpp | 3 | ||||
-rw-r--r-- | clang/lib/Driver/OptTable.cpp | 3 | ||||
-rw-r--r-- | clang/lib/Frontend/CompilerInvocation.cpp | 4 |
6 files changed, 13 insertions, 9 deletions
diff --git a/clang/include/clang/Driver/ArgList.h b/clang/include/clang/Driver/ArgList.h index 257b653f57e..0fcf821c752 100644 --- a/clang/include/clang/Driver/ArgList.h +++ b/clang/include/clang/Driver/ArgList.h @@ -288,7 +288,7 @@ namespace driver { unsigned NumInputArgStrings; public: - InputArgList(const char **ArgBegin, const char **ArgEnd); + InputArgList(const char* const *ArgBegin, const char* const *ArgEnd); ~InputArgList(); virtual const char *getArgString(unsigned Index) const { diff --git a/clang/include/clang/Driver/OptTable.h b/clang/include/clang/Driver/OptTable.h index 08b483c9001..3befe1defba 100644 --- a/clang/include/clang/Driver/OptTable.h +++ b/clang/include/clang/Driver/OptTable.h @@ -170,8 +170,8 @@ namespace options { /// \param MissingArgCount - On error, the number of missing options. /// \return - An InputArgList; on error this will contain all the options /// which could be parsed. - InputArgList *ParseArgs(const char **ArgBegin, - const char **ArgEnd, + InputArgList *ParseArgs(const char* const *ArgBegin, + const char* const *ArgEnd, unsigned &MissingArgIndex, unsigned &MissingArgCount) const; diff --git a/clang/include/clang/Frontend/CompilerInvocation.h b/clang/include/clang/Frontend/CompilerInvocation.h index d558ad39140..aef02448f09 100644 --- a/clang/include/clang/Frontend/CompilerInvocation.h +++ b/clang/include/clang/Frontend/CompilerInvocation.h @@ -83,8 +83,10 @@ public: /// \param ArgBegin - The first element in the argument vector. /// \param ArgEnd - The last element in the argument vector. /// \param Diags - The diagnostic engine to use for errors. - static void CreateFromArgs(CompilerInvocation &Res, const char **ArgBegin, - const char **ArgEnd, Diagnostic &Diags); + static void CreateFromArgs(CompilerInvocation &Res, + const char* const *ArgBegin, + const char* const *ArgEnd, + Diagnostic &Diags); /// GetBuiltinIncludePath - Get the directory where the compiler headers /// reside, relative to the compiler binary (found by the passed in diff --git a/clang/lib/Driver/ArgList.cpp b/clang/lib/Driver/ArgList.cpp index 91015237671..e26318863db 100644 --- a/clang/lib/Driver/ArgList.cpp +++ b/clang/lib/Driver/ArgList.cpp @@ -214,7 +214,8 @@ const char *ArgList::GetOrMakeJoinedArgString(unsigned Index, // -InputArgList::InputArgList(const char **ArgBegin, const char **ArgEnd) +InputArgList::InputArgList(const char* const *ArgBegin, + const char* const *ArgEnd) : NumInputArgStrings(ArgEnd - ArgBegin) { ArgStrings.append(ArgBegin, ArgEnd); } diff --git a/clang/lib/Driver/OptTable.cpp b/clang/lib/Driver/OptTable.cpp index 3c363142d7f..d919c661d7d 100644 --- a/clang/lib/Driver/OptTable.cpp +++ b/clang/lib/Driver/OptTable.cpp @@ -226,7 +226,8 @@ Arg *OptTable::ParseOneArg(const ArgList &Args, unsigned &Index) const { return new Arg(TheUnknownOption, Index++, Str); } -InputArgList *OptTable::ParseArgs(const char **ArgBegin, const char **ArgEnd, +InputArgList *OptTable::ParseArgs(const char* const *ArgBegin, + const char* const *ArgEnd, unsigned &MissingArgIndex, unsigned &MissingArgCount) const { InputArgList *Args = new InputArgList(ArgBegin, ArgEnd); diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp index 927c6a441ff..942bc0d5e66 100644 --- a/clang/lib/Frontend/CompilerInvocation.cpp +++ b/clang/lib/Frontend/CompilerInvocation.cpp @@ -1508,8 +1508,8 @@ static void ParseTargetArgs(TargetOptions &Opts, ArgList &Args) { // void CompilerInvocation::CreateFromArgs(CompilerInvocation &Res, - const char **ArgBegin, - const char **ArgEnd, + const char* const *ArgBegin, + const char* const *ArgEnd, Diagnostic &Diags) { // Parse the arguments. llvm::OwningPtr<OptTable> Opts(createCC1OptTable()); |