diff options
-rw-r--r-- | lib/Sema/SemaStmt.cpp | 6 | ||||
-rw-r--r-- | test/CodeGen/ms-inline-asm.c | 7 |
2 files changed, 13 insertions, 0 deletions
diff --git a/lib/Sema/SemaStmt.cpp b/lib/Sema/SemaStmt.cpp index a8a06a93fc..be90578163 100644 --- a/lib/Sema/SemaStmt.cpp +++ b/lib/Sema/SemaStmt.cpp @@ -2786,6 +2786,9 @@ static std::string PatchMSAsmString(Sema &SemaRef, bool &IsSimple, SourceLocation AsmLoc, ArrayRef<Token> AsmToks, const TargetInfo &TI) { + if (!AsmToks.size()) + return ""; + std::string Res; IdentifierInfo *II = AsmToks[0].getIdentifierInfo(); Res = II->getName().str(); @@ -2841,6 +2844,9 @@ static std::string PatchMSAsmString(Sema &SemaRef, bool &IsSimple, static std::string buildMSAsmString(Sema &SemaRef, ArrayRef<Token> AsmToks, ArrayRef<unsigned> LineEnds) { + if (!AsmToks.size()) + return ""; + // Collect the tokens into a string SmallString<512> Asm; SmallString<512> TokenBuf; diff --git a/test/CodeGen/ms-inline-asm.c b/test/CodeGen/ms-inline-asm.c new file mode 100644 index 0000000000..2d36bbca52 --- /dev/null +++ b/test/CodeGen/ms-inline-asm.c @@ -0,0 +1,7 @@ +// RUN: %clang_cc1 %s -triple x86_64-apple-darwin10 -O0 -fms-extensions -w -emit-llvm -o - | FileCheck %s + +void t1() { +// CHECK: @t1 +// CHECK: ret void + __asm {} +} |