[cfe-commits] r116200 - in /cfe/trunk: include/clang/Driver/ArgList.h include/clang/Driver/OptTable.h include/clang/Frontend/CompilerInvocation.h lib/Driver/ArgList.cpp lib/Driver/OptTable.cpp lib/Frontend/CompilerInvocation.cpp

Axel Naumann Axel.Naumann at cern.ch
Mon Oct 11 02:18:43 PDT 2010


Author: axel
Date: Mon Oct 11 04:18:43 2010
New Revision: 116200

URL: http://llvm.org/viewvc/llvm-project?rev=116200&view=rev
Log:
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.

Modified:
    cfe/trunk/include/clang/Driver/ArgList.h
    cfe/trunk/include/clang/Driver/OptTable.h
    cfe/trunk/include/clang/Frontend/CompilerInvocation.h
    cfe/trunk/lib/Driver/ArgList.cpp
    cfe/trunk/lib/Driver/OptTable.cpp
    cfe/trunk/lib/Frontend/CompilerInvocation.cpp

Modified: cfe/trunk/include/clang/Driver/ArgList.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/ArgList.h?rev=116200&r1=116199&r2=116200&view=diff
==============================================================================
--- cfe/trunk/include/clang/Driver/ArgList.h (original)
+++ cfe/trunk/include/clang/Driver/ArgList.h Mon Oct 11 04:18:43 2010
@@ -288,7 +288,7 @@
     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 {

Modified: cfe/trunk/include/clang/Driver/OptTable.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/OptTable.h?rev=116200&r1=116199&r2=116200&view=diff
==============================================================================
--- cfe/trunk/include/clang/Driver/OptTable.h (original)
+++ cfe/trunk/include/clang/Driver/OptTable.h Mon Oct 11 04:18:43 2010
@@ -170,8 +170,8 @@
     /// \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;
 

Modified: cfe/trunk/include/clang/Frontend/CompilerInvocation.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/CompilerInvocation.h?rev=116200&r1=116199&r2=116200&view=diff
==============================================================================
--- cfe/trunk/include/clang/Frontend/CompilerInvocation.h (original)
+++ cfe/trunk/include/clang/Frontend/CompilerInvocation.h Mon Oct 11 04:18:43 2010
@@ -83,8 +83,10 @@
   /// \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

Modified: cfe/trunk/lib/Driver/ArgList.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ArgList.cpp?rev=116200&r1=116199&r2=116200&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/ArgList.cpp (original)
+++ cfe/trunk/lib/Driver/ArgList.cpp Mon Oct 11 04:18:43 2010
@@ -214,7 +214,8 @@
 
 //
 
-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);
 }

Modified: cfe/trunk/lib/Driver/OptTable.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/OptTable.cpp?rev=116200&r1=116199&r2=116200&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/OptTable.cpp (original)
+++ cfe/trunk/lib/Driver/OptTable.cpp Mon Oct 11 04:18:43 2010
@@ -226,7 +226,8 @@
   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);

Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=116200&r1=116199&r2=116200&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original)
+++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Mon Oct 11 04:18:43 2010
@@ -1508,8 +1508,8 @@
 //
 
 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());





More information about the cfe-commits mailing list