diff options
author | Daniel Dunbar <daniel@zuster.org> | 2008-10-17 20:58:01 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2008-10-17 20:58:01 +0000 |
commit | 1e75408d8960a7e04b7cd605c96eb134f475c9fc (patch) | |
tree | fbefd04e78d17a1e368ac4d17fc841755e186214 | |
parent | 94169f102144c031a59184d8012971a5d6f3c846 (diff) | |
download | bcm5719-llvm-1e75408d8960a7e04b7cd605c96eb134f475c9fc.tar.gz bcm5719-llvm-1e75408d8960a7e04b7cd605c96eb134f475c9fc.zip |
Emit error unsupported when asm string conversion fails instead of
assert.
llvm-svn: 57721
-rw-r--r-- | clang/lib/CodeGen/CGStmt.cpp | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/clang/lib/CodeGen/CGStmt.cpp b/clang/lib/CodeGen/CGStmt.cpp index 20312de5bab..ece4aeeff89 100644 --- a/clang/lib/CodeGen/CGStmt.cpp +++ b/clang/lib/CodeGen/CGStmt.cpp @@ -624,7 +624,9 @@ void CodeGenFunction::EmitSwitchStmt(const SwitchStmt &S) { } static std::string ConvertAsmString(const char *Start, unsigned NumOperands, - bool IsSimple) { + bool IsSimple, bool &Failed) { + Failed = false; + static unsigned AsmCounter = 0; AsmCounter++; std::string Result; @@ -696,7 +698,8 @@ static std::string ConvertAsmString(const char *Start, unsigned NumOperands, Result += "${" + llvm::utostr(n) + ':' + EscapedChar + '}'; Start = End - 1; } else { - assert(0 && "Unhandled asm escaped character!"); + Failed = true; + return ""; } } Start++; @@ -731,10 +734,17 @@ static std::string SimplifyConstraint(const char* Constraint, } void CodeGenFunction::EmitAsmStmt(const AsmStmt &S) { + bool Failed; std::string AsmString = ConvertAsmString(std::string(S.getAsmString()->getStrData(), 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; |