From: Kovarththanan Rajaratnam Date: Thu, 7 Jan 2010 18:11:14 +0000 (+0000) Subject: Convert from char pointer to char array X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7d0eed6ed767afc5d849144915ef42a3108d473c;p=clang Convert from char pointer to char array git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92923 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Frontend/InitPreprocessor.cpp b/lib/Frontend/InitPreprocessor.cpp index e5c6ed0d99..3ec408a24f 100644 --- a/lib/Frontend/InitPreprocessor.cpp +++ b/lib/Frontend/InitPreprocessor.cpp @@ -30,7 +30,7 @@ using namespace clang; // "#define XXX Y z W". To get a #define with no value, use "XXX=". static void DefineBuiltinMacro(std::vector &Buf, const char *Macro, Diagnostic *Diags = 0) { - const char *Command = "#define "; + const char Command[] = "#define "; Buf.insert(Buf.end(), Command, Command+strlen(Command)); if (const char *Equal = strchr(Macro, '=')) { // Turn the = into ' '. @@ -61,7 +61,7 @@ static void DefineBuiltinMacro(std::vector &Buf, const char *Macro, // and we emit "#undef XXX". static void UndefineBuiltinMacro(std::vector &Buf, const char *Macro) { // Push "macroname". - const char *Command = "#undef "; + const char Command[] = "#undef "; Buf.insert(Buf.end(), Command, Command+strlen(Command)); Buf.insert(Buf.end(), Macro, Macro+strlen(Macro)); Buf.push_back('\n'); @@ -98,16 +98,16 @@ static void AddQuotedIncludePath(std::vector &Buf, /// predefines buffer. static void AddImplicitInclude(std::vector &Buf, const std::string &File) { - const char *Inc = "#include "; - Buf.insert(Buf.end(), Inc, Inc+strlen(Inc)); + const char Command[] = "#include "; + Buf.insert(Buf.end(), Command, Command+strlen(Command)); AddQuotedIncludePath(Buf, File); Buf.push_back('\n'); } static void AddImplicitIncludeMacros(std::vector &Buf, const std::string &File) { - const char *Inc = "#__include_macros "; - Buf.insert(Buf.end(), Inc, Inc+strlen(Inc)); + const char Command[] = "#__include_macros "; + Buf.insert(Buf.end(), Command, Command+strlen(Command)); AddQuotedIncludePath(Buf, File); Buf.push_back('\n'); // Marker token to stop the __include_macros fetch loop.