[cfe-commits] r162302 - in /cfe/trunk/lib: Lex/Pragma.cpp Parse/ParseDecl.cpp

David Blaikie dblaikie at gmail.com
Tue Aug 21 11:56:49 PDT 2012


Author: dblaikie
Date: Tue Aug 21 13:56:49 2012
New Revision: 162302

URL: http://llvm.org/viewvc/llvm-project?rev=162302&view=rev
Log:
Use LLVM_BUILTIN_TRAP instead of lame volatile int traps.

(from a todo mentioned in r159469 & originally suggested by Chandler Carruth)

Modified:
    cfe/trunk/lib/Lex/Pragma.cpp
    cfe/trunk/lib/Parse/ParseDecl.cpp

Modified: cfe/trunk/lib/Lex/Pragma.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/Pragma.cpp?rev=162302&r1=162301&r2=162302&view=diff
==============================================================================
--- cfe/trunk/lib/Lex/Pragma.cpp (original)
+++ cfe/trunk/lib/Lex/Pragma.cpp Tue Aug 21 13:56:49 2012
@@ -1009,7 +1009,7 @@
     if (II->isStr("assert")) {
       llvm_unreachable("This is an assertion!");
     } else if (II->isStr("crash")) {
-      *(volatile int*) 0x11 = 0;
+      LLVM_BUILTIN_TRAP;
     } else if (II->isStr("parser_crash")) {
       Token Crasher;
       Crasher.setKind(tok::annot_pragma_parser_crash);

Modified: cfe/trunk/lib/Parse/ParseDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseDecl.cpp?rev=162302&r1=162301&r2=162302&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseDecl.cpp (original)
+++ cfe/trunk/lib/Parse/ParseDecl.cpp Tue Aug 21 13:56:49 2012
@@ -4351,7 +4351,7 @@
     D.SetIdentifier(0, Tok.getLocation());
   } else {
     if (Tok.getKind() == tok::annot_pragma_parser_crash)
-      *(volatile int*) 0x11 = 0;
+      LLVM_BUILTIN_TRAP;
     if (D.getContext() == Declarator::MemberContext)
       Diag(Tok, diag::err_expected_member_name_or_semi)
         << D.getDeclSpec().getSourceRange();





More information about the cfe-commits mailing list