aboutsummaryrefslogtreecommitdiff
path: root/test/Frontend
diff options
context:
space:
mode:
Diffstat (limited to 'test/Frontend')
-rw-r--r--test/Frontend/Inputs/NextIncludes/rewrite-includes9.h1
-rw-r--r--test/Frontend/Inputs/SystemHeaderPrefix/with-header-guard.h3
-rw-r--r--test/Frontend/Inputs/resource_dir_with_cfi_blacklist/share/cfi_blacklist.txt0
-rw-r--r--test/Frontend/Inputs/rewrite-includes9.h3
-rw-r--r--test/Frontend/ast-codegen.c4
-rw-r--r--test/Frontend/backend-option.c4
-rw-r--r--test/Frontend/compiler-options-dump.cpp25
-rw-r--r--test/Frontend/dependency-gen-extradeps-phony.c10
-rw-r--r--test/Frontend/dependency-gen-symlink.c24
-rw-r--r--test/Frontend/dependency-gen.c2
-rw-r--r--test/Frontend/fixed_point.c399
-rw-r--r--test/Frontend/fixed_point_bit_widths.c196
-rw-r--r--test/Frontend/fixed_point_declarations.c113
-rw-r--r--test/Frontend/fixed_point_errors.c234
-rw-r--r--test/Frontend/fixed_point_errors.cpp14
-rw-r--r--test/Frontend/fixed_point_not_enabled.c21
-rw-r--r--test/Frontend/fixed_point_same_fbits.c28
-rw-r--r--test/Frontend/ftime-report-template-decl.cpp159
-rw-r--r--test/Frontend/gnu-mcount.c2
-rw-r--r--test/Frontend/nostdlib-for-asmpp.s5
-rw-r--r--test/Frontend/opencl.cl37
-rw-r--r--test/Frontend/print-header-includes.c24
-rw-r--r--test/Frontend/region-pragmas.c5
-rw-r--r--test/Frontend/rewrite-includes-messages.c2
-rw-r--r--test/Frontend/rewrite-includes.c34
-rw-r--r--test/Frontend/stdlang.c1
-rw-r--r--test/Frontend/unknown-arg.c9
-rw-r--r--test/Frontend/warning-stdlibcxx-darwin.cpp5
-rw-r--r--test/Frontend/windows-exceptions.cpp27
-rw-r--r--test/Frontend/x86-target-cpu.c3
30 files changed, 1358 insertions, 36 deletions
diff --git a/test/Frontend/Inputs/NextIncludes/rewrite-includes9.h b/test/Frontend/Inputs/NextIncludes/rewrite-includes9.h
new file mode 100644
index 000000000000..b074bd1a4468
--- /dev/null
+++ b/test/Frontend/Inputs/NextIncludes/rewrite-includes9.h
@@ -0,0 +1 @@
+included_line9
diff --git a/test/Frontend/Inputs/SystemHeaderPrefix/with-header-guard.h b/test/Frontend/Inputs/SystemHeaderPrefix/with-header-guard.h
new file mode 100644
index 000000000000..7e4b6697a8a7
--- /dev/null
+++ b/test/Frontend/Inputs/SystemHeaderPrefix/with-header-guard.h
@@ -0,0 +1,3 @@
+#ifndef HEADER_GUARD
+#define HEADER_GUARD
+#endif
diff --git a/test/Frontend/Inputs/resource_dir_with_cfi_blacklist/share/cfi_blacklist.txt b/test/Frontend/Inputs/resource_dir_with_cfi_blacklist/share/cfi_blacklist.txt
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/test/Frontend/Inputs/resource_dir_with_cfi_blacklist/share/cfi_blacklist.txt
diff --git a/test/Frontend/Inputs/rewrite-includes9.h b/test/Frontend/Inputs/rewrite-includes9.h
new file mode 100644
index 000000000000..ebd5ada97056
--- /dev/null
+++ b/test/Frontend/Inputs/rewrite-includes9.h
@@ -0,0 +1,3 @@
+#if __has_include_next(<rewrite-includes9.h>)
+#include_next <rewrite-includes9.h>
+#endif
diff --git a/test/Frontend/ast-codegen.c b/test/Frontend/ast-codegen.c
index 4a3f8a3b79fd..e1140fdd8b27 100644
--- a/test/Frontend/ast-codegen.c
+++ b/test/Frontend/ast-codegen.c
@@ -5,9 +5,9 @@
// CHECK: module asm "foo"
__asm__("foo");
-// CHECK: @g0 = common global i32 0, align 4
+// CHECK: @g0 = common dso_local global i32 0, align 4
int g0;
-// CHECK: define i32 @f0()
+// CHECK: define dso_local i32 @f0()
int f0() {
}
diff --git a/test/Frontend/backend-option.c b/test/Frontend/backend-option.c
deleted file mode 100644
index e17757422e4b..000000000000
--- a/test/Frontend/backend-option.c
+++ /dev/null
@@ -1,4 +0,0 @@
-// RUN: %clang_cc1 %s -emit-llvm -backend-option -time-passes -o - 2>&1 | FileCheck %s
-// RUN: %clang_cc1 %s -emit-llvm -backend-option -time-passes -o - -triple spir-unknown-unknown 2>&1 | FileCheck %s
-// CHECK: Pass execution timing report
-
diff --git a/test/Frontend/compiler-options-dump.cpp b/test/Frontend/compiler-options-dump.cpp
new file mode 100644
index 000000000000..daa8bb18549a
--- /dev/null
+++ b/test/Frontend/compiler-options-dump.cpp
@@ -0,0 +1,25 @@
+// RUN: %clang_cc1 -compiler-options-dump -std=c++03 %s -o - | FileCheck %s --check-prefix=CXX03
+// RUN: %clang_cc1 -compiler-options-dump -std=c++17 %s -o - | FileCheck %s --check-prefix=CXX17
+// RUN: %clang_cc1 -compiler-options-dump -std=c99 -x c %s -o - | FileCheck %s --check-prefix=C99
+
+// CXX03: "features"
+// CXX03: "cxx_auto_type" : false
+// CXX03: "cxx_range_for" : false
+// CXX03: "extensions"
+// CXX03: "cxx_range_for" : true
+
+// CXX17: "features"
+// CXX17: "cxx_auto_type" : true
+// CXX17: "cxx_range_for" : true
+// CXX17: "extensions"
+// CXX17: "cxx_range_for" : true
+
+// C99: "features"
+// C99: "c_alignas" : false
+// C99: "c_atomic" : false
+// C99: "cxx_auto_type" : false
+// C99: "cxx_range_for" : false
+// C99: "extensions"
+// C99: "c_alignas" : true
+// C99: "c_atomic" : true
+// C99: "cxx_range_for" : false
diff --git a/test/Frontend/dependency-gen-extradeps-phony.c b/test/Frontend/dependency-gen-extradeps-phony.c
new file mode 100644
index 000000000000..2d67a959ed85
--- /dev/null
+++ b/test/Frontend/dependency-gen-extradeps-phony.c
@@ -0,0 +1,10 @@
+// RUN: %clang -MM -MP -Xclang -fdepfile-entry=1.extra -Xclang -fdepfile-entry=2.extra -Xclang -fdepfile-entry=2.extra %s | \
+// RUN: FileCheck %s --implicit-check-not=.c:
+//
+// Verify that phony targets are only created for the extra dependency files,
+// and not the input file.
+
+// CHECK: dependency-gen-extradeps-phony.o: 1.extra 2.extra \
+// CHECK-NEXT: dependency-gen-extradeps-phony.c
+// CHECK: 1.extra:
+// CHECK: 2.extra:
diff --git a/test/Frontend/dependency-gen-symlink.c b/test/Frontend/dependency-gen-symlink.c
new file mode 100644
index 000000000000..2fa339ad2abf
--- /dev/null
+++ b/test/Frontend/dependency-gen-symlink.c
@@ -0,0 +1,24 @@
+// REQUIRES: shell
+
+// Basic test
+// RUN: rm -rf %t.dir
+// RUN: mkdir %t.dir
+// RUN: mkdir %t.dir/a
+// RUN: mkdir %t.dir/b
+// RUN: echo "#ifndef HEADER_A" > %t.dir/a/header.h
+// RUN: echo "#define HEADER_A" >> %t.dir/a/header.h
+// RUN: echo "#endif" >> %t.dir/a/header.h
+// RUN: ln -s %t.dir/a/header.h %t.dir/b/header.h
+
+// RUN: %clang_cc1 -dependency-file %t.dir/file.deps -MT %s.o %s -fsyntax-only -I %t.dir -isystem %S/Inputs/SystemHeaderPrefix
+// RUN: FileCheck -input-file=%t.dir/file.deps %s
+// CHECK: dependency-gen-symlink.c.o
+// CHECK: dependency-gen-symlink.c
+// CHECK: a/header.h
+// CHECK: b/header.h
+// CHECK-NOT: with-header-guard.h
+#include "a/header.h"
+#include "b/header.h"
+// System header shouldn't be included in dependencies.
+#include <with-header-guard.h>
+#include <with-header-guard.h>
diff --git a/test/Frontend/dependency-gen.c b/test/Frontend/dependency-gen.c
index e4b0feea16a9..cd222c5dfd9a 100644
--- a/test/Frontend/dependency-gen.c
+++ b/test/Frontend/dependency-gen.c
@@ -21,7 +21,7 @@
// RUN: %clang -MD -MF - %s -fsyntax-only -I ./ | FileCheck -check-prefix=CHECK-SIX %s
// CHECK-SIX: {{ }}x.h
// RUN: echo "fun:foo" > %t.blacklist
-// RUN: %clang -MD -MF - %s -fsyntax-only -fsanitize=cfi-vcall -flto -fvisibility=hidden -fsanitize-blacklist=%t.blacklist -I ./ | FileCheck -check-prefix=CHECK-SEVEN %s
+// RUN: %clang -MD -MF - %s -fsyntax-only -resource-dir=%S/Inputs/resource_dir_with_cfi_blacklist -fsanitize=cfi-vcall -flto -fvisibility=hidden -fsanitize-blacklist=%t.blacklist -I ./ | FileCheck -check-prefix=CHECK-SEVEN %s
// CHECK-SEVEN: .blacklist
// CHECK-SEVEN: {{ }}x.h
#ifndef INCLUDE_FLAG_TEST
diff --git a/test/Frontend/fixed_point.c b/test/Frontend/fixed_point.c
new file mode 100644
index 000000000000..3a67718fba8e
--- /dev/null
+++ b/test/Frontend/fixed_point.c
@@ -0,0 +1,399 @@
+// RUN: %clang_cc1 -x c -ffixed-point -ast-dump %s | FileCheck %s --strict-whitespace
+
+/* Various contexts where type _Accum can appear. */
+
+// Primary fixed point types
+signed short _Accum s_short_accum;
+signed _Accum s_accum;
+signed long _Accum s_long_accum;
+unsigned short _Accum u_short_accum;
+unsigned _Accum u_accum;
+unsigned long _Accum u_long_accum;
+signed short _Fract s_short_fract;
+signed _Fract s_fract;
+signed long _Fract s_long_fract;
+unsigned short _Fract u_short_fract;
+unsigned _Fract u_fract;
+unsigned long _Fract u_long_fract;
+
+// Aliased fixed point types
+short _Accum short_accum;
+_Accum accum;
+long _Accum long_accum;
+short _Fract short_fract;
+_Fract fract;
+long _Fract long_fract;
+
+// Saturated fixed point types
+_Sat signed short _Accum sat_s_short_accum;
+_Sat signed _Accum sat_s_accum;
+_Sat signed long _Accum sat_s_long_accum;
+_Sat unsigned short _Accum sat_u_short_accum;
+_Sat unsigned _Accum sat_u_accum;
+_Sat unsigned long _Accum sat_u_long_accum;
+_Sat signed short _Fract sat_s_short_fract;
+_Sat signed _Fract sat_s_fract;
+_Sat signed long _Fract sat_s_long_fract;
+_Sat unsigned short _Fract sat_u_short_fract;
+_Sat unsigned _Fract sat_u_fract;
+_Sat unsigned long _Fract sat_u_long_fract;
+
+// Aliased saturated fixed point types
+_Sat short _Accum sat_short_accum;
+_Sat _Accum sat_accum;
+_Sat long _Accum sat_long_accum;
+_Sat short _Fract sat_short_fract;
+_Sat _Fract sat_fract;
+_Sat long _Fract sat_long_fract;
+
+//CHECK: |-VarDecl {{.*}} s_short_accum 'short _Accum'
+//CHECK-NEXT: |-VarDecl {{.*}} s_accum '_Accum'
+//CHECK-NEXT: |-VarDecl {{.*}} s_long_accum 'long _Accum'
+//CHECK-NEXT: |-VarDecl {{.*}} u_short_accum 'unsigned short _Accum'
+//CHECK-NEXT: |-VarDecl {{.*}} u_accum 'unsigned _Accum'
+//CHECK-NEXT: |-VarDecl {{.*}} u_long_accum 'unsigned long _Accum'
+//CHECK-NEXT: |-VarDecl {{.*}} s_short_fract 'short _Fract'
+//CHECK-NEXT: |-VarDecl {{.*}} s_fract '_Fract'
+//CHECK-NEXT: |-VarDecl {{.*}} s_long_fract 'long _Fract'
+//CHECK-NEXT: |-VarDecl {{.*}} u_short_fract 'unsigned short _Fract'
+//CHECK-NEXT: |-VarDecl {{.*}} u_fract 'unsigned _Fract'
+//CHECK-NEXT: |-VarDecl {{.*}} u_long_fract 'unsigned long _Fract'
+//CHECK-NEXT: |-VarDecl {{.*}} short_accum 'short _Accum'
+//CHECK-NEXT: |-VarDecl {{.*}} accum '_Accum'
+//CHECK-NEXT: |-VarDecl {{.*}} long_accum 'long _Accum'
+//CHECK-NEXT: |-VarDecl {{.*}} short_fract 'short _Fract'
+//CHECK-NEXT: |-VarDecl {{.*}} fract '_Fract'
+//CHECK-NEXT: |-VarDecl {{.*}} long_fract 'long _Fract'
+//CHECK-NEXT: |-VarDecl {{.*}} sat_s_short_accum '_Sat short _Accum'
+//CHECK-NEXT: |-VarDecl {{.*}} sat_s_accum '_Sat _Accum'
+//CHECK-NEXT: |-VarDecl {{.*}} sat_s_long_accum '_Sat long _Accum'
+//CHECK-NEXT: |-VarDecl {{.*}} sat_u_short_accum '_Sat unsigned short _Accum'
+//CHECK-NEXT: |-VarDecl {{.*}} sat_u_accum '_Sat unsigned _Accum'
+//CHECK-NEXT: |-VarDecl {{.*}} sat_u_long_accum '_Sat unsigned long _Accum'
+//CHECK-NEXT: |-VarDecl {{.*}} sat_s_short_fract '_Sat short _Fract'
+//CHECK-NEXT: |-VarDecl {{.*}} sat_s_fract '_Sat _Fract'
+//CHECK-NEXT: |-VarDecl {{.*}} sat_s_long_fract '_Sat long _Fract'
+//CHECK-NEXT: |-VarDecl {{.*}} sat_u_short_fract '_Sat unsigned short _Fract'
+//CHECK-NEXT: |-VarDecl {{.*}} sat_u_fract '_Sat unsigned _Fract'
+//CHECK-NEXT: |-VarDecl {{.*}} sat_u_long_fract '_Sat unsigned long _Fract'
+//CHECK-NEXT: |-VarDecl {{.*}} sat_short_accum '_Sat short _Accum'
+//CHECK-NEXT: |-VarDecl {{.*}} sat_accum '_Sat _Accum'
+//CHECK-NEXT: |-VarDecl {{.*}} sat_long_accum '_Sat long _Accum'
+//CHECK-NEXT: |-VarDecl {{.*}} sat_short_fract '_Sat short _Fract'
+//CHECK-NEXT: |-VarDecl {{.*}} sat_fract '_Sat _Fract'
+//CHECK-NEXT: |-VarDecl {{.*}} sat_long_fract '_Sat long _Fract'
+
+#define MIX_TYPE_SPEC(SPEC, SIGN, SIZE, ID) \
+ SPEC SIGN SIZE _Accum ID; \
+ SIGN SPEC SIZE _Accum ID ## 2; \
+ SIGN SIZE SPEC _Accum ID ## 3; \
+ SIGN SIZE _Accum SPEC ID ## 4;
+
+/* Mixing fixed point types with other type specifiers */
+
+#define MIX_VOLATILE(SIGN, SIZE, ID) MIX_TYPE_SPEC(volatile, SIGN, SIZE, ID)
+#define MIX_ATOMIC(SIGN, SIZE, ID) MIX_TYPE_SPEC(_Atomic, SIGN, SIZE, ID)
+#define MIX_CONST(SIGN, SIZE, ID) MIX_TYPE_SPEC(const, SIGN, SIZE, ID)
+
+MIX_VOLATILE(signed, short, vol_s_short_accum)
+MIX_ATOMIC(signed, short, atm_s_short_accum)
+MIX_CONST(signed, short, const_s_short_accum)
+
+// CHECK-NEXT: |-VarDecl {{.*}} vol_s_short_accum 'volatile short _Accum'
+// CHECK-NEXT: |-VarDecl {{.*}} vol_s_short_accum2 'volatile short _Accum'
+// CHECK-NEXT: |-VarDecl {{.*}} vol_s_short_accum3 'volatile short _Accum'
+// CHECK-NEXT: |-VarDecl {{.*}} vol_s_short_accum4 'volatile short _Accum'
+
+// CHECK-NEXT: |-VarDecl {{.*}} atm_s_short_accum '_Atomic(short _Accum)'
+// CHECK-NEXT: |-VarDecl {{.*}} atm_s_short_accum2 '_Atomic(short _Accum)'
+// CHECK-NEXT: |-VarDecl {{.*}} atm_s_short_accum3 '_Atomic(short _Accum)'
+// CHECK-NEXT: |-VarDecl {{.*}} atm_s_short_accum4 '_Atomic(short _Accum)'
+
+// CHECK-NEXT: |-VarDecl {{.*}} const_s_short_accum 'const short _Accum'
+// CHECK-NEXT: |-VarDecl {{.*}} const_s_short_accum2 'const short _Accum'
+// CHECK-NEXT: |-VarDecl {{.*}} const_s_short_accum3 'const short _Accum'
+// CHECK-NEXT: |-VarDecl {{.*}} const_s_short_accum4 'const short _Accum'
+
+/* Typedefs */
+
+// Primary fixed point types
+typedef signed short _Accum SsA_t;
+typedef signed _Accum SA_t;
+typedef signed long _Accum SlA_t;
+typedef unsigned short _Accum UsA_t;
+typedef unsigned _Accum UA_t;
+typedef unsigned long _Accum UlA_t;
+typedef signed short _Fract SsF_t;
+typedef signed _Fract SF_t;
+typedef signed long _Fract SlF_t;
+typedef unsigned short _Fract UsF_t;
+typedef unsigned _Fract UF_t;
+typedef unsigned long _Fract UlF_t;
+
+// Aliased fixed point types
+typedef short _Accum sA_t;
+typedef _Accum A_t;
+typedef long _Accum lA_t;
+typedef short _Fract sF_t;
+typedef _Fract F_t;
+typedef long _Fract lF_t;
+
+// Saturated fixed point types
+typedef _Sat signed short _Accum SatSsA_t;
+typedef _Sat signed _Accum SatSA_t;
+typedef _Sat signed long _Accum SatSlA_t;
+typedef _Sat unsigned short _Accum SatUsA_t;
+typedef _Sat unsigned _Accum SatUA_t;
+typedef _Sat unsigned long _Accum SatUlA_t;
+typedef _Sat signed short _Fract SatSsF_t;
+typedef _Sat signed _Fract SatSF_t;
+typedef _Sat signed long _Fract SatSlF_t;
+typedef _Sat unsigned short _Fract SatUsF_t;
+typedef _Sat unsigned _Fract SatUF_t;
+typedef _Sat unsigned long _Fract SatUlF_t;
+
+// Aliased saturated fixed point types
+typedef _Sat short _Accum SatsA_t;
+typedef _Sat _Accum SatA_t;
+typedef _Sat long _Accum SatlA_t;
+typedef _Sat short _Fract SatsF_t;
+typedef _Sat _Fract SatF_t;
+typedef _Sat long _Fract SatlF_t;
+
+SsA_t SsA_type;
+SA_t SA_type;
+SlA_t SlA_type;
+UsA_t UsA_type;
+UA_t UA_type;
+UlA_t UlA_type;
+SsF_t SsF_type;
+SF_t SF_type;
+SlF_t SlF_type;
+UsF_t UsF_type;
+UF_t UF_type;
+UlF_t UlF_type;
+
+sA_t sA_type;
+A_t A_type;
+lA_t lA_type;
+sF_t sF_type;
+F_t F_type;
+lF_t lF_type;
+
+SatSsA_t SatSsA_type;
+SatSA_t SatSA_type;
+SatSlA_t SatSlA_type;
+SatUsA_t SatUsA_type;
+SatUA_t SatUA_type;
+SatUlA_t SatUlA_type;
+SatSsF_t SatSsF_type;
+SatSF_t SatSF_type;
+SatSlF_t SatSlF_type;
+SatUsF_t SatUsF_type;
+SatUF_t SatUF_type;
+SatUlF_t SatUlF_type;
+
+SatsA_t SatsA_type;
+SatA_t SatA_type;
+SatlA_t SatlA_type;
+SatsF_t SatsF_type;
+SatF_t SatF_type;
+SatlF_t SatlF_type;
+
+//CHECK: |-VarDecl {{.*}} SsA_type 'SsA_t':'short _Accum'
+//CHECK-NEXT: |-VarDecl {{.*}} SA_type 'SA_t':'_Accum'
+//CHECK-NEXT: |-VarDecl {{.*}} SlA_type 'SlA_t':'long _Accum'
+//CHECK-NEXT: |-VarDecl {{.*}} UsA_type 'UsA_t':'unsigned short _Accum'
+//CHECK-NEXT: |-VarDecl {{.*}} UA_type 'UA_t':'unsigned _Accum'
+//CHECK-NEXT: |-VarDecl {{.*}} UlA_type 'UlA_t':'unsigned long _Accum'
+//CHECK-NEXT: |-VarDecl {{.*}} SsF_type 'SsF_t':'short _Fract'
+//CHECK-NEXT: |-VarDecl {{.*}} SF_type 'SF_t':'_Fract'
+//CHECK-NEXT: |-VarDecl {{.*}} SlF_type 'SlF_t':'long _Fract'
+//CHECK-NEXT: |-VarDecl {{.*}} UsF_type 'UsF_t':'unsigned short _Fract'
+//CHECK-NEXT: |-VarDecl {{.*}} UF_type 'UF_t':'unsigned _Fract'
+//CHECK-NEXT: |-VarDecl {{.*}} UlF_type 'UlF_t':'unsigned long _Fract'
+//CHECK-NEXT: |-VarDecl {{.*}} sA_type 'sA_t':'short _Accum'
+//CHECK-NEXT: |-VarDecl {{.*}} A_type 'A_t':'_Accum'
+//CHECK-NEXT: |-VarDecl {{.*}} lA_type 'lA_t':'long _Accum'
+//CHECK-NEXT: |-VarDecl {{.*}} sF_type 'sF_t':'short _Fract'
+//CHECK-NEXT: |-VarDecl {{.*}} F_type 'F_t':'_Fract'
+//CHECK-NEXT: |-VarDecl {{.*}} lF_type 'lF_t':'long _Fract'
+
+//CHECK-NEXT: |-VarDecl {{.*}} SatSsA_type 'SatSsA_t':'_Sat short _Accum'
+//CHECK-NEXT: |-VarDecl {{.*}} SatSA_type 'SatSA_t':'_Sat _Accum'
+//CHECK-NEXT: |-VarDecl {{.*}} SatSlA_type 'SatSlA_t':'_Sat long _Accum'
+//CHECK-NEXT: |-VarDecl {{.*}} SatUsA_type 'SatUsA_t':'_Sat unsigned short _Accum'
+//CHECK-NEXT: |-VarDecl {{.*}} SatUA_type 'SatUA_t':'_Sat unsigned _Accum'
+//CHECK-NEXT: |-VarDecl {{.*}} SatUlA_type 'SatUlA_t':'_Sat unsigned long _Accum'
+//CHECK-NEXT: |-VarDecl {{.*}} SatSsF_type 'SatSsF_t':'_Sat short _Fract'
+//CHECK-NEXT: |-VarDecl {{.*}} SatSF_type 'SatSF_t':'_Sat _Fract'
+//CHECK-NEXT: |-VarDecl {{.*}} SatSlF_type 'SatSlF_t':'_Sat long _Fract'
+//CHECK-NEXT: |-VarDecl {{.*}} SatUsF_type 'SatUsF_t':'_Sat unsigned short _Fract'
+//CHECK-NEXT: |-VarDecl {{.*}} SatUF_type 'SatUF_t':'_Sat unsigned _Fract'
+//CHECK-NEXT: |-VarDecl {{.*}} SatUlF_type 'SatUlF_t':'_Sat unsigned long _Fract'
+//CHECK-NEXT: |-VarDecl {{.*}} SatsA_type 'SatsA_t':'_Sat short _Accum'
+//CHECK-NEXT: |-VarDecl {{.*}} SatA_type 'SatA_t':'_Sat _Accum'
+//CHECK-NEXT: |-VarDecl {{.*}} SatlA_type 'SatlA_t':'_Sat long _Accum'
+//CHECK-NEXT: |-VarDecl {{.*}} SatsF_type 'SatsF_t':'_Sat short _Fract'
+//CHECK-NEXT: |-VarDecl {{.*}} SatF_type 'SatF_t':'_Sat _Fract'
+//CHECK-NEXT: |-VarDecl {{.*}} SatlF_type 'SatlF_t':'_Sat long _Fract'
+
+// Fixed point literal exponent syntax
+_Accum decexp1 = 1.575e1k;
+_Accum decexp2 = 1.575E1k;
+_Accum decexp3 = 1575e-2k;
+_Accum decexp4 = 1575E-2k;
+
+_Accum hexexp1 = 0x0.3p10k;
+_Accum hexexp2 = 0x0.3P10k;
+_Accum hexexp3 = 0x30000p-10k;
+_Accum hexexp4 = 0x30000P-10k;
+
+_Accum zeroexp1 = 1e0k;
+_Accum zeroexp2 = 1e-0k;
+
+//CHECK-NEXT: |-VarDecl {{.*}} decexp1 '_Accum' cinit
+//CHECK-NEXT: `-FixedPointLiteral {{.*}} '_Accum' 15.75
+//CHECK-NEXT: |-VarDecl {{.*}} decexp2 '_Accum' cinit
+//CHECK-NEXT: `-FixedPointLiteral {{.*}} '_Accum' 15.75
+//CHECK-NEXT: |-VarDecl {{.*}} decexp3 '_Accum' cinit
+//CHECK-NEXT: `-FixedPointLiteral {{.*}} '_Accum' 15.75
+//CHECK-NEXT: |-VarDecl {{.*}} decexp4 '_Accum' cinit
+//CHECK-NEXT: `-FixedPointLiteral {{.*}} '_Accum' 15.75
+
+//CHECK-NEXT: |-VarDecl {{.*}} hexexp1 '_Accum' cinit
+//CHECK-NEXT: `-FixedPointLiteral {{.*}} '_Accum' 192.0
+//CHECK-NEXT: |-VarDecl {{.*}} hexexp2 '_Accum' cinit
+//CHECK-NEXT: `-FixedPointLiteral {{.*}} '_Accum' 192.0
+//CHECK-NEXT: |-VarDecl {{.*}} hexexp3 '_Accum' cinit
+//CHECK-NEXT: `-FixedPointLiteral {{.*}} '_Accum' 192.0
+//CHECK-NEXT: |-VarDecl {{.*}} hexexp4 '_Accum' cinit
+//CHECK-NEXT: `-FixedPointLiteral {{.*}} '_Accum' 192.0
+
+//CHECK-NEXT: |-VarDecl {{.*}} zeroexp1 '_Accum' cinit
+//CHECK-NEXT: `-FixedPointLiteral {{.*}} '_Accum' 1.0
+//CHECK-NEXT: |-VarDecl {{.*}} zeroexp2 '_Accum' cinit
+//CHECK-NEXT: `-FixedPointLiteral {{.*}} '_Accum' 1.0
+
+// Fixed point literal values
+_Accum literal1 = 2.5k; // Precise decimal
+_Accum literal2 = 0.0k; // Zero
+_Accum literal3 = 1.1k; // Imprecise decimal
+_Accum literal4 = 1.11k;
+_Accum literal5 = 1.111k;
+_Accum literal6 = 1.1111k;
+_Accum literal7 = 1.11111k; // After some point after the radix, adding any more
+ // digits to the literal will not result in any
+ // further precision since the nth digit added may
+ // be less than the precision that can be
+ // represented by the fractional bits of the type.
+ // This results in the same value being stored for
+ // the type.
+
+//CHECK-NEXT: |-VarDecl {{.*}} literal1 '_Accum' cinit
+//CHECK-NEXT: `-FixedPointLiteral {{.*}} '_Accum' 2.5
+//CHECK-NEXT: |-VarDecl {{.*}} literal2 '_Accum' cinit
+//CHECK-NEXT: `-FixedPointLiteral {{.*}} '_Accum' 0.0
+//CHECK-NEXT: |-VarDecl {{.*}} literal3 '_Accum' cinit
+//CHECK-NEXT: `-FixedPointLiteral {{.*}} '_Accum' 1.0999755859375
+//CHECK-NEXT: |-VarDecl {{.*}} literal4 '_Accum' cinit
+//CHECK-NEXT: `-FixedPointLiteral {{.*}} '_Accum' 1.1099853515625
+//CHECK-NEXT: |-VarDecl {{.*}} literal5 '_Accum' cinit
+//CHECK-NEXT: `-FixedPointLiteral {{.*}} '_Accum' 1.110992431640625
+//CHECK-NEXT: |-VarDecl {{.*}} literal6 '_Accum' cinit
+//CHECK-NEXT: `-FixedPointLiteral {{.*}} '_Accum' 1.111083984375
+//CHECK-NEXT: |-VarDecl {{.*}} literal7 '_Accum' cinit
+//CHECK-NEXT: `-FixedPointLiteral {{.*}} '_Accum' 1.111083984375
+
+long _Accum longaccumliteral = 0.99999999lk;
+long _Accum longaccumliteral2 = 0.999999999lk;
+long _Accum verylongaccumliteral = 0.99999999999999999999999999lk;
+long _Fract longfractliteral = 0.99999999lr;
+long _Fract longfractliteral2 = 0.999999999lr;
+long _Fract verylongfractliteral = 0.99999999999999999999999999lr;
+
+//CHECK-NEXT: |-VarDecl {{.*}} longaccumliteral 'long _Accum' cinit
+//CHECK-NEXT: `-FixedPointLiteral {{.*}} 'long _Accum' 0.999999989755451679229736328125
+//CHECK-NEXT: |-VarDecl {{.*}} longaccumliteral2 'long _Accum' cinit
+//CHECK-NEXT: `-FixedPointLiteral {{.*}} 'long _Accum' 0.9999999986030161380767822265625
+//CHECK-NEXT: |-VarDecl {{.*}} verylongaccumliteral 'long _Accum' cinit
+//CHECK-NEXT: `-FixedPointLiteral {{.*}} 'long _Accum' 0.9999999995343387126922607421875
+//CHECK-NEXT: |-VarDecl {{.*}} longfractliteral 'long _Fract' cinit
+//CHECK-NEXT: `-FixedPointLiteral {{.*}} 'long _Fract' 0.999999989755451679229736328125
+//CHECK-NEXT: |-VarDecl {{.*}} longfractliteral2 'long _Fract' cinit
+//CHECK-NEXT: `-FixedPointLiteral {{.*}} 'long _Fract' 0.9999999986030161380767822265625
+//CHECK-NEXT: |-VarDecl {{.*}} verylongfractliteral 'long _Fract' cinit
+//CHECK-NEXT: `-FixedPointLiteral {{.*}} 'long _Fract' 0.9999999995343387126922607421875
+
+unsigned _Accum uliteral1 = 2.5uk; // Unsigned
+_Accum literal8 = -2.5k; // Negative
+
+//CHECK-NEXT: |-VarDecl {{.*}} uliteral1 'unsigned _Accum' cinit
+//CHECK-NEXT: `-FixedPointLiteral {{.*}} 'unsigned _Accum' 2.5
+//CHECK-NEXT: |-VarDecl {{.*}} literal8 '_Accum' cinit
+//CHECK-NEXT: `-UnaryOperator {{.*}} '_Accum' prefix '-'
+//CHECK-NEXT: `-FixedPointLiteral {{.*}} '_Accum' 2.5
+
+short _Accum literalexact1 = 0.9921875hk; // Exact value
+_Accum literalexact2 = 0.999969482421875k;
+
+//CHECK-NEXT: |-VarDecl {{.*}} literalexact1 'short _Accum' cinit
+//CHECK-NEXT: `-FixedPointLiteral {{.*}} 'short _Accum' 0.9921875
+//CHECK-NEXT: |-VarDecl {{.*}} literalexact2 '_Accum' cinit
+//CHECK-NEXT: `-FixedPointLiteral {{.*}} '_Accum' 0.999969482421875
+
+// Unfortunately we do not have enough space to store the exact decimal value of
+// 0.9999999995343387126922607421875 ((1 << 31) - 1), but we can still use a
+// large number of 9s to get the max fractional value.
+long _Accum long_accum_max = 0.999999999999999999999999999lk;
+
+//CHECK-NEXT: |-VarDecl {{.*}} long_accum_max 'long _Accum' cinit
+//CHECK-NEXT: `-FixedPointLiteral {{.*}} 'long _Accum' 0.9999999995343387126922607421875
+
+// Epsilon
+short _Accum short_accum_eps = 0.0078125hk;
+short _Accum short_accum_eps2 = 0.0078124hk; // Less than epsilon floors to zero
+_Accum accum_eps = 0.000030517578125k;
+_Accum accum_eps2 = 0.000030517578124k;
+long _Accum long_accum_eps = 0x1p-31lk;
+long _Accum long_accum_eps2 = 0x0.99999999p-31lk;
+
+//CHECK-NEXT: |-VarDecl {{.*}} short_accum_eps 'short _Accum' cinit
+//CHECK-NEXT: `-FixedPointLiteral {{.*}} 'short _Accum' 0.0078125
+//CHECK-NEXT: |-VarDecl {{.*}} short_accum_eps2 'short _Accum' cinit
+//CHECK-NEXT: `-FixedPointLiteral {{.*}} 'short _Accum' 0.0
+//CHECK-NEXT: |-VarDecl {{.*}} accum_eps '_Accum' cinit
+//CHECK-NEXT: `-FixedPointLiteral {{.*}} '_Accum' 0.000030517578125
+//CHECK-NEXT: |-VarDecl {{.*}} accum_eps2 '_Accum' cinit
+//CHECK-NEXT: `-FixedPointLiteral {{.*}} '_Accum' 0.0
+//CHECK-NEXT: |-VarDecl {{.*}} long_accum_eps 'long _Accum' cinit
+//CHECK-NEXT: `-FixedPointLiteral {{.*}} 'long _Accum' 0.0000000004656612873077392578125
+//CHECK-NEXT: |-VarDecl {{.*}} long_accum_eps2 'long _Accum' cinit
+//CHECK-NEXT: `-FixedPointLiteral {{.*}} 'long _Accum' 0.0
+
+// Fract literals can be one but evaluate to the respective Fract max
+short _Fract short_fract_one = 1.0hr;
+_Fract fract_one = 1.0r;
+long _Fract long_fract_one = 1.0lr;
+unsigned short _Fract u_short_fract_one = 1.0uhr;
+unsigned _Fract u_fract_one = 1.0ur;
+unsigned long _Fract u_long_fract_one = 1.0ulr;
+
+//CHECK-NEXT: |-VarDecl {{.*}} short_fract_one 'short _Fract' cinit
+//CHECK-NEXT: `-FixedPointLiteral {{.*}} 'short _Fract' 0.9921875
+//CHECK-NEXT: |-VarDecl {{.*}} fract_one '_Fract' cinit
+//CHECK-NEXT: `-FixedPointLiteral {{.*}} '_Fract' 0.999969482421875
+//CHECK-NEXT: |-VarDecl {{.*}} long_fract_one 'long _Fract' cinit
+//CHECK-NEXT: `-FixedPointLiteral {{.*}} 'long _Fract' 0.9999999995343387126922607421875
+
+//CHECK-NEXT: |-VarDecl {{.*}} u_short_fract_one 'unsigned short _Fract' cinit
+//CHECK-NEXT: `-FixedPointLiteral {{.*}} 'unsigned short _Fract' 0.99609375
+//CHECK-NEXT: |-VarDecl {{.*}} u_fract_one 'unsigned _Fract' cinit
+//CHECK-NEXT: `-FixedPointLiteral {{.*}} 'unsigned _Fract' 0.9999847412109375
+//CHECK-NEXT: |-VarDecl {{.*}} u_long_fract_one 'unsigned long _Fract' cinit
+//CHECK-NEXT: `-FixedPointLiteral {{.*}} 'unsigned long _Fract' 0.99999999976716935634613037109375
+
+_Accum literallast = 1.0k; // One
+
+//CHECK-NEXT: `-VarDecl {{.*}} literallast '_Accum' cinit
+//CHECK-NEXT: `-FixedPointLiteral {{.*}} '_Accum' 1.0
diff --git a/test/Frontend/fixed_point_bit_widths.c b/test/Frontend/fixed_point_bit_widths.c
new file mode 100644
index 000000000000..ac8db49ed516
--- /dev/null
+++ b/test/Frontend/fixed_point_bit_widths.c
@@ -0,0 +1,196 @@
+// RUN: %clang -x c -ffixed-point -S -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang -x c -ffixed-point -S -emit-llvm -o - --target=x86_64-scei-ps4-ubuntu-fast %s | FileCheck %s
+// RUN: %clang -x c -ffixed-point -S -emit-llvm -o - --target=ppc64 %s | FileCheck %s
+// RUN: %clang -x c -ffixed-point -S -emit-llvm -o - --target=x86_64-scei-ps4-windows10pro-fast %s | FileCheck %s
+
+/* Primary signed _Accum */
+
+int size_SsA = sizeof(signed short _Accum);
+int size_SA = sizeof(signed _Accum);
+int size_SlA = sizeof(signed long _Accum);
+int align_SsA = __alignof(signed short _Accum);
+int align_SA = __alignof(signed _Accum);
+int align_SlA = __alignof(signed long _Accum);
+
+// CHECK: @size_SsA = {{.*}}global i{{[0-9]+}} 2
+// CHECK-NEXT: @size_SA = {{.*}}global i{{[0-9]+}} 4
+// CHECK-NEXT: @size_SlA = {{.*}}global i{{[0-9]+}} 8
+// CHECK-NEXT: @align_SsA = {{.*}}global i{{[0-9]+}} 2
+// CHECK-NEXT: @align_SA = {{.*}}global i{{[0-9]+}} 4
+// CHECK-NEXT: @align_SlA = {{.*}}global i{{[0-9]+}} 8
+
+/* Primary unsigned _Accum */
+
+int size_UsA = sizeof(unsigned short _Accum);
+int size_UA = sizeof(unsigned _Accum);
+int size_UlA = sizeof(unsigned long _Accum);
+int align_UsA = __alignof(unsigned short _Accum);
+int align_UA = __alignof(unsigned _Accum);
+int align_UlA = __alignof(unsigned long _Accum);
+
+// CHECK-NEXT: @size_UsA = {{.*}}global i{{[0-9]+}} 2
+// CHECK-NEXT: @size_UA = {{.*}}global i{{[0-9]+}} 4
+// CHECK-NEXT: @size_UlA = {{.*}}global i{{[0-9]+}} 8
+// CHECK-NEXT: @align_UsA = {{.*}}global i{{[0-9]+}} 2
+// CHECK-NEXT: @align_UA = {{.*}}global i{{[0-9]+}} 4
+// CHECK-NEXT: @align_UlA = {{.*}}global i{{[0-9]+}} 8
+
+/* Primary signed _Fract */
+
+int size_SsF = sizeof(signed short _Fract);
+int size_SF = sizeof(signed _Fract);
+int size_SlF = sizeof(signed long _Fract);
+int align_SsF = __alignof(signed short _Fract);
+int align_SF = __alignof(signed _Fract);
+int align_SlF = __alignof(signed long _Fract);
+
+// CHECK-NEXT: @size_SsF = {{.*}}global i{{[0-9]+}} 1
+// CHECK-NEXT: @size_SF = {{.*}}global i{{[0-9]+}} 2
+// CHECK-NEXT: @size_SlF = {{.*}}global i{{[0-9]+}} 4
+// CHECK-NEXT: @align_SsF = {{.*}}global i{{[0-9]+}} 1
+// CHECK-NEXT: @align_SF = {{.*}}global i{{[0-9]+}} 2
+// CHECK-NEXT: @align_SlF = {{.*}}global i{{[0-9]+}} 4
+
+/* Primary unsigned _Fract */
+
+int size_UsF = sizeof(unsigned short _Fract);
+int size_UF = sizeof(unsigned _Fract);
+int size_UlF = sizeof(unsigned long _Fract);
+int align_UsF = __alignof(unsigned short _Fract);
+int align_UF = __alignof(unsigned _Fract);
+int align_UlF = __alignof(unsigned long _Fract);
+
+// CHECK-NEXT: @size_UsF = {{.*}}global i{{[0-9]+}} 1
+// CHECK-NEXT: @size_UF = {{.*}}global i{{[0-9]+}} 2
+// CHECK-NEXT: @size_UlF = {{.*}}global i{{[0-9]+}} 4
+// CHECK-NEXT: @align_UsF = {{.*}}global i{{[0-9]+}} 1
+// CHECK-NEXT: @align_UF = {{.*}}global i{{[0-9]+}} 2
+// CHECK-NEXT: @align_UlF = {{.*}}global i{{[0-9]+}} 4
+
+/* Aliased _Accum */
+
+int size_sA = sizeof(short _Accum);
+int size_A = sizeof(_Accum);
+int size_lA = sizeof(long _Accum);
+int align_sA = __alignof(short _Accum);
+int align_A = __alignof(_Accum);
+int align_lA = __alignof(long _Accum);
+
+// CHECK-NEXT: @size_sA = {{.*}}global i{{[0-9]+}} 2
+// CHECK-NEXT: @size_A = {{.*}}global i{{[0-9]+}} 4
+// CHECK-NEXT: @size_lA = {{.*}}global i{{[0-9]+}} 8
+// CHECK-NEXT: @align_sA = {{.*}}global i{{[0-9]+}} 2
+// CHECK-NEXT: @align_A = {{.*}}global i{{[0-9]+}} 4
+// CHECK-NEXT: @align_lA = {{.*}}global i{{[0-9]+}} 8
+
+/* Aliased _Fract */
+
+int size_sF = sizeof(short _Fract);
+int size_F = sizeof(_Fract);
+int size_lF = sizeof(long _Fract);
+int align_sF = __alignof(short _Fract);
+int align_F = __alignof(_Fract);
+int align_lF = __alignof(long _Fract);
+
+// CHECK-NEXT: @size_sF = {{.*}}global i{{[0-9]+}} 1
+// CHECK-NEXT: @size_F = {{.*}}global i{{[0-9]+}} 2
+// CHECK-NEXT: @size_lF = {{.*}}global i{{[0-9]+}} 4
+// CHECK-NEXT: @align_sF = {{.*}}global i{{[0-9]+}} 1
+// CHECK-NEXT: @align_F = {{.*}}global i{{[0-9]+}} 2
+// CHECK-NEXT: @align_lF = {{.*}}global i{{[0-9]+}} 4
+
+/* Saturated signed _Accum */
+
+int size_SatSsA = sizeof(_Sat signed short _Accum);
+int size_SatSA = sizeof(_Sat signed _Accum);
+int size_SatSlA = sizeof(_Sat signed long _Accum);
+int align_SatSsA = __alignof(_Sat signed short _Accum);
+int align_SatSA = __alignof(_Sat signed _Accum);
+int align_SatSlA = __alignof(_Sat signed long _Accum);
+
+// CHECK: @size_SatSsA = {{.*}}global i{{[0-9]+}} 2
+// CHECK-NEXT: @size_SatSA = {{.*}}global i{{[0-9]+}} 4
+// CHECK-NEXT: @size_SatSlA = {{.*}}global i{{[0-9]+}} 8
+// CHECK-NEXT: @align_SatSsA = {{.*}}global i{{[0-9]+}} 2
+// CHECK-NEXT: @align_SatSA = {{.*}}global i{{[0-9]+}} 4
+// CHECK-NEXT: @align_SatSlA = {{.*}}global i{{[0-9]+}} 8
+
+/* Saturated unsigned _Accum */
+
+int size_SatUsA = sizeof(_Sat unsigned short _Accum);
+int size_SatUA = sizeof(_Sat unsigned _Accum);
+int size_SatUlA = sizeof(_Sat unsigned long _Accum);
+int align_SatUsA = __alignof(_Sat unsigned short _Accum);
+int align_SatUA = __alignof(_Sat unsigned _Accum);
+int align_SatUlA = __alignof(_Sat unsigned long _Accum);
+
+// CHECK-NEXT: @size_SatUsA = {{.*}}global i{{[0-9]+}} 2
+// CHECK-NEXT: @size_SatUA = {{.*}}global i{{[0-9]+}} 4
+// CHECK-NEXT: @size_SatUlA = {{.*}}global i{{[0-9]+}} 8
+// CHECK-NEXT: @align_SatUsA = {{.*}}global i{{[0-9]+}} 2
+// CHECK-NEXT: @align_SatUA = {{.*}}global i{{[0-9]+}} 4
+// CHECK-NEXT: @align_SatUlA = {{.*}}global i{{[0-9]+}} 8
+
+/* Saturated signed _Fract */
+
+int size_SatSsF = sizeof(_Sat signed short _Fract);
+int size_SatSF = sizeof(_Sat signed _Fract);
+int size_SatSlF = sizeof(_Sat signed long _Fract);
+int align_SatSsF = __alignof(_Sat signed short _Fract);
+int align_SatSF = __alignof(_Sat signed _Fract);
+int align_SatSlF = __alignof(_Sat signed long _Fract);
+
+// CHECK-NEXT: @size_SatSsF = {{.*}}global i{{[0-9]+}} 1
+// CHECK-NEXT: @size_SatSF = {{.*}}global i{{[0-9]+}} 2
+// CHECK-NEXT: @size_SatSlF = {{.*}}global i{{[0-9]+}} 4
+// CHECK-NEXT: @align_SatSsF = {{.*}}global i{{[0-9]+}} 1
+// CHECK-NEXT: @align_SatSF = {{.*}}global i{{[0-9]+}} 2
+// CHECK-NEXT: @align_SatSlF = {{.*}}global i{{[0-9]+}} 4
+
+/* Saturated unsigned _Fract */
+
+int size_SatUsF = sizeof(_Sat unsigned short _Fract);
+int size_SatUF = sizeof(_Sat unsigned _Fract);
+int size_SatUlF = sizeof(_Sat unsigned long _Fract);
+int align_SatUsF = __alignof(_Sat unsigned short _Fract);
+int align_SatUF = __alignof(_Sat unsigned _Fract);
+int align_SatUlF = __alignof(_Sat unsigned long _Fract);
+
+// CHECK-NEXT: @size_SatUsF = {{.*}}global i{{[0-9]+}} 1
+// CHECK-NEXT: @size_SatUF = {{.*}}global i{{[0-9]+}} 2
+// CHECK-NEXT: @size_SatUlF = {{.*}}global i{{[0-9]+}} 4
+// CHECK-NEXT: @align_SatUsF = {{.*}}global i{{[0-9]+}} 1
+// CHECK-NEXT: @align_SatUF = {{.*}}global i{{[0-9]+}} 2
+// CHECK-NEXT: @align_SatUlF = {{.*}}global i{{[0-9]+}} 4
+
+/* Aliased saturated signed _Accum */
+
+int size_SatsA = sizeof(_Sat short _Accum);
+int size_SatA = sizeof(_Sat _Accum);
+int size_SatlA = sizeof(_Sat long _Accum);
+int align_SatsA = __alignof(_Sat short _Accum);
+int align_SatA = __alignof(_Sat _Accum);
+int align_SatlA = __alignof(_Sat long _Accum);
+
+// CHECK-NEXT: @size_SatsA = {{.*}}global i{{[0-9]+}} 2
+// CHECK-NEXT: @size_SatA = {{.*}}global i{{[0-9]+}} 4
+// CHECK-NEXT: @size_SatlA = {{.*}}global i{{[0-9]+}} 8
+// CHECK-NEXT: @align_SatsA = {{.*}}global i{{[0-9]+}} 2
+// CHECK-NEXT: @align_SatA = {{.*}}global i{{[0-9]+}} 4
+// CHECK-NEXT: @align_SatlA = {{.*}}global i{{[0-9]+}} 8
+
+/* Aliased saturated _Fract */
+
+int size_SatsF = sizeof(_Sat short _Fract);
+int size_SatF = sizeof(_Sat _Fract);
+int size_SatlF = sizeof(_Sat long _Fract);
+int align_SatsF = __alignof(_Sat short _Fract);
+int align_SatF = __alignof(_Sat _Fract);
+int align_SatlF = __alignof(_Sat long _Fract);
+
+// CHECK-NEXT: @size_SatsF = {{.*}}global i{{[0-9]+}} 1
+// CHECK-NEXT: @size_SatF = {{.*}}global i{{[0-9]+}} 2
+// CHECK-NEXT: @size_SatlF = {{.*}}global i{{[0-9]+}} 4
+// CHECK-NEXT: @align_SatsF = {{.*}}global i{{[0-9]+}} 1
+// CHECK-NEXT: @align_SatF = {{.*}}global i{{[0-9]+}} 2
+// CHECK-NEXT: @align_SatlF = {{.*}}global i{{[0-9]+}} 4
diff --git a/test/Frontend/fixed_point_declarations.c b/test/Frontend/fixed_point_declarations.c
new file mode 100644
index 000000000000..5df54f38d7f6
--- /dev/null
+++ b/test/Frontend/fixed_point_declarations.c
@@ -0,0 +1,113 @@
+// RUN: %clang -ffixed-point -S -emit-llvm %s -o - --target=x86_64-linux | FileCheck %s
+// RUN: %clang -ffixed-point -S -emit-llvm %s -o - --target=x86_64-scei-ps4-ubuntu-fast | FileCheck %s
+
+// Primary fixed point types
+signed short _Accum s_short_accum; // CHECK-DAG: @s_short_accum = {{.*}}global i16 0, align 2
+signed _Accum s_accum; // CHECK-DAG: @s_accum = {{.*}}global i32 0, align 4
+signed long _Accum s_long_accum; // CHECK-DAG: @s_long_accum = {{.*}}global i64 0, align 8
+unsigned short _Accum u_short_accum; // CHECK-DAG: @u_short_accum = {{.*}}global i16 0, align 2
+unsigned _Accum u_accum; // CHECK-DAG: @u_accum = {{.*}}global i32 0, align 4
+unsigned long _Accum u_long_accum; // CHECK-DAG: @u_long_accum = {{.*}}global i64 0, align 8
+signed short _Fract s_short_fract; // CHECK-DAG: @s_short_fract = {{.*}}global i8 0, align 1
+signed _Fract s_fract; // CHECK-DAG: @s_fract = {{.*}}global i16 0, align 2
+signed long _Fract s_long_fract; // CHECK-DAG: @s_long_fract = {{.*}}global i32 0, align 4
+unsigned short _Fract u_short_fract; // CHECK-DAG: @u_short_fract = {{.*}}global i8 0, align 1
+unsigned _Fract u_fract; // CHECK-DAG: @u_fract = {{.*}}global i16 0, align 2
+unsigned long _Fract u_long_fract; // CHECK-DAG: @u_long_fract = {{.*}}global i32 0, align 4
+
+// Aliased
+short _Accum short_accum; // CHECK-DAG: @short_accum = {{.*}}global i16 0, align 2
+_Accum accum; // CHECK-DAG: @accum = {{.*}}global i32 0, align 4
+long _Accum long_accum; // CHECK-DAG: @long_accum = {{.*}}global i64 0, align 8
+short _Fract short_fract; // CHECK-DAG: @short_fract = {{.*}}global i8 0, align 1
+_Fract fract; // CHECK-DAG: @fract = {{.*}}global i16 0, align 2
+long _Fract long_fract; // CHECK-DAG: @long_fract = {{.*}}global i32 0, align 4
+
+// Primary saturated
+_Sat signed short _Accum sat_s_short_accum; // CHECK-DAG: @sat_s_short_accum = {{.*}}global i16 0, align 2
+_Sat signed _Accum sat_s_accum; // CHECK-DAG: @sat_s_accum = {{.*}}global i32 0, align 4
+_Sat signed long _Accum sat_s_long_accum; // CHECK-DAG: @sat_s_long_accum = {{.*}}global i64 0, align 8
+_Sat unsigned short _Accum sat_u_short_accum; // CHECK-DAG: @sat_u_short_accum = {{.*}}global i16 0, align 2
+_Sat unsigned _Accum sat_u_accum; // CHECK-DAG: @sat_u_accum = {{.*}}global i32 0, align 4
+_Sat unsigned long _Accum sat_u_long_accum; // CHECK-DAG: @sat_u_long_accum = {{.*}}global i64 0, align 8
+_Sat signed short _Fract sat_s_short_fract; // CHECK-DAG: @sat_s_short_fract = {{.*}}global i8 0, align 1
+_Sat signed _Fract sat_s_fract; // CHECK-DAG: @sat_s_fract = {{.*}}global i16 0, align 2
+_Sat signed long _Fract sat_s_long_fract; // CHECK-DAG: @sat_s_long_fract = {{.*}}global i32 0, align 4
+_Sat unsigned short _Fract sat_u_short_fract; // CHECK-DAG: @sat_u_short_fract = {{.*}}global i8 0, align 1
+_Sat unsigned _Fract sat_u_fract; // CHECK-DAG: @sat_u_fract = {{.*}}global i16 0, align 2
+_Sat unsigned long _Fract sat_u_long_fract; // CHECK-DAG: @sat_u_long_fract = {{.*}}global i32 0, align 4
+
+// Aliased saturated
+_Sat short _Accum sat_short_accum; // CHECK-DAG: @sat_short_accum = {{.*}}global i16 0, align 2
+_Sat _Accum sat_accum; // CHECK-DAG: @sat_accum = {{.*}}global i32 0, align 4
+_Sat long _Accum sat_long_accum; // CHECK-DAG: @sat_long_accum = {{.*}}global i64 0, align 8
+_Sat short _Fract sat_short_fract; // CHECK-DAG: @sat_short_fract = {{.*}}global i8 0, align 1
+_Sat _Fract sat_fract; // CHECK-DAG: @sat_fract = {{.*}}global i16 0, align 2
+_Sat long _Fract sat_long_fract; // CHECK-DAG: @sat_long_fract = {{.*}}global i32 0, align 4
+
+/* Fixed point literals */
+short _Accum short_accum_literal = 2.5hk; // CHECK-DAG: @short_accum_literal = {{.*}}global i16 320, align 2
+_Accum accum_literal = 2.5k; // CHECK-DAG: @accum_literal = {{.*}}global i32 81920, align 4
+long _Accum long_accum_literal = 2.5lk; // CHECK-DAG: @long_accum_literal = {{.*}}global i64 5368709120, align 8
+short _Fract short_fract_literal = 0.5hr; // CHECK-DAG: @short_fract_literal = {{.*}}global i8 64, align 1
+_Fract fract_literal = 0.5r; // CHECK-DAG: @fract_literal = {{.*}}global i16 16384, align 2
+long _Fract long_fract_literal = 0.5lr; // CHECK-DAG: @long_fract_literal = {{.*}}global i32 1073741824, align 4
+
+unsigned short _Accum u_short_accum_literal = 2.5uhk; // CHECK-DAG: @u_short_accum_literal = {{.*}}global i16 640, align 2
+unsigned _Accum u_accum_literal = 2.5uk; // CHECK-DAG: @u_accum_literal = {{.*}}global i32 163840, align 4
+unsigned long _Accum u_long_accum_literal = 2.5ulk; // CHECK-DAG: @u_long_accum_literal = {{.*}}global i64 10737418240, align 8
+unsigned short _Fract u_short_fract_literal = 0.5uhr; // CHECK-DAG: @u_short_fract_literal = {{.*}}global i8 -128, align 1
+unsigned _Fract u_fract_literal = 0.5ur; // CHECK-DAG: @u_fract_literal = {{.*}}global i16 -32768, align 2
+unsigned long _Fract u_long_fract_literal = 0.5ulr; // CHECK-DAG: @u_long_fract_literal = {{.*}}global i32 -2147483648, align 4
+
+// Max literal values
+short _Accum short_accum_max = 255.9999999999999999hk; // CHECK-DAG: @short_accum_max = {{.*}}global i16 32767, align 2
+_Accum accum_max = 65535.9999999999999999k; // CHECK-DAG: @accum_max = {{.*}}global i32 2147483647, align 4
+long _Accum long_accum_max = 4294967295.9999999999999999lk; // CHECK-DAG: @long_accum_max = {{.*}}global i64 9223372036854775807, align 8
+unsigned short _Accum u_short_accum_max = 255.9999999999999999uhk; // CHECK-DAG: @u_short_accum_max = {{.*}}global i16 -1, align 2
+unsigned _Accum u_accum_max = 65535.9999999999999999uk; // CHECK-DAG: @u_accum_max = {{.*}}global i32 -1, align 4
+unsigned long _Accum u_long_accum_max = 4294967295.9999999999999999ulk; // CHECK-DAG: @u_long_accum_max = {{.*}}global i64 -1, align 8
+
+short _Fract short_fract_max = 0.9999999999999999hr; // CHECK-DAG: @short_fract_max = {{.*}}global i8 127, align 1
+_Fract fract_max = 0.9999999999999999r; // CHECK-DAG: @fract_max = {{.*}}global i16 32767, align 2
+long _Fract long_fract_max = 0.9999999999999999lr; // CHECK-DAG: @long_fract_max = {{.*}}global i32 2147483647, align 4
+unsigned short _Fract u_short_fract_max = 0.9999999999999999uhr; // CHECK-DAG: @u_short_fract_max = {{.*}}global i8 -1, align 1
+unsigned _Fract u_fract_max = 0.9999999999999999ur; // CHECK-DAG: @u_fract_max = {{.*}}global i16 -1, align 2
+unsigned long _Fract u_long_fract_max = 0.9999999999999999ulr; // CHECK-DAG: @u_long_fract_max = {{.*}}global i32 -1, align 4
+
+// Fracts may be exactly one but evaluate to the Fract max
+short _Fract short_fract_one = 1.0hr; // CHECK-DAG: @short_fract_one = {{.*}}global i8 127, align 1
+_Fract fract_one = 1.0r; // CHECK-DAG: @fract_one = {{.*}}global i16 32767, align 2
+long _Fract long_fract_one = 1.0lr; // CHECK-DAG: @long_fract_one = {{.*}}global i32 2147483647, align 4
+unsigned short _Fract u_short_fract_one = 1.0uhr; // CHECK-DAG: @u_short_fract_one = {{.*}}global i8 -1, align 1
+unsigned _Fract u_fract_one = 1.0ur; // CHECK-DAG: @u_fract_one = {{.*}}global i16 -1, align 2
+unsigned long _Fract u_long_fract_one = 1.0ulr; // CHECK-DAG: @u_long_fract_one = {{.*}}global i32 -1, align 4
+
+short _Fract short_fract_exp_one = 0.1e1hr; // CHECK-DAG: @short_fract_exp_one = {{.*}}global i8 127, align 1
+_Fract fract_exp_one = 0.1e1r; // CHECK-DAG: @fract_exp_one = {{.*}}global i16 32767, align 2
+long _Fract long_fract_exp_one = 0.1e1lr; // CHECK-DAG: @long_fract_exp_one = {{.*}}global i32 2147483647, align 4
+unsigned short _Fract u_short_fract_exp_one = 0.1e1uhr; // CHECK-DAG: @u_short_fract_exp_one = {{.*}}global i8 -1, align 1
+unsigned _Fract u_fract_exp_one = 0.1e1ur; // CHECK-DAG: @u_fract_exp_one = {{.*}}global i16 -1, align 2
+unsigned long _Fract u_long_fract_exp_one = 0.1e1ulr; // CHECK-DAG: @u_long_fract_exp_one = {{.*}}global i32 -1, align 4
+
+short _Fract short_fract_hex_exp_one = 0x0.8p1hr; // CHECK-DAG: @short_fract_hex_exp_one = {{.*}}global i8 127, align 1
+_Fract fract_hex_exp_one = 0x0.8p1r; // CHECK-DAG: @fract_hex_exp_one = {{.*}}global i16 32767, align 2
+long _Fract long_fract_hex_exp_one = 0x0.8p1lr; // CHECK-DAG: @long_fract_hex_exp_one = {{.*}}global i32 2147483647, align 4
+unsigned short _Fract u_short_fract_hex_exp_one = 0x0.8p1uhr; // CHECK-DAG: @u_short_fract_hex_exp_one = {{.*}}global i8 -1, align 1
+unsigned _Fract u_fract_hex_exp_one = 0x0.8p1ur; // CHECK-DAG: @u_fract_hex_exp_one = {{.*}}global i16 -1, align 2
+unsigned long _Fract u_long_fract_hex_exp_one = 0x0.8p1ulr; // CHECK-DAG: @u_long_fract_hex_exp_one = {{.*}}global i32 -1, align 4
+
+// Expsilon values
+short _Accum short_accum_eps = 0x1p-7hk; // CHECK-DAG: @short_accum_eps = {{.*}}global i16 1, align 2
+_Accum accum_eps = 0x1p-15k; // CHECK-DAG: @accum_eps = {{.*}}global i32 1, align 4
+long _Accum long_accum_eps = 0x1p-31lk; // CHECK-DAG: @long_accum_eps = {{.*}}global i64 1, align 8
+unsigned short _Accum u_short_accum_eps = 0x1p-8uhk; // CHECK-DAG: @u_short_accum_eps = {{.*}}global i16 1, align 2
+unsigned _Accum u_accum_eps = 0x1p-16uk; // CHECK-DAG: @u_accum_eps = {{.*}}global i32 1, align 4
+unsigned long _Accum u_long_accum_eps = 0x1p-32ulk; // CHECK-DAG: @u_long_accum_eps = {{.*}}global i64 1, align 8
+
+short _Fract short_fract_eps = 0x1p-7hr; // CHECK-DAG: @short_fract_eps = {{.*}}global i8 1, align 1
+_Fract fract_eps = 0x1p-15r; // CHECK-DAG: @fract_eps = {{.*}}global i16 1, align 2
+long _Fract long_fract_eps = 0x1p-31lr; // CHECK-DAG: @long_fract_eps = {{.*}}global i32 1, align 4
+unsigned short _Fract u_short_fract_eps = 0x1p-8uhr; // CHECK-DAG: @u_short_fract_eps = {{.*}}global i8 1, align 1
+unsigned _Fract u_fract_eps = 0x1p-16ur; // CHECK-DAG: @u_fract_eps = {{.*}}global i16 1, align 2
+unsigned long _Fract u_long_fract_eps = 0x1p-32ulr; // CHECK-DAG: @u_long_fract_eps = {{.*}}global i32 1, align 4
diff --git a/test/Frontend/fixed_point_errors.c b/test/Frontend/fixed_point_errors.c
new file mode 100644
index 000000000000..41427e343154
--- /dev/null
+++ b/test/Frontend/fixed_point_errors.c
@@ -0,0 +1,234 @@
+// RUN: %clang_cc1 -verify -ffixed-point %s
+
+/* We do not yet support long long. No recommended bit widths are given for this
+ * size. */
+
+long long _Accum longlong_accum; // expected-error{{'long long _Accum' is invalid}}
+unsigned long long _Accum u_longlong_accum; // expected-error{{'long long _Accum' is invalid}}
+long long _Fract longlong_fract; // expected-error{{'long long _Fract' is invalid}}
+unsigned long long _Fract u_longlong_fract; // expected-error{{'long long _Fract' is invalid}}
+
+_Sat long long _Accum sat_longlong_accum; // expected-error{{'long long _Accum' is invalid}}
+_Sat unsigned long long _Accum sat_u_longlong_accum; // expected-error{{'long long _Accum' is invalid}}
+_Sat long long _Fract sat_longlong_fract; // expected-error{{'long long _Fract' is invalid}}
+_Sat unsigned long long _Fract sat_u_longlong_fract; // expected-error{{'long long _Fract' is invalid}}
+
+
+/* Although _Complex types work with floating point numbers, the extension
+ * provides no info for complex fixed point types. */
+
+_Complex signed short _Accum cmplx_s_short_accum; // expected-error{{'_Complex _Accum' is invalid}}
+_Complex signed _Accum cmplx_s_accum; // expected-error{{'_Complex _Accum' is invalid}}
+_Complex signed long _Accum cmplx_s_long_accum; // expected-error{{'_Complex _Accum' is invalid}}
+_Complex unsigned short _Accum cmplx_u_short_accum; // expected-error{{'_Complex _Accum' is invalid}}
+_Complex unsigned _Accum cmplx_u_accum; // expected-error{{'_Complex _Accum' is invalid}}
+_Complex unsigned long _Accum cmplx_u_long_accum; // expected-error{{'_Complex _Accum' is invalid}}
+_Complex short _Accum cmplx_s_short_accum; // expected-error{{'_Complex _Accum' is invalid}}
+_Complex _Accum cmplx_s_accum; // expected-error{{'_Complex _Accum' is invalid}}
+_Complex long _Accum cmplx_s_long_accum; // expected-error{{'_Complex _Accum' is invalid}}
+
+_Complex signed short _Fract cmplx_s_short_fract; // expected-error{{'_Complex _Fract' is invalid}}
+_Complex signed _Fract cmplx_s_fract; // expected-error{{'_Complex _Fract' is invalid}}
+_Complex signed long _Fract cmplx_s_long_fract; // expected-error{{'_Complex _Fract' is invalid}}
+_Complex unsigned short _Fract cmplx_u_short_fract; // expected-error{{'_Complex _Fract' is invalid}}
+_Complex unsigned _Fract cmplx_u_fract; // expected-error{{'_Complex _Fract' is invalid}}
+_Complex unsigned long _Fract cmplx_u_long_fract; // expected-error{{'_Complex _Fract' is invalid}}
+_Complex short _Fract cmplx_s_short_fract; // expected-error{{'_Complex _Fract' is invalid}}
+_Complex _Fract cmplx_s_fract; // expected-error{{'_Complex _Fract' is invalid}}
+_Complex long _Fract cmplx_s_long_fract; // expected-error{{'_Complex _Fract' is invalid}}
+
+_Complex _Sat signed short _Accum cmplx_sat_s_short_accum; // expected-error{{'_Complex _Accum' is invalid}}
+_Complex _Sat signed _Accum cmplx_sat_s_accum; // expected-error{{'_Complex _Accum' is invalid}}
+_Complex _Sat signed long _Accum cmplx_sat_s_long_accum; // expected-error{{'_Complex _Accum' is invalid}}
+_Complex _Sat unsigned short _Accum cmplx_sat_u_short_accum; // expected-error{{'_Complex _Accum' is invalid}}
+_Complex _Sat unsigned _Accum cmplx_sat_u_accum; // expected-error{{'_Complex _Accum' is invalid}}
+_Complex _Sat unsigned long _Accum cmplx_sat_u_long_accum; // expected-error{{'_Complex _Accum' is invalid}}
+_Complex _Sat short _Accum cmplx_sat_s_short_accum; // expected-error{{'_Complex _Accum' is invalid}}
+_Complex _Sat _Accum cmplx_sat_s_accum; // expected-error{{'_Complex _Accum' is invalid}}
+_Complex _Sat long _Accum cmplx_sat_s_long_accum; // expected-error{{'_Complex _Accum' is invalid}}
+
+_Complex signed short _Fract cmplx_sat_s_short_fract; // expected-error{{'_Complex _Fract' is invalid}}
+_Complex signed _Fract cmplx_sat_s_fract; // expected-error{{'_Complex _Fract' is invalid}}
+_Complex signed long _Fract cmplx_sat_s_long_fract; // expected-error{{'_Complex _Fract' is invalid}}
+_Complex unsigned short _Fract cmplx_sat_u_short_fract; // expected-error{{'_Complex _Fract' is invalid}}
+_Complex unsigned _Fract cmplx_sat_u_fract; // expected-error{{'_Complex _Fract' is invalid}}
+_Complex unsigned long _Fract cmplx_sat_u_long_fract; // expected-error{{'_Complex _Fract' is invalid}}
+_Complex short _Fract cmplx_sat_s_short_fract; // expected-error{{'_Complex _Fract' is invalid}}
+_Complex _Fract cmplx_sat_s_fract; // expected-error{{'_Complex _Fract' is invalid}}
+_Complex long _Fract cmplx_sat_s_long_fract; // expected-error{{'_Complex _Fract' is invalid}}
+
+/* Bad combinations */
+float _Accum f_accum; // expected-error{{cannot combine with previous 'float' declaration specifier}}
+double _Accum d_accum; // expected-error{{cannot combine with previous 'double' declaration specifier}}
+_Bool _Accum b_accum; // expected-error{{cannot combine with previous '_Bool' declaration specifier}}
+char _Accum c_accum; // expected-error{{cannot combine with previous 'char' declaration specifier}}
+int _Accum i_accum; // expected-error{{cannot combine with previous 'int' declaration specifier}}
+
+float _Fract f_fract; // expected-error{{cannot combine with previous 'float' declaration specifier}}
+double _Fract d_fract; // expected-error{{cannot combine with previous 'double' declaration specifier}}
+_Bool _Fract b_fract; // expected-error{{cannot combine with previous '_Bool' declaration specifier}}
+char _Fract c_fract; // expected-error{{cannot combine with previous 'char' declaration specifier}}
+int _Fract i_fract; // expected-error{{cannot combine with previous 'int' declaration specifier}}
+
+/* Bad saturated combinations */
+_Sat float f; // expected-error{{'_Sat' specifier is only valid on '_Fract' or '_Accum', not 'float'}}
+_Sat double d; // expected-error{{'_Sat' specifier is only valid on '_Fract' or '_Accum', not 'double'}}
+_Sat _Bool b; // expected-error{{'_Sat' specifier is only valid on '_Fract' or '_Accum', not '_Bool'}}
+_Sat char c; // expected-error{{'_Sat' specifier is only valid on '_Fract' or '_Accum', not 'char'}}
+_Sat int i; // expected-error{{'_Sat' specifier is only valid on '_Fract' or '_Accum', not 'int'}}
+_Sat _Sat _Fract fract; // expected-warning{{duplicate '_Sat' declaration specifier}}
+
+
+/* Literals that cannot fit into types */
+signed short _Accum s_short_accum = 256.0hk; // expected-error{{this value is too large for this fixed point type}}
+unsigned short _Accum u_short_accum = 256.0uhk; // expected-error{{this value is too large for this fixed point type}}
+signed _Accum s_accum = 65536.0k; // expected-error{{this value is too large for this fixed point type}}
+unsigned _Accum u_accum = 65536.0uk; // expected-error{{this value is too large for this fixed point type}}
+signed long _Accum s_long_accum = 4294967296.0lk; // expected-error{{this value is too large for this fixed point type}}
+unsigned long _Accum u_long_accum = 4294967296.0ulk; // expected-error{{this value is too large for this fixed point type}}
+
+// Large values from decimal exponents
+short _Accum short_accum_exp = 2.56e2hk; // expected-error{{this value is too large for this fixed point type}}
+_Accum accum_exp = 6.5536e4k; // expected-error{{this value is too large for this fixed point type}}
+long _Accum long_accum_exp = 4.294967296e9lk; // expected-error{{this value is too large for this fixed point type}}
+unsigned short _Accum u_short_accum_exp = 2.56e2uhk; // expected-error{{this value is too large for this fixed point type}}
+unsigned _Accum u_accum_exp = 6.5536e4uk; // expected-error{{this value is too large for this fixed point type}}
+unsigned long _Accum u_long_accum_exp = 4.294967296e9ulk; // expected-error{{this value is too large for this fixed point type}}
+
+// Large value from hexidecimal exponents
+short _Accum short_accum_hex_exp = 0x1p8hk; // expected-error{{this value is too large for this fixed point type}}
+_Accum accum_hex_exp = 0x1p16k; // expected-error{{this value is too large for this fixed point type}}
+long _Accum long_accum_hex_exp = 0x1p32lk; // expected-error{{this value is too large for this fixed point type}}
+unsigned short _Accum u_short_accum_hex_exp = 0x1p8uhk; // expected-error{{this value is too large for this fixed point type}}
+unsigned _Accum u_accum_hex_exp = 0x1p16uk; // expected-error{{this value is too large for this fixed point type}}
+unsigned long _Accum u_long_accum_hex_exp = 0x1p32ulk; // expected-error{{this value is too large for this fixed point type}}
+
+// Very large exponent
+_Accum x = 1e1000000000000000000000000000000000k; // expected-error{{this value is too large for this fixed point type}}
+
+/* Although _Fract's cannot equal 1, _Fract literals written as 1 are allowed
+ * and the underlying value represents the max value for that _Fract type. */
+short _Fract short_fract_above_1 = 1.1hr; // expected-error{{this value is too large for this fixed point type}}
+_Fract fract_above_1 = 1.1r; // expected-error{{this value is too large for this fixed point type}}
+long _Fract long_fract_above_1 = 1.1lr; // expected-error{{this value is too large for this fixed point type}}
+unsigned short _Fract u_short_fract_above_1 = 1.1uhr; // expected-error{{this value is too large for this fixed point type}}
+unsigned _Fract u_fract_above_1 = 1.1ur; // expected-error{{this value is too large for this fixed point type}}
+unsigned long _Fract u_long_fract_above_1 = 1.1ulr; // expected-error{{this value is too large for this fixed point type}}
+
+short _Fract short_fract_hex_exp = 0x0.fp1hr; // expected-error{{this value is too large for this fixed point type}}
+_Fract fract_hex_exp = 0x0.fp1r; // expected-error{{this value is too large for this fixed point type}}
+long _Fract long_fract_hex_exp = 0x0.fp1lr; // expected-error{{this value is too large for this fixed point type}}
+unsigned short _Fract u_short_fract_hex_exp = 0x0.fp1uhr; // expected-error{{this value is too large for this fixed point type}}
+unsigned _Fract u_fract_hex_exp = 0x0.fp1ur; // expected-error{{this value is too large for this fixed point type}}
+unsigned long _Fract u_long_fract_hex_exp = 0x0.fp1ulr; // expected-error{{this value is too large for this fixed point type}}
+
+/* Do not allow typedef to be used with typedef'd types */
+typedef short _Fract shortfract_t;
+typedef short _Accum shortaccum_t;
+typedef _Fract fract_t;
+typedef _Accum accum_t;
+typedef long _Fract longfract_t;
+typedef long _Accum longaccum_t;
+_Sat shortfract_t td_sat_short_fract; // expected-error{{'_Sat' specifier is only valid on '_Fract' or '_Accum', not 'type-name'}}
+_Sat shortaccum_t td_sat_short_accum; // expected-error{{'_Sat' specifier is only valid on '_Fract' or '_Accum', not 'type-name'}}
+_Sat fract_t td_sat_fract; // expected-error{{'_Sat' specifier is only valid on '_Fract' or '_Accum', not 'type-name'}}
+_Sat accum_t td_sat_accum; // expected-error{{'_Sat' specifier is only valid on '_Fract' or '_Accum', not 'type-name'}}
+_Sat longfract_t td_sat_long_fract; // expected-error{{'_Sat' specifier is only valid on '_Fract' or '_Accum', not 'type-name'}}
+_Sat longaccum_t td_sat_long_accum; // expected-error{{'_Sat' specifier is only valid on '_Fract' or '_Accum', not 'type-name'}}
+
+/* Bad suffixes */
+_Accum fk = 1.0fk; // expected-error{{invalid suffix 'fk' on integer constant}}
+_Accum kk = 1.0kk; // expected-error{{invalid suffix 'kk' on integer constant}}
+_Accum rk = 1.0rk; // expected-error{{invalid suffix 'rk' on integer constant}}
+_Accum rk = 1.0rr; // expected-error{{invalid suffix 'rr' on integer constant}}
+_Accum qk = 1.0qr; // expected-error{{invalid suffix 'qr' on integer constant}}
+
+/* Using wrong exponent notation */
+_Accum dec_with_hex_exp1 = 0.1p10k; // expected-error{{invalid suffix 'p10k' on integer constant}}
+_Accum dec_with_hex_exp2 = 0.1P10k; // expected-error{{invalid suffix 'P10k' on integer constant}}
+_Accum hex_with_dex_exp1 = 0x0.1e10k; // expected-error{{hexadecimal floating constant requires an exponent}}
+_Accum hex_with_dex_exp2 = 0x0.1E10k; // expected-error{{hexadecimal floating constant requires an exponent}}
+
+void CheckSuffixOnIntegerLiterals() {
+ _Accum short_acc_int;
+ _Accum acc_int;
+ _Accum long_acc_int;
+
+ _Accum u_short_acc_int;
+ _Accum u_acc_int;
+ _Accum u_long_acc_int;
+
+ _Fract short_fract_int;
+ _Fract fract_int;
+ _Fract long_fract_int;
+
+ _Fract u_short_fract_int;
+ _Fract u_fract_int;
+ _Fract u_long_fract_int;
+
+ // Decimal integer literals (non-zero)
+ short_acc_int = 10hk; // expected-error{{invalid suffix 'hk' on integer constant}}
+ acc_int = 10k; // expected-error{{invalid suffix 'k' on integer constant}}
+ long_acc_int = 10lk; // expected-error{{invalid suffix 'lk' on integer constant}}
+
+ u_short_acc_int = 10uhk; // expected-error{{invalid suffix 'uhk' on integer constant}}
+ u_acc_int = 10uk; // expected-error{{invalid suffix 'uk' on integer constant}}
+ u_long_acc_int = 10ulk; // expected-error{{invalid suffix 'ulk' on integer constant}}
+
+ short_fract_int = 10hr; // expected-error{{invalid suffix 'hr' on integer constant}}
+ fract_int = 10r; // expected-error{{invalid suffix 'r' on integer constant}}
+ long_fract_int = 10lr; // expected-error{{invalid suffix 'lr' on integer constant}}
+
+ u_short_fract_int = 10uhr; // expected-error{{invalid suffix 'uhr' on integer constant}}
+ u_fract_int = 10ur; // expected-error{{invalid suffix 'ur' on integer constant}}
+ u_long_fract_int = 10ulr; // expected-error{{invalid suffix 'ulr' on integer constant}}
+
+ // Decimal integer literals (0)
+ short_acc_int = 0hk; // expected-error{{invalid suffix 'hk' on integer constant}}
+ acc_int = 0k; // expected-error{{invalid suffix 'k' on integer constant}}
+ long_acc_int = 0lk; // expected-error{{invalid suffix 'lk' on integer constant}}
+
+ // Decimal integer literals (large number)
+ acc_int = 999999999999999999k; // expected-error{{invalid suffix 'k' on integer constant}}
+ fract_int = 999999999999999999r; // expected-error{{invalid suffix 'r' on integer constant}}
+
+ // Octal integer literals
+ short_acc_int = 010hk; // expected-error{{invalid suffix 'hk' on integer constant}}
+ acc_int = 010k; // expected-error{{invalid suffix 'k' on integer constant}}
+ long_acc_int = 010lk; // expected-error{{invalid suffix 'lk' on integer constant}}
+
+ u_short_acc_int = 010uhk; // expected-error{{invalid suffix 'uhk' on integer constant}}
+ u_acc_int = 010uk; // expected-error{{invalid suffix 'uk' on integer constant}}
+ u_long_acc_int = 010ulk; // expected-error{{invalid suffix 'ulk' on integer constant}}
+
+ short_fract_int = 010hr; // expected-error{{invalid suffix 'hr' on integer constant}}
+ fract_int = 010r; // expected-error{{invalid suffix 'r' on integer constant}}
+ long_fract_int = 010lr; // expected-error{{invalid suffix 'lr' on integer constant}}
+
+ u_short_fract_int = 010uhr; // expected-error{{invalid suffix 'uhr' on integer constant}}
+ u_fract_int = 010ur; // expected-error{{invalid suffix 'ur' on integer constant}}
+ u_long_fract_int = 010ulr; // expected-error{{invalid suffix 'ulr' on integer constant}}
+
+ // Hexadecimal integer literals
+ short_acc_int = 0x10hk; // expected-error{{invalid suffix 'hk' on integer constant}}
+ acc_int = 0x10k; // expected-error{{invalid suffix 'k' on integer constant}}
+ long_acc_int = 0x10lk; // expected-error{{invalid suffix 'lk' on integer constant}}
+
+ u_short_acc_int = 0x10uhk; // expected-error{{invalid suffix 'uhk' on integer constant}}
+ u_acc_int = 0x10uk; // expected-error{{invalid suffix 'uk' on integer constant}}
+ u_long_acc_int = 0x10ulk; // expected-error{{invalid suffix 'ulk' on integer constant}}
+
+ short_fract_int = 0x10hr; // expected-error{{invalid suffix 'hr' on integer constant}}
+ fract_int = 0x10r; // expected-error{{invalid suffix 'r' on integer constant}}
+ long_fract_int = 0x10lr; // expected-error{{invalid suffix 'lr' on integer constant}}
+
+ u_short_fract_int = 0x10uhr; // expected-error{{invalid suffix 'uhr' on integer constant}}
+ u_fract_int = 0x10ur; // expected-error{{invalid suffix 'ur' on integer constant}}
+ u_long_fract_int = 0x10ulr; // expected-error{{invalid suffix 'ulr' on integer constant}}
+
+ // Using auto
+ auto auto_fract = 0r; // expected-error{{invalid suffix 'r' on integer constant}}
+ // expected-warning@-1{{type specifier missing, defaults to 'int'}}
+ auto auto_accum = 0k; // expected-error{{invalid suffix 'k' on integer constant}}
+ // expected-warning@-1{{type specifier missing, defaults to 'int'}}
+}
diff --git a/test/Frontend/fixed_point_errors.cpp b/test/Frontend/fixed_point_errors.cpp
new file mode 100644
index 000000000000..cdd90ceb7548
--- /dev/null
+++ b/test/Frontend/fixed_point_errors.cpp
@@ -0,0 +1,14 @@
+// RUN: %clang_cc1 -x c++ %s -verify
+// RUN: %clang_cc1 -x c++ -ffixed-point %s -verify
+
+// Name namgling is not provided for fixed point types in c++
+
+_Accum accum; // expected-error{{unknown type name '_Accum'}}
+_Fract fract; // expected-error{{unknown type name '_Fract'}}
+_Sat _Accum sat_accum; // expected-error{{unknown type name '_Sat'}}
+ // expected-error@-1{{expected ';' after top level declarator}}
+
+int accum_int = 10k; // expected-error{{invalid suffix 'k' on integer constant}}
+int fract_int = 10r; // expected-error{{invalid suffix 'r' on integer constant}}
+float accum_flt = 10.0k; // expected-error{{invalid suffix 'k' on floating constant}}
+float fract_flt = 10.0r; // expected-error{{invalid suffix 'r' on floating constant}}
diff --git a/test/Frontend/fixed_point_not_enabled.c b/test/Frontend/fixed_point_not_enabled.c
new file mode 100644
index 000000000000..e7522213f98d
--- /dev/null
+++ b/test/Frontend/fixed_point_not_enabled.c
@@ -0,0 +1,21 @@
+// RUN: %clang_cc1 -x c -verify %s
+
+// Primary fixed point types
+signed short _Accum s_short_accum; // expected-error{{compile with '-ffixed-point' to enable fixed point types}}
+signed _Accum s_accum; // expected-error{{compile with '-ffixed-point' to enable fixed point types}}
+signed long _Accum s_long_accum; // expected-error{{compile with '-ffixed-point' to enable fixed point types}}
+unsigned short _Accum u_short_accum; // expected-error{{compile with '-ffixed-point' to enable fixed point types}}
+unsigned _Accum u_accum; // expected-error{{compile with '-ffixed-point' to enable fixed point types}}
+unsigned long _Accum u_long_accum; // expected-error{{compile with '-ffixed-point' to enable fixed point types}}
+
+// Aliased fixed point types
+short _Accum short_accum; // expected-error{{compile with '-ffixed-point' to enable fixed point types}}
+_Accum accum; // expected-error{{compile with '-ffixed-point' to enable fixed point types}}
+ // expected-warning@-1{{type specifier missing, defaults to 'int'}}
+long _Accum long_accum; // expected-error{{compile with '-ffixed-point' to enable fixed point types}}
+
+// Cannot use fixed point suffixes
+int accum_int = 10k; // expected-error{{invalid suffix 'k' on integer constant}}
+int fract_int = 10r; // expected-error{{invalid suffix 'r' on integer constant}}
+float accum_flt = 10.0k; // expected-error{{invalid suffix 'k' on floating constant}}
+float fract_flt = 10.0r; // expected-error{{invalid suffix 'r' on floating constant}}
diff --git a/test/Frontend/fixed_point_same_fbits.c b/test/Frontend/fixed_point_same_fbits.c
new file mode 100644
index 000000000000..1d116b7dfa21
--- /dev/null
+++ b/test/Frontend/fixed_point_same_fbits.c
@@ -0,0 +1,28 @@
+// RUN: %clang -ffixed-point -S -emit-llvm -o - %s | FileCheck %s -check-prefix=DEFAULT
+// RUN: %clang_cc1 -ffixed-point -fpadding-on-unsigned-fixed-point -S -emit-llvm -o - %s | FileCheck %s -check-prefix=SAME
+
+/* The scale for unsigned fixed point types should be the same as that of signed
+ * fixed point types when -fsame-fbits is enabled. */
+
+void func() {
+ unsigned short _Accum u_short_accum = 0.5uhk;
+ unsigned _Accum u_accum = 0.5uk;
+ unsigned long _Accum u_long_accum = 0.5ulk;
+ unsigned short _Fract u_short_fract = 0.5uhr;
+ unsigned _Fract u_fract = 0.5ur;
+ unsigned long _Fract u_long_fract = 0.5ulr;
+
+// DEFAULT: store i16 128, i16* {{.*}}, align 2
+// DEFAULT: store i32 32768, i32* {{.*}}, align 4
+// DEFAULT: store i64 2147483648, i64* {{.*}}, align 8
+// DEFAULT: store i8 -128, i8* {{.*}}, align 1
+// DEFAULT: store i16 -32768, i16* {{.*}}, align 2
+// DEFAULT: store i32 -2147483648, i32* {{.*}}, align 4
+
+// SAME: store i16 64, i16* {{.*}}, align 2
+// SAME: store i32 16384, i32* {{.*}}, align 4
+// SAME: store i64 1073741824, i64* {{.*}}, align 8
+// SAME: store i8 64, i8* {{.*}}, align 1
+// SAME: store i16 16384, i16* {{.*}}, align 2
+// SAME: store i32 1073741824, i32* {{.*}}, align 4
+}
diff --git a/test/Frontend/ftime-report-template-decl.cpp b/test/Frontend/ftime-report-template-decl.cpp
new file mode 100644
index 000000000000..9ba9107b9804
--- /dev/null
+++ b/test/Frontend/ftime-report-template-decl.cpp
@@ -0,0 +1,159 @@
+// RUN: %clang_cc1 %s -emit-llvm -o - -ftime-report 2>&1 | FileCheck %s
+// RUN: %clang_cc1 %s -emit-llvm -o - -fdelayed-template-parsing -DDELAYED_TEMPLATE_PARSING -ftime-report 2>&1 | FileCheck %s
+
+// Template function declarations
+template <typename T>
+void foo();
+template <typename T, typename U>
+void foo();
+
+// Template function definitions.
+template <typename T>
+void foo() {}
+
+// Template class (forward) declarations
+template <typename T>
+struct A;
+template <typename T, typename U>
+struct b;
+template <typename>
+struct C;
+template <typename, typename>
+struct D;
+
+// Forward declarations with default parameters?
+template <typename T = int>
+class X1;
+template <typename = int>
+class X2;
+
+// Forward declarations w/template template parameters
+template <template <typename> class T>
+class TTP1;
+template <template <typename> class>
+class TTP2;
+template <template <typename X, typename Y> class T>
+class TTP5;
+
+// Forward declarations with non-type params
+template <int>
+class NTP0;
+template <int N>
+class NTP1;
+template <int N = 5>
+class NTP2;
+template <int = 10>
+class NTP3;
+template <unsigned int N = 12u>
+class NTP4;
+template <unsigned int = 12u>
+class NTP5;
+template <unsigned = 15u>
+class NTP6;
+template <typename T, T Obj>
+class NTP7;
+
+// Template class declarations
+template <typename T>
+struct A {};
+template <typename T, typename U>
+struct B {};
+
+namespace PR6184 {
+namespace N {
+template <typename T>
+void bar(typename T::x);
+}
+
+template <typename T>
+void N::bar(typename T::x) {}
+}
+
+// This PR occurred only in template parsing mode.
+namespace PR17637 {
+template <int>
+struct L {
+ template <typename T>
+ struct O {
+ template <typename U>
+ static void Fun(U);
+ };
+};
+
+template <int k>
+template <typename T>
+template <typename U>
+void L<k>::O<T>::Fun(U) {}
+
+void Instantiate() { L<0>::O<int>::Fun(0); }
+}
+
+namespace explicit_partial_specializations {
+typedef char (&oneT)[1];
+typedef char (&twoT)[2];
+typedef char (&threeT)[3];
+typedef char (&fourT)[4];
+typedef char (&fiveT)[5];
+typedef char (&sixT)[6];
+
+char one[1];
+char two[2];
+char three[3];
+char four[4];
+char five[5];
+char six[6];
+
+template <bool b>
+struct bool_ { typedef int type; };
+template <>
+struct bool_<false> {};
+
+#define XCAT(x, y) x##y
+#define CAT(x, y) XCAT(x, y)
+#define sassert(_b_) bool_<(_b_)>::type CAT(var, __LINE__);
+
+template <int>
+struct L {
+ template <typename T>
+ struct O {
+ template <typename U>
+ static oneT Fun(U);
+ };
+};
+template <int k>
+template <typename T>
+template <typename U>
+oneT L<k>::O<T>::Fun(U) { return one; }
+
+template <>
+template <>
+template <typename U>
+oneT L<0>::O<char>::Fun(U) { return one; }
+
+void Instantiate() {
+ sassert(sizeof(L<0>::O<int>::Fun(0)) == sizeof(one));
+ sassert(sizeof(L<0>::O<char>::Fun(0)) == sizeof(one));
+}
+}
+
+template <class>
+struct Foo {
+ template <class _Other>
+ using rebind_alloc = _Other;
+};
+template <class _Alloc>
+struct _Wrap_alloc {
+ template <class _Other>
+ using rebind_alloc = typename Foo<_Alloc>::template rebind_alloc<_Other>;
+ template <class>
+ using rebind = _Wrap_alloc;
+};
+_Wrap_alloc<int>::rebind<int> w;
+
+// CHECK: Miscellaneous Ungrouped Timers
+// CHECK-DAG: LLVM IR Generation Time
+// CHECK-DAG: Code Generation Time
+// CHECK: Total
+// CHECK: Clang front-end time report
+// CHECK: Clang front-end timer
+// CHECK: Total
diff --git a/test/Frontend/gnu-mcount.c b/test/Frontend/gnu-mcount.c
index 3953d2415382..baac555d1394 100644
--- a/test/Frontend/gnu-mcount.c
+++ b/test/Frontend/gnu-mcount.c
@@ -59,7 +59,7 @@ int f() {
// CHECK-ARM-EABI-FREEBSD-NOT: attributes #{{[0-9]+}} = { {{.*}}"instrument-function-entry-inlined"="\01__gnu_mcount_nc"{{.*}} }
// CHECK-ARM64-EABI-FREEBSD: attributes #{{[0-9]+}} = { {{.*}}"instrument-function-entry-inlined"=".mcount"{{.*}} }
// CHECK-ARM64-EABI-FREEBSD-NOT: attributes #{{[0-9]+}} = { {{.*}}"instrument-function-entry-inlined"="\01__gnu_mcount_nc"{{.*}} }
-// CHECK-ARM-EABI-NETBSD: attributes #{{[0-9]+}} = { {{.*}}"instrument-function-entry-inlined"="_mcount"{{.*}} }
+// CHECK-ARM-EABI-NETBSD: attributes #{{[0-9]+}} = { {{.*}}"instrument-function-entry-inlined"="__mcount"{{.*}} }
// CHECK-ARM-EABI-NETBSD-NOT: attributes #{{[0-9]+}} = { {{.*}}"instrument-function-entry-inlined"="\01__gnu_mcount_nc"{{.*}} }
// CHECK-ARM-EABI-OPENBSD: attributes #{{[0-9]+}} = { {{.*}}"instrument-function-entry-inlined"="__mcount"{{.*}} }
// CHECK-ARM-EABI-OPENBSD-NOT: attributes #{{[0-9]+}} = { {{.*}}"instrument-function-entry-inlined"="\01__gnu_mcount_nc"{{.*}} }
diff --git a/test/Frontend/nostdlib-for-asmpp.s b/test/Frontend/nostdlib-for-asmpp.s
new file mode 100644
index 000000000000..330fee32a361
--- /dev/null
+++ b/test/Frontend/nostdlib-for-asmpp.s
@@ -0,0 +1,5 @@
+// RUN: %clang -cc1 -x assembler-with-cpp -triple arm64-apple-ios6.0.0 -isysroot %S/doesnotexist -std=c++11 -v %s 2>&1 | FileCheck %s
+// The C++ stdlib path should not be included for an assembly source.
+
+// CHECK-NOT: usr/include/c++/
+// CHECK-NOT: include path for stdlibc++ headers not found; pass '-std=libc++' on the command line to use the libc++ standard library instead
diff --git a/test/Frontend/opencl.cl b/test/Frontend/opencl.cl
index 95b5f1471625..facc735330d4 100644
--- a/test/Frontend/opencl.cl
+++ b/test/Frontend/opencl.cl
@@ -1,24 +1,33 @@
-// RUN: %clang_cc1 %s -verify -fsyntax-only
-// RUN: %clang_cc1 %s -verify -fsyntax-only -cl-std=CL1.1
-// RUN: %clang_cc1 %s -verify -fsyntax-only -cl-std=CL1.2
-// RUN: %clang_cc1 %s -verify -fsyntax-only -cl-std=CL2.0
-// RUN: %clang_cc1 %s -verify -fsyntax-only -fblocks -DBLOCKS
-// RUN: %clang_cc1 %s -verify -fsyntax-only -cl-std=CL1.1 -fblocks -DBLOCKS
-// RUN: %clang_cc1 %s -verify -fsyntax-only -cl-std=CL1.2 -fblocks -DBLOCKS
-// RUN: %clang_cc1 %s -triple amdgcn--amdhsa -x c -std=c99 -verify -fsyntax-only
+// RUN: %clang_cc1 %s -verify -fsyntax-only -DSYNTAX
+// RUN: %clang_cc1 %s -verify -fsyntax-only -cl-std=CL1.1 -DSYNTAX
+// RUN: %clang_cc1 %s -verify -fsyntax-only -cl-std=CL1.2 -DSYNTAX
+// RUN: %clang_cc1 %s -verify -fsyntax-only -cl-std=CL2.0 -DSYNTAX
+// RUN: %clang_cc1 %s -verify -fsyntax-only -cl-std=c++ -DSYNTAX
+// RUN: %clang_cc1 %s -verify -fsyntax-only -fblocks -DBLOCKS -DSYNTAX
+// RUN: %clang_cc1 %s -verify -fsyntax-only -cl-std=CL1.1 -fblocks -DBLOCKS -DSYNTAX
+// RUN: %clang_cc1 %s -verify -fsyntax-only -cl-std=CL1.2 -fblocks -DBLOCKS -DSYNTAX
+// RUN: %clang_cc1 %s -triple amdgcn--amdhsa -x c -std=c99 -verify -fsyntax-only -DSYNTAX
// RUN: %clang_cc1 -cl-std=CL1.1 -cl-strict-aliasing -fblocks %s 2>&1 | FileCheck --check-prefix=CHECK-INVALID-OPENCL-VERSION11 %s
// RUN: %clang_cc1 -cl-std=CL1.2 -cl-strict-aliasing -fblocks %s 2>&1 | FileCheck --check-prefix=CHECK-INVALID-OPENCL-VERSION12 %s
// RUN: %clang_cc1 -cl-std=CL2.0 -cl-strict-aliasing %s 2>&1 | FileCheck --check-prefix=CHECK-INVALID-OPENCL-VERSION20 %s
+#ifdef SYNTAX
+class test{
+int member;
+};
+#ifndef __OPENCL_CPP_VERSION__
+//expected-error@-4{{unknown type name 'class'}}
+//expected-error@-5{{expected ';' after top level declarator}}
+#endif
+#endif
+
void f(void (^g)(void)) {
-#ifdef __OPENCL_C_VERSION__
-#if __OPENCL_C_VERSION__ < CL_VERSION_2_0 && !defined(BLOCKS)
- // expected-error@-3{{blocks support disabled - compile with -fblocks or for OpenCL 2.0 or above}}
-#else
- // expected-no-diagnostics
+#if defined(__OPENCL_C_VERSION__) || defined(__OPENCL_CPP_VERSION__)
+#if !defined(BLOCKS) && (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ != CL_VERSION_2_0)
+ // expected-error@-3{{blocks support disabled - compile with -fblocks or for OpenCL 2.0}}
#endif
#else
- // expected-error@-8{{blocks support disabled - compile with -fblocks or pick a deployment target that supports them}}
+ // expected-error@-6{{blocks support disabled - compile with -fblocks or pick a deployment target that supports them}}
#endif
}
diff --git a/test/Frontend/print-header-includes.c b/test/Frontend/print-header-includes.c
index 045c02b941bc..7da56e23d708 100644
--- a/test/Frontend/print-header-includes.c
+++ b/test/Frontend/print-header-includes.c
@@ -5,16 +5,24 @@
// CHECK: . {{.*test.h}}
// CHECK: .. {{.*test2.h}}
-// RUN: %clang_cc1 -I%S -include Inputs/test3.h -E --show-includes -o /dev/null %s | \
-// RUN: FileCheck --strict-whitespace --check-prefix=MS %s
-// MS-NOT: <command line>
-// MS: Note: including file: {{[^ ]*test3.h}}
-// MS: Note: including file: {{[^ ]*test.h}}
-// MS: Note: including file: {{[^ ]*test2.h}}
-// MS-NOT: Note
+// RUN: %clang_cc1 -I%S -include Inputs/test3.h --show-includes -o /dev/null %s | \
+// RUN: FileCheck --strict-whitespace --check-prefix=MS-STDOUT %s
+// MS-STDOUT-NOT: <command line>
+// MS-STDOUT: Note: including file: {{[^ ]*test3.h}}
+// MS-STDOUT: Note: including file: {{[^ ]*test.h}}
+// MS-STDOUT: Note: including file: {{[^ ]*test2.h}}
+// MS-STDOUT-NOT: Note
+
+// RUN: %clang_cc1 -I%S -include Inputs/test3.h -E --show-includes -o /dev/null %s 2> %t.stderr
+// RUN: FileCheck --strict-whitespace --check-prefix=MS-STDERR < %t.stderr %s
+// MS-STDERR-NOT: <command line>
+// MS-STDERR: Note: including file: {{[^ ]*test3.h}}
+// MS-STDERR: Note: including file: {{[^ ]*test.h}}
+// MS-STDERR: Note: including file: {{[^ ]*test2.h}}
+// MS-STDERR-NOT: Note
// RUN: echo "fun:foo" > %t.blacklist
-// RUN: %clang_cc1 -I%S -fsanitize=address -fdepfile-entry=%t.blacklist -E --show-includes -o /dev/null %s | \
+// RUN: %clang_cc1 -I%S -fsanitize=address -fdepfile-entry=%t.blacklist --show-includes -o /dev/null %s | \
// RUN: FileCheck --strict-whitespace --check-prefix=MS-BLACKLIST %s
// MS-BLACKLIST: Note: including file: {{[^ ]*\.blacklist}}
// MS-BLACKLIST: Note: including file: {{[^ ]*test.h}}
diff --git a/test/Frontend/region-pragmas.c b/test/Frontend/region-pragmas.c
new file mode 100644
index 000000000000..8d929e8414fd
--- /dev/null
+++ b/test/Frontend/region-pragmas.c
@@ -0,0 +1,5 @@
+// RUN: %clang_cc1 -Wall -verify %s
+// expected-no-diagnostics
+
+#pragma region foo
+#pragma endregion foo
diff --git a/test/Frontend/rewrite-includes-messages.c b/test/Frontend/rewrite-includes-messages.c
index f93fe72e58d5..a3a5cb2eae6c 100644
--- a/test/Frontend/rewrite-includes-messages.c
+++ b/test/Frontend/rewrite-includes-messages.c
@@ -1,6 +1,6 @@
// RUN: %clang_cc1 -E -frewrite-includes %s -I%S/Inputs/ | %clang_cc1 -Wall -fsyntax-only -Wunused-macros -x c - 2>&1 > %t.1
// RUN: %clang_cc1 -I%S/Inputs/ -Wall -Wunused-macros -fsyntax-only %s 2>&1 > %t.2
-// RUN: diff %t.1 %t.2 -u
+// RUN: diff -u %t.1 %t.2
// expected-no-diagnostics
#include "rewrite-includes-messages.h"
diff --git a/test/Frontend/rewrite-includes.c b/test/Frontend/rewrite-includes.c
index bed87efa1f7a..630e761cab2f 100644
--- a/test/Frontend/rewrite-includes.c
+++ b/test/Frontend/rewrite-includes.c
@@ -1,5 +1,5 @@
-// RUN: not %clang_cc1 -verify -E -frewrite-includes -DFIRST -I %S/Inputs %s -o - | FileCheck -strict-whitespace %s
-// RUN: not %clang_cc1 -verify -E -frewrite-includes -P -DFIRST -I %S/Inputs %s -o - | FileCheck -check-prefix=CHECKNL -strict-whitespace %s
+// RUN: not %clang_cc1 -verify -E -frewrite-includes -DFIRST -I %S/Inputs -I %S/Inputs/NextIncludes %s -o - | FileCheck -strict-whitespace %s
+// RUN: not %clang_cc1 -verify -E -frewrite-includes -P -DFIRST -I %S/Inputs -I %S/Inputs/NextIncludes %s -o - | FileCheck -check-prefix=CHECKNL -strict-whitespace %s
// STARTCOMPARE
#define A(a,b) a ## b
A(1,2)
@@ -20,6 +20,7 @@ A(1,2)
#include "rewrite-includes7.h"
#include "rewrite-includes7.h"
#include "rewrite-includes8.h"
+#include "rewrite-includes9.h"
// ENDCOMPARE
// CHECK: {{^}}# 1 "{{.*}}rewrite-includes.c"{{$}}
// CHECK: {{^}}// STARTCOMPARE{{$}}
@@ -109,7 +110,7 @@ A(1,2)
// CHECK-NEXT: {{^}}#endif /* expanded by -frewrite-includes */{{$}}
// CHECK-NEXT: {{^}}# 22 "{{.*}}rewrite-includes.c"{{$}}
// CHECK-NEXT: {{^}}# 1 "{{.*[/\\]Inputs(/|\\\\)}}rewrite-includes8.h" 1{{$}}
-// CHECK-NEXT: {{^}}#if (1)/*__has_include_next(<rewrite-includes8.h>)*/{{$}}
+// CHECK-NEXT: {{^}}#if (0)/*__has_include_next(<rewrite-includes8.h>)*/{{$}}
// CHECK-NEXT: {{^}}#elif (0)/*__has_include(<rewrite-includes8.hfail>)*/{{$}}
// CHECK-NEXT: {{^}}# 3 "{{.*[/\\]Inputs(/|\\\\)}}rewrite-includes8.h"{{$}}
// CHECK-NEXT: {{^}}#endif{{$}}
@@ -118,6 +119,22 @@ A(1,2)
// CHECK-NEXT: {{^}}#endif{{$}}
// CHECK-NEXT: {{^}}# 6 "{{.*[/\\]Inputs(/|\\\\)}}rewrite-includes8.h"{{$}}
// CHECK-NEXT: {{^}}# 23 "{{.*}}rewrite-includes.c" 2{{$}}
+// CHECK-NEXT: {{^}}#if 0 /* expanded by -frewrite-includes */{{$}}
+// CHECK-NEXT: {{^}}#include "rewrite-includes9.h"{{$}}
+// CHECK-NEXT: {{^}}#endif /* expanded by -frewrite-includes */{{$}}
+// CHECK-NEXT: {{^}}# 23 "{{.*}}rewrite-includes.c"{{$}}
+// CHECK-NEXT: {{^}}# 1 "{{.*[/\\]Inputs(/|\\\\)}}rewrite-includes9.h" 1{{$}}
+// CHECK-NEXT: {{^}}#if (1)/*__has_include_next(<rewrite-includes9.h>)*/{{$}}
+// CHECK-NEXT: {{^}}#if 0 /* expanded by -frewrite-includes */{{$}}
+// CHECK-NEXT: {{^}}#include_next <rewrite-includes9.h>{{$}}
+// CHECK-NEXT: {{^}}#endif /* expanded by -frewrite-includes */{{$}}
+// CHECK-NEXT: {{^}}# 2 "{{.*[/\\]Inputs(/|\\\\)}}rewrite-includes9.h"{{$}}
+// CHECK-NEXT: {{^}}# 1 "{{.*[/\\]Inputs(/|\\\\)NextIncludes(/|\\\\)}}rewrite-includes9.h" 1{{$}}
+// CHECK-NEXT: {{^}}included_line9{{$}}
+// CHECK-NEXT: {{^}}# 3 "{{.*[/\\]Inputs(/|\\\\)}}rewrite-includes9.h" 2{{$}}
+// CHECK-NEXT: {{^}}#endif{{$}}
+// CHECK-NEXT: {{^}}# 4 "{{.*[/\\]Inputs(/|\\\\)}}rewrite-includes9.h"{{$}}
+// CHECK-NEXT: {{^}}# 24 "{{.*}}rewrite-includes.c" 2{{$}}
// CHECK-NEXT: {{^}}// ENDCOMPARE{{$}}
// CHECKNL: {{^}}// STARTCOMPARE{{$}}
@@ -176,9 +193,18 @@ A(1,2)
// CHECKNL-NEXT: {{^}}#if 0 /* expanded by -frewrite-includes */{{$}}
// CHECKNL-NEXT: {{^}}#include "rewrite-includes8.h"{{$}}
// CHECKNL-NEXT: {{^}}#endif /* expanded by -frewrite-includes */{{$}}
-// CHECKNL-NEXT: {{^}}#if (1)/*__has_include_next(<rewrite-includes8.h>)*/{{$}}
+// CHECKNL-NEXT: {{^}}#if (0)/*__has_include_next(<rewrite-includes8.h>)*/{{$}}
// CHECKNL-NEXT: {{^}}#elif (0)/*__has_include(<rewrite-includes8.hfail>)*/{{$}}
// CHECKNL-NEXT: {{^}}#endif{{$}}
// CHECKNL-NEXT: {{^}}#if !(1)/*__has_include("rewrite-includes8.h")*/{{$}}
// CHECKNL-NEXT: {{^}}#endif{{$}}
+// CHECKNL-NEXT: {{^}}#if 0 /* expanded by -frewrite-includes */{{$}}
+// CHECKNL-NEXT: {{^}}#include "rewrite-includes9.h"{{$}}
+// CHECKNL-NEXT: {{^}}#endif /* expanded by -frewrite-includes */{{$}}
+// CHECKNL-NEXT: {{^}}#if (1)/*__has_include_next(<rewrite-includes9.h>)*/{{$}}
+// CHECKNL-NEXT: {{^}}#if 0 /* expanded by -frewrite-includes */{{$}}
+// CHECKNL-NEXT: {{^}}#include_next <rewrite-includes9.h>{{$}}
+// CHECKNL-NEXT: {{^}}#endif /* expanded by -frewrite-includes */{{$}}
+// CHECKNL-NEXT: {{^}}included_line9{{$}}
+// CHECKNL-NEXT: {{^}}#endif{{$}}
// CHECKNL-NEXT: {{^}}// ENDCOMPARE{{$}}
diff --git a/test/Frontend/stdlang.c b/test/Frontend/stdlang.c
index 9c3c3078aaf2..2b24c2dfea31 100644
--- a/test/Frontend/stdlang.c
+++ b/test/Frontend/stdlang.c
@@ -4,6 +4,7 @@
// RUN: %clang_cc1 -x cl -cl-std=cl1.1 -DOPENCL %s
// RUN: %clang_cc1 -x cl -cl-std=cl1.2 -DOPENCL %s
// RUN: %clang_cc1 -x cl -cl-std=cl2.0 -DOPENCL %s
+// RUN: %clang_cc1 -x cl -cl-std=c++ -DOPENCL %s
// RUN: %clang_cc1 -x cl -cl-std=CL -DOPENCL %s
// RUN: %clang_cc1 -x cl -cl-std=CL1.1 -DOPENCL %s
// RUN: %clang_cc1 -x cl -cl-std=CL1.2 -DOPENCL %s
diff --git a/test/Frontend/unknown-arg.c b/test/Frontend/unknown-arg.c
new file mode 100644
index 000000000000..00f2da6242c7
--- /dev/null
+++ b/test/Frontend/unknown-arg.c
@@ -0,0 +1,9 @@
+// RUN: not %clang_cc1 %s -E --helium 2>&1 | \
+// RUN: FileCheck %s
+// RUN: not %clang_cc1 %s -E --hel[ 2>&1 | \
+// RUN: FileCheck %s --check-prefix=DID-YOU-MEAN
+// RUN: not %clang %s -E -Xclang --hel[ 2>&1 | \
+// RUN: FileCheck %s --check-prefix=DID-YOU-MEAN
+
+// CHECK: error: unknown argument: '--helium'
+// DID-YOU-MEAN: error: unknown argument '--hel[', did you mean '--help'?
diff --git a/test/Frontend/warning-stdlibcxx-darwin.cpp b/test/Frontend/warning-stdlibcxx-darwin.cpp
new file mode 100644
index 000000000000..3c132b6a833b
--- /dev/null
+++ b/test/Frontend/warning-stdlibcxx-darwin.cpp
@@ -0,0 +1,5 @@
+// RUN: %clang -cc1 -triple arm64-apple-ios6.0.0 -isysroot %S/doesnotexist %s 2>&1 | FileCheck %s
+// RUN: %clang -cc1 -triple arm64-apple-ios6.0.0 -isysroot %S/doesnotexist -stdlib=libc++ %s -verify
+// CHECK: include path for stdlibc++ headers not found; pass '-std=libc++' on the command line to use the libc++ standard library instead
+
+// expected-no-diagnostics
diff --git a/test/Frontend/windows-exceptions.cpp b/test/Frontend/windows-exceptions.cpp
new file mode 100644
index 000000000000..56316872be48
--- /dev/null
+++ b/test/Frontend/windows-exceptions.cpp
@@ -0,0 +1,27 @@
+// RUN: %clang_cc1 -triple i686--windows-msvc -fsyntax-only %s
+// RUN: not %clang_cc1 -triple i686--windows-msvc -fsyntax-only -fdwarf-exceptions %s 2>&1 | FileCheck -check-prefix=MSVC-X86-DWARF %s
+// RUN: not %clang_cc1 -triple i686--windows-msvc -fsyntax-only -fseh-exceptions %s 2>&1 | FileCheck -check-prefix=MSVC-X86-SEH %s
+// RUN: not %clang_cc1 -triple i686--windows-msvc -fsyntax-only -fsjlj-exceptions %s 2>&1 | FileCheck -check-prefix=MSVC-X86-SJLJ %s
+
+// RUN: %clang_cc1 -triple x86_64--windows-msvc -fsyntax-only %s
+// RUN: not %clang_cc1 -triple x86_64--windows-msvc -fsyntax-only -fdwarf-exceptions %s 2>&1 | FileCheck -check-prefix=MSVC-X64-DWARF %s
+// RUN: not %clang_cc1 -triple x86_64--windows-msvc -fsyntax-only -fseh-exceptions %s 2>&1 | FileCheck -check-prefix=MSVC-X64-SEH %s
+// RUN: not %clang_cc1 -triple x86_64--windows-msvc -fsyntax-only -fsjlj-exceptions %s 2>&1 | FileCheck -check-prefix=MSVC-X64-SJLJ %s
+
+// RUN: %clang_cc1 -triple i686--windows-gnu -fsyntax-only %s
+// RUN: %clang_cc1 -triple i686--windows-gnu -fsyntax-only -fdwarf-exceptions %s
+// RUN: %clang_cc1 -triple i686--windows-gnu -fsyntax-only -fseh-exceptions %s
+// RUN: %clang_cc1 -triple i686--windows-gnu -fsyntax-only -fsjlj-exceptions %s
+
+// RUN: %clang_cc1 -triple x86_64--windows-gnu -fsyntax-only %s
+// RUN: %clang_cc1 -triple x86_64--windows-gnu -fsyntax-only -fdwarf-exceptions %s
+// RUN: %clang_cc1 -triple x86_64--windows-gnu -fsyntax-only -fseh-exceptions %s
+// RUN: %clang_cc1 -triple x86_64--windows-gnu -fsyntax-only -fsjlj-exceptions %s
+
+// MSVC-X86-DWARF: error: invalid exception model 'fdwarf-exceptions' for target 'i686--windows-msvc'
+// MSVC-X86-SEH: error: invalid exception model 'fseh-exceptions' for target 'i686--windows-msvc'
+// MSVC-X86-SJLJ: error: invalid exception model 'fsjlj-exceptions' for target 'i686--windows-msvc'
+
+// MSVC-X64-DWARF: error: invalid exception model 'fdwarf-exceptions' for target 'x86_64--windows-msvc'
+// MSVC-X64-SEH: error: invalid exception model 'fseh-exceptions' for target 'x86_64--windows-msvc'
+// MSVC-X64-SJLJ: error: invalid exception model 'fsjlj-exceptions' for target 'x86_64--windows-msvc'
diff --git a/test/Frontend/x86-target-cpu.c b/test/Frontend/x86-target-cpu.c
index b5103d238c9d..0ec301f4426e 100644
--- a/test/Frontend/x86-target-cpu.c
+++ b/test/Frontend/x86-target-cpu.c
@@ -13,7 +13,8 @@
// RUN: %clang_cc1 -triple x86_64-unknown-unknown -target-cpu skylake-avx512 -verify %s
// RUN: %clang_cc1 -triple x86_64-unknown-unknown -target-cpu skx -verify %s
// RUN: %clang_cc1 -triple x86_64-unknown-unknown -target-cpu cannonlake -verify %s
-// RUN: %clang_cc1 -triple x86_64-unknown-unknown -target-cpu icelake -verify %s
+// RUN: %clang_cc1 -triple x86_64-unknown-unknown -target-cpu icelake-client -verify %s
+// RUN: %clang_cc1 -triple x86_64-unknown-unknown -target-cpu icelake-server -verify %s
// RUN: %clang_cc1 -triple x86_64-unknown-unknown -target-cpu knl -verify %s
// RUN: %clang_cc1 -triple x86_64-unknown-unknown -target-cpu knm -verify %s
// RUN: %clang_cc1 -triple x86_64-unknown-unknown -target-cpu bonnell -verify %s