aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAxel Naumann <Axel.Naumann@cern.ch>2010-10-11 09:18:43 +0000
committerAxel Naumann <Axel.Naumann@cern.ch>2010-10-11 09:18:43 +0000
commit9d520c5ae802fc175c61032b289ddd6968e6ddd2 (patch)
treef062bd3ea257e5721192251a590e8256217b95ab
parent7d0c4ccd65b4549283c55e4923602e234f3811c5 (diff)
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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116200 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/clang/Driver/ArgList.h2
-rw-r--r--include/clang/Driver/OptTable.h4
-rw-r--r--include/clang/Frontend/CompilerInvocation.h6
-rw-r--r--lib/Driver/ArgList.cpp3
-rw-r--r--lib/Driver/OptTable.cpp3
-rw-r--r--lib/Frontend/CompilerInvocation.cpp4
6 files changed, 13 insertions, 9 deletions
diff --git a/include/clang/Driver/ArgList.h b/include/clang/Driver/ArgList.h
index 257b653f57..0fcf821c75 100644
--- a/include/clang/Driver/ArgList.h
+++ b/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/include/clang/Driver/OptTable.h b/include/clang/Driver/OptTable.h
index 08b483c900..3befe1defb 100644
--- a/include/clang/Driver/OptTable.h
+++ b/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/include/clang/Frontend/CompilerInvocation.h b/include/clang/Frontend/CompilerInvocation.h
index d558ad3914..aef02448f0 100644
--- a/include/clang/Frontend/CompilerInvocation.h
+++ b/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/lib/Driver/ArgList.cpp b/lib/Driver/ArgList.cpp
index 9101523767..e26318863d 100644
--- a/lib/Driver/ArgList.cpp
+++ b/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/lib/Driver/OptTable.cpp b/lib/Driver/OptTable.cpp
index 3c363142d7..d919c661d7 100644
--- a/lib/Driver/OptTable.cpp
+++ b/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/lib/Frontend/CompilerInvocation.cpp b/lib/Frontend/CompilerInvocation.cpp
index 927c6a441f..942bc0d5e6 100644
--- a/lib/Frontend/CompilerInvocation.cpp
+++ b/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());