forked from OSchip/llvm-project
Emit error unsupported when asm string conversion fails instead of
assert. llvm-svn: 57721
This commit is contained in:
parent
94169f1021
commit
1e75408d89
|
@ -624,7 +624,9 @@ void CodeGenFunction::EmitSwitchStmt(const SwitchStmt &S) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static std::string ConvertAsmString(const char *Start, unsigned NumOperands,
|
static std::string ConvertAsmString(const char *Start, unsigned NumOperands,
|
||||||
bool IsSimple) {
|
bool IsSimple, bool &Failed) {
|
||||||
|
Failed = false;
|
||||||
|
|
||||||
static unsigned AsmCounter = 0;
|
static unsigned AsmCounter = 0;
|
||||||
AsmCounter++;
|
AsmCounter++;
|
||||||
std::string Result;
|
std::string Result;
|
||||||
|
@ -696,7 +698,8 @@ static std::string ConvertAsmString(const char *Start, unsigned NumOperands,
|
||||||
Result += "${" + llvm::utostr(n) + ':' + EscapedChar + '}';
|
Result += "${" + llvm::utostr(n) + ':' + EscapedChar + '}';
|
||||||
Start = End - 1;
|
Start = End - 1;
|
||||||
} else {
|
} else {
|
||||||
assert(0 && "Unhandled asm escaped character!");
|
Failed = true;
|
||||||
|
return "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Start++;
|
Start++;
|
||||||
|
@ -731,10 +734,17 @@ static std::string SimplifyConstraint(const char* Constraint,
|
||||||
}
|
}
|
||||||
|
|
||||||
void CodeGenFunction::EmitAsmStmt(const AsmStmt &S) {
|
void CodeGenFunction::EmitAsmStmt(const AsmStmt &S) {
|
||||||
|
bool Failed;
|
||||||
std::string AsmString =
|
std::string AsmString =
|
||||||
ConvertAsmString(std::string(S.getAsmString()->getStrData(),
|
ConvertAsmString(std::string(S.getAsmString()->getStrData(),
|
||||||
S.getAsmString()->getByteLength()).c_str(),
|
S.getAsmString()->getByteLength()).c_str(),
|
||||||
S.getNumOutputs() + S.getNumInputs(), S.isSimple());
|
S.getNumOutputs() + S.getNumInputs(), S.isSimple(),
|
||||||
|
Failed);
|
||||||
|
|
||||||
|
if (Failed) {
|
||||||
|
ErrorUnsupported(&S, "asm string");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
std::string Constraints;
|
std::string Constraints;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue