aboutsummaryrefslogtreecommitdiff
path: root/Lex/Preprocessor.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2007-07-13 17:10:38 +0000
committerChris Lattner <sabre@nondot.org>2007-07-13 17:10:38 +0000
commitc35717a1b34269fc5d78226b1624f53e1c073ed6 (patch)
tree2ff91140e845d7a09b8c149ce08844a0bedd8a8b /Lex/Preprocessor.cpp
parent49b4526992a8c8a6a290aa3efa9828154a24af8d (diff)
remove use of alloca.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@39815 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'Lex/Preprocessor.cpp')
-rw-r--r--Lex/Preprocessor.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/Lex/Preprocessor.cpp b/Lex/Preprocessor.cpp
index 9c2683315f..d18a2f9813 100644
--- a/Lex/Preprocessor.cpp
+++ b/Lex/Preprocessor.cpp
@@ -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);
}