From f9aba2c2b470fc0926eccc8fe6ae8c7a921908ff Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Fri, 13 Jul 2007 17:10:38 +0000 Subject: [PATCH] remove use of alloca. llvm-svn: 39815 --- clang/Lex/Preprocessor.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/clang/Lex/Preprocessor.cpp b/clang/Lex/Preprocessor.cpp index 9c2683315ffb..d18a2f981350 100644 --- a/clang/Lex/Preprocessor.cpp +++ b/clang/Lex/Preprocessor.cpp @@ -37,7 +37,6 @@ #include "clang/Basic/TargetInfo.h" #include "llvm/ADT/SmallVector.h" #include -#include using namespace clang; //===----------------------------------------------------------------------===// @@ -908,7 +907,9 @@ IdentifierInfo *Preprocessor::LookUpIdentifierInfo(LexerToken &Identifier, II = getIdentifierInfo(BufPtr, BufPtr+Identifier.getLength()); } else { // Cleaning needed, alloca a buffer, clean into it, then use the buffer. - const char *TmpBuf = (char*)alloca(Identifier.getLength()); + llvm::SmallVector IdentifierBuffer; + IdentifierBuffer.resize(Identifier.getLength()); + const char *TmpBuf = &IdentifierBuffer[0]; unsigned Size = getSpelling(Identifier, TmpBuf); II = getIdentifierInfo(TmpBuf, TmpBuf+Size); }