]> granicus.if.org Git - clang/commitdiff
remove use of alloca.
authorChris Lattner <sabre@nondot.org>
Fri, 13 Jul 2007 17:10:38 +0000 (17:10 +0000)
committerChris Lattner <sabre@nondot.org>
Fri, 13 Jul 2007 17:10:38 +0000 (17:10 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@39815 91177308-0d34-0410-b5e6-96231b3b80d8

Lex/Preprocessor.cpp

index 9c2683315ffb862e8b37b47348e67fcaea27dd32..d18a2f981350213d9633ad0e52724d69765e73d3 100644 (file)
@@ -37,7 +37,6 @@
 #include "clang/Basic/TargetInfo.h"
 #include "llvm/ADT/SmallVector.h"
 #include <iostream>
-#include <alloca.h>
 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<char, 64> IdentifierBuffer;
+    IdentifierBuffer.resize(Identifier.getLength());
+    const char *TmpBuf = &IdentifierBuffer[0];
     unsigned Size = getSpelling(Identifier, TmpBuf);
     II = getIdentifierInfo(TmpBuf, TmpBuf+Size);
   }