r240463 - Improve error handling for PR22560.
Bob Wilson
bob.wilson at apple.com
Tue Jun 23 14:10:24 PDT 2015
Author: bwilson
Date: Tue Jun 23 16:10:24 2015
New Revision: 240463
URL: http://llvm.org/viewvc/llvm-project?rev=240463&view=rev
Log:
Improve error handling for PR22560.
The ARM _MoveToCoprocessor and _MoveFromCoprocessor builtins require
integer constants for most arguments, but clang was not checking that.
With this change, we now report meaningful errors instead of crashing
in the backend.
Added:
cfe/trunk/test/Sema/arm-microsoft-intrinsics.c
Modified:
cfe/trunk/include/clang/Basic/BuiltinsARM.def
Modified: cfe/trunk/include/clang/Basic/BuiltinsARM.def
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/BuiltinsARM.def?rev=240463&r1=240462&r2=240463&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/BuiltinsARM.def (original)
+++ cfe/trunk/include/clang/Basic/BuiltinsARM.def Tue Jun 23 16:10:24 2015
@@ -105,10 +105,10 @@ LANGBUILTIN(__dmb, "vUi", "nc", ALL_MS_L
LANGBUILTIN(__dsb, "vUi", "nc", ALL_MS_LANGUAGES)
LANGBUILTIN(__isb, "vUi", "nc", ALL_MS_LANGUAGES)
LANGBUILTIN(__ldrexd, "WiWiCD*", "", ALL_MS_LANGUAGES)
-LANGBUILTIN(_MoveFromCoprocessor, "UiUiUiUiUiUi", "", ALL_MS_LANGUAGES)
-LANGBUILTIN(_MoveFromCoprocessor2, "UiUiUiUiUiUi", "", ALL_MS_LANGUAGES)
-LANGBUILTIN(_MoveToCoprocessor, "vUiUiUiUiUiUi", "", ALL_MS_LANGUAGES)
-LANGBUILTIN(_MoveToCoprocessor2, "vUiUiUiUiUiUi", "", ALL_MS_LANGUAGES)
+LANGBUILTIN(_MoveFromCoprocessor, "UiIUiIUiIUiIUiIUi", "", ALL_MS_LANGUAGES)
+LANGBUILTIN(_MoveFromCoprocessor2, "UiIUiIUiIUiIUiIUi", "", ALL_MS_LANGUAGES)
+LANGBUILTIN(_MoveToCoprocessor, "vUiIUiIUiIUiIUiIUi", "", ALL_MS_LANGUAGES)
+LANGBUILTIN(_MoveToCoprocessor2, "vUiIUiIUiIUiIUiIUi", "", ALL_MS_LANGUAGES)
#undef BUILTIN
#undef LANGBUILTIN
Added: cfe/trunk/test/Sema/arm-microsoft-intrinsics.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/arm-microsoft-intrinsics.c?rev=240463&view=auto
==============================================================================
--- cfe/trunk/test/Sema/arm-microsoft-intrinsics.c (added)
+++ cfe/trunk/test/Sema/arm-microsoft-intrinsics.c Tue Jun 23 16:10:24 2015
@@ -0,0 +1,9 @@
+// RUN: %clang_cc1 -triple armv7 -fms-extensions -fsyntax-only -ffreestanding -verify %s
+
+unsigned int test_MoveFromCoprocessor(const unsigned int value) {
+ return _MoveFromCoprocessor(value, 1, 2, 3, 4); // expected-error-re {{argument to {{.*}} must be a constant integer}}
+}
+
+void test_MoveToCoprocessor(const unsigned int value) {
+ _MoveToCoprocessor(1, 2, value, 3, 4, 5); // expected-error-re {{argument to {{.*}} must be a constant integer}}
+}
More information about the cfe-commits
mailing list