diff options
author | Saleem Abdulrasool <compnerd@compnerd.org> | 2014-05-08 02:28:32 +0000 |
---|---|---|
committer | Saleem Abdulrasool <compnerd@compnerd.org> | 2014-05-08 02:28:32 +0000 |
commit | 62849c677c06828f80fd2a5691b2569983785101 (patch) | |
tree | 72db51e51f2c67bc3d843eb2a57bc89d354912ee /clang/test/Driver/code-model.c | |
parent | 2ff4948035352c6c78cefec1da1c317bcffd3a21 (diff) | |
download | bcm5719-llvm-62849c677c06828f80fd2a5691b2569983785101.tar.gz bcm5719-llvm-62849c677c06828f80fd2a5691b2569983785101.zip |
Driver: parse -mcmodel earlier
This addresses an existing FIXME item in the driver. The code model flag was
parsed in the actual tool rather than in the driver. This was problematic since
the value may be invalid. In that case, we would silently treat it as a default
value in non-assert builds, and abort in assert builds. Add a check in the
driver to validate that the value being passed is valid, and if not provide a
proper error message.
llvm-svn: 208275
Diffstat (limited to 'clang/test/Driver/code-model.c')
-rw-r--r-- | clang/test/Driver/code-model.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/clang/test/Driver/code-model.c b/clang/test/Driver/code-model.c new file mode 100644 index 00000000000..001ca606cde --- /dev/null +++ b/clang/test/Driver/code-model.c @@ -0,0 +1,13 @@ +// RUN: %clang -### -c -mcmodel=small %s 2>&1 | FileCheck -check-prefix CHECK-SMALL %s +// RUN: %clang -### -S -mcmodel=kernel %s 2>&1 | FileCheck -check-prefix CHECK-KERNEL %s +// RUN: %clang -### -c -mcmodel=medium %s 2>&1 | FileCheck -check-prefix CHECK-MEDIUM %s +// RUN: %clang -### -S -mcmodel=large %s 2>&1 | FileCheck -check-prefix CHECK-LARGE %s +// RUN: not %clang -c -mcmodel=lager %s 2>&1 | FileCheck -check-prefix CHECK-INVALID %s + +// CHECK-SMALL: "-mcode-model" "small" +// CHECK-KERNEL: "-mcode-model" "kernel" +// CHECK-MEDIUM: "-mcode-model" "medium" +// CHECK-LARGE: "-mcode-model" "large" + +// CHECK-INVALID: error: invalid value 'lager' in '-mcode-model lager' + |