[cfe-commits] r39815 - /cfe/trunk/Lex/Preprocessor.cpp
Chris Lattner
sabre at nondot.org
Fri Jul 13 10:10:39 PDT 2007
Author: lattner
Date: Fri Jul 13 12:10:38 2007
New Revision: 39815
URL: http://llvm.org/viewvc/llvm-project?rev=39815&view=rev
Log:
remove use of alloca.
Modified:
cfe/trunk/Lex/Preprocessor.cpp
Modified: cfe/trunk/Lex/Preprocessor.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Lex/Preprocessor.cpp?rev=39815&r1=39814&r2=39815&view=diff
==============================================================================
--- cfe/trunk/Lex/Preprocessor.cpp (original)
+++ cfe/trunk/Lex/Preprocessor.cpp Fri Jul 13 12:10:38 2007
@@ -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 @@
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);
}
More information about the cfe-commits
mailing list