[cfe-commits] r38787 - /cfe/cfe/trunk/Lex/MacroExpander.cpp

sabre at cs.uiuc.edu sabre at cs.uiuc.edu
Wed Jul 11 09:24:37 PDT 2007


Author: sabre
Date: Wed Jul 11 11:24:37 2007
New Revision: 38787

URL: http://llvm.org/viewvc/llvm-project?rev=38787&view=rev
Log:
Fix a crash on Preprocessor/macro_paste_none.c

Modified:
    cfe/cfe/trunk/Lex/MacroExpander.cpp

Modified: cfe/cfe/trunk/Lex/MacroExpander.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/Lex/MacroExpander.cpp?rev=38787&r1=38786&r2=38787&view=diff

==============================================================================
--- cfe/cfe/trunk/Lex/MacroExpander.cpp (original)
+++ cfe/cfe/trunk/Lex/MacroExpander.cpp Wed Jul 11 11:24:37 2007
@@ -447,7 +447,8 @@
     // This is deleted in the dtor.
     NumMacroTokens = ResultToks.size();
     LexerToken *Res = new LexerToken[ResultToks.size()];
-    memcpy(Res, &ResultToks[0], NumMacroTokens*sizeof(LexerToken));
+    if (NumMacroTokens)
+      memcpy(Res, &ResultToks[0], NumMacroTokens*sizeof(LexerToken));
     MacroTokens = Res;
   }
 }





More information about the cfe-commits mailing list