[cfe-commits] r161520 - in /cfe/trunk: lib/Sema/SemaStmt.cpp test/CodeGen/ms-inline-asm.c
Chad Rosier
mcrosier at apple.com
Wed Aug 8 13:37:31 PDT 2012
Author: mcrosier
Date: Wed Aug 8 15:37:31 2012
New Revision: 161520
URL: http://llvm.org/viewvc/llvm-project?rev=161520&view=rev
Log:
[ms-inline asm] Add a very simple test case. Basically, we're only testing for
crashers at the moment (and coincidentally this case was causing a crash).
Added:
cfe/trunk/test/CodeGen/ms-inline-asm.c
Modified:
cfe/trunk/lib/Sema/SemaStmt.cpp
Modified: cfe/trunk/lib/Sema/SemaStmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaStmt.cpp?rev=161520&r1=161519&r2=161520&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaStmt.cpp (original)
+++ cfe/trunk/lib/Sema/SemaStmt.cpp Wed Aug 8 15:37:31 2012
@@ -2786,6 +2786,9 @@
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 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;
Added: cfe/trunk/test/CodeGen/ms-inline-asm.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/ms-inline-asm.c?rev=161520&view=auto
==============================================================================
--- cfe/trunk/test/CodeGen/ms-inline-asm.c (added)
+++ cfe/trunk/test/CodeGen/ms-inline-asm.c Wed Aug 8 15:37:31 2012
@@ -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 {}
+}
More information about the cfe-commits
mailing list