Re-applying the target data layout verification patch from r142288, plus appropriate CMake dependencies.

Thanks to Raphael Espindola for tracking down the CMake issues.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142306 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Lang Hames
2011-10-17 23:24:48 +00:00
parent ea46110f57
commit 5fa792e65a
4 changed files with 116 additions and 38 deletions

View File

@ -24,6 +24,7 @@
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Target/TargetData.h"
using namespace llvm;
static std::string getTypeString(Type *T) {
@ -260,9 +261,14 @@ bool LLParser::ParseTargetDefinition() {
return false;
case lltok::kw_datalayout:
Lex.Lex();
LocTy SpecifierLoc = Lex.getLoc();
if (ParseToken(lltok::equal, "expected '=' after target datalayout") ||
ParseStringConstant(Str))
return true;
std::string errMsg = TargetData::parseSpecifier(Str);
if (errMsg != "") {
return Error(SpecifierLoc, errMsg);
}
M->setDataLayout(Str);
return false;
}