Skip to content
This repository was archived by the owner on Nov 1, 2021. It is now read-only.

Commit b623e4a

Browse files
committed
Driver: hoist the wchar_t handling to the driver
Move the logic for determining the `wchar_t` type information into the driver. Rather than passing the single bit of information of `-fshort-wchar` indicate to the frontend the desired type of `wchar_t` through a new `-cc1` option of `-fwchar-type` and indicate the signedness through `-f{,no-}signed-wchar`. This replicates the current logic which was spread throughout Basic into the `RenderCharacterOptions`. Most of the changes to the tests are to ensure that the frontend uses the correct type. Add a new test set under `test/Driver/wchar_t.c` to ensure that we calculate the proper types for the various cases. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@315126 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent fe2683b commit b623e4a

28 files changed

+226
-81
lines changed

include/clang/Basic/DiagnosticFrontendKinds.td

+2
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,8 @@ def err_fe_action_not_available : Error<
116116
"action %0 not compiled in">;
117117
def err_fe_invalid_alignment : Error<
118118
"invalid value '%1' in '%0'; alignment must be a power of 2">;
119+
def err_fe_invalid_wchar_type
120+
: Error<"invalid wchar_t type '%0'; must be one of 'char', 'short', 'int'">;
119121

120122
def warn_fe_serialized_diag_merge_failure : Warning<
121123
"unable to merge a subprocess's serialized diagnostics">,

include/clang/Basic/LangOptions.def

+2-1
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,8 @@ BENIGN_LANGOPT(ObjCGCBitmapPrint , 1, 0, "printing of GC's bitmap layout for __w
175175

176176
BENIGN_LANGOPT(AccessControl , 1, 1, "C++ access control")
177177
LANGOPT(CharIsSigned , 1, 1, "signed char")
178-
LANGOPT(ShortWChar , 1, 0, "unsigned short wchar_t")
178+
LANGOPT(WCharSize , 4, 0, "width of wchar_t")
179+
LANGOPT(WCharIsSigned , 1, 0, "signed or unsigned wchar_t")
179180
ENUM_LANGOPT(MSPointerToMemberRepresentationMethod, PragmaMSPointersToMembersKind, 2, PPTMK_BestCase, "member-pointer representation method")
180181
ENUM_LANGOPT(DefaultCallingConv, DefaultCallingConvention, 3, DCC_None, "default calling convention")
181182

include/clang/Driver/CC1Options.td

+6
Original file line numberDiff line numberDiff line change
@@ -709,6 +709,12 @@ def finclude_default_header : Flag<["-"], "finclude-default-header">,
709709
HelpText<"Include the default header file for OpenCL">;
710710
def fpreserve_vec3_type : Flag<["-"], "fpreserve-vec3-type">,
711711
HelpText<"Preserve 3-component vector type">;
712+
def fwchar_type_EQ : Joined<["-"], "fwchar-type=">,
713+
HelpText<"Select underlying type for wchar_t">, Values<"char,short,int">;
714+
def fsigned_wchar : Flag<["-"], "fsigned-wchar">,
715+
HelpText<"Use a signed type for wchar_t">;
716+
def fno_signed_wchar : Flag<["-"], "fno-signed-wchar">,
717+
HelpText<"Use an unsigned type for wchar_t">;
712718

713719
// FIXME: Remove these entirely once functionality/tests have been excised.
714720
def fobjc_gc_only : Flag<["-"], "fobjc-gc-only">, Group<f_Group>,

include/clang/Driver/Options.td

+2-2
Original file line numberDiff line numberDiff line change
@@ -1382,9 +1382,9 @@ def frtti : Flag<["-"], "frtti">, Group<f_Group>;
13821382
def : Flag<["-"], "fsched-interblock">, Group<clang_ignored_f_Group>;
13831383
def fshort_enums : Flag<["-"], "fshort-enums">, Group<f_Group>, Flags<[CC1Option]>,
13841384
HelpText<"Allocate to an enum type only as many bytes as it needs for the declared range of possible values">;
1385-
def fshort_wchar : Flag<["-"], "fshort-wchar">, Group<f_Group>, Flags<[CC1Option]>,
1385+
def fshort_wchar : Flag<["-"], "fshort-wchar">, Group<f_Group>,
13861386
HelpText<"Force wchar_t to be a short unsigned int">;
1387-
def fno_short_wchar : Flag<["-"], "fno-short-wchar">, Group<f_Group>, Flags<[CC1Option]>,
1387+
def fno_short_wchar : Flag<["-"], "fno-short-wchar">, Group<f_Group>,
13881388
HelpText<"Force wchar_t to be an unsigned int">;
13891389
def fshow_overloads_EQ : Joined<["-"], "fshow-overloads=">, Group<f_Group>, Flags<[CC1Option]>,
13901390
HelpText<"Which overload candidates to show when overload resolution fails: "

lib/Basic/TargetInfo.cpp

+10-2
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include "llvm/ADT/APFloat.h"
2020
#include "llvm/ADT/STLExtras.h"
2121
#include "llvm/Support/ErrorHandling.h"
22+
#include "llvm/Support/TargetParser.h"
2223
#include <cstdlib>
2324
using namespace clang;
2425

@@ -290,8 +291,15 @@ bool TargetInfo::isTypeSigned(IntType T) {
290291
void TargetInfo::adjust(LangOptions &Opts) {
291292
if (Opts.NoBitFieldTypeAlign)
292293
UseBitFieldTypeAlignment = false;
293-
if (Opts.ShortWChar)
294-
WCharType = UnsignedShort;
294+
295+
switch (Opts.WCharSize) {
296+
default: llvm_unreachable("invalid wchar_t width");
297+
case 0: break;
298+
case 1: WCharType = Opts.WCharIsSigned ? SignedChar : UnsignedChar; break;
299+
case 2: WCharType = Opts.WCharIsSigned ? SignedShort : UnsignedShort; break;
300+
case 4: WCharType = Opts.WCharIsSigned ? SignedInt : UnsignedInt; break;
301+
}
302+
295303
if (Opts.AlignDouble) {
296304
DoubleAlign = LongLongAlign = 64;
297305
LongDoubleAlign = 64;

lib/Basic/Targets/AArch64.cpp

+7-6
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include "clang/Basic/TargetBuiltins.h"
1616
#include "clang/Basic/TargetInfo.h"
1717
#include "llvm/ADT/ArrayRef.h"
18+
#include "llvm/ADT/StringExtras.h"
1819

1920
using namespace clang;
2021
using namespace clang::targets;
@@ -34,18 +35,19 @@ AArch64TargetInfo::AArch64TargetInfo(const llvm::Triple &Triple,
3435
: TargetInfo(Triple), ABI("aapcs") {
3536
if (getTriple().getOS() == llvm::Triple::NetBSD ||
3637
getTriple().getOS() == llvm::Triple::OpenBSD) {
37-
WCharType = SignedInt;
38-
3938
// NetBSD apparently prefers consistency across ARM targets to
4039
// consistency across 64-bit targets.
4140
Int64Type = SignedLongLong;
4241
IntMaxType = SignedLongLong;
4342
} else {
44-
WCharType = UnsignedInt;
43+
if (!getTriple().isOSDarwin())
44+
WCharType = UnsignedInt;
45+
4546
Int64Type = SignedLong;
4647
IntMaxType = SignedLong;
4748
}
4849

50+
4951
LongWidth = LongAlign = PointerWidth = PointerAlign = 64;
5052
MaxVectorAlign = 128;
5153
MaxAtomicInlineWidth = 128;
@@ -154,7 +156,8 @@ void AArch64TargetInfo::getTargetDefines(const LangOptions &Opts,
154156
if (Opts.UnsafeFPMath)
155157
Builder.defineMacro("__ARM_FP_FAST", "1");
156158

157-
Builder.defineMacro("__ARM_SIZEOF_WCHAR_T", Opts.ShortWChar ? "2" : "4");
159+
Builder.defineMacro("__ARM_SIZEOF_WCHAR_T",
160+
llvm::utostr(Opts.WCharSize ? Opts.WCharSize : 4));
158161

159162
Builder.defineMacro("__ARM_SIZEOF_MINIMAL_ENUM", Opts.ShortEnums ? "1" : "4");
160163

@@ -420,7 +423,6 @@ WindowsARM64TargetInfo::WindowsARM64TargetInfo(const llvm::Triple &Triple,
420423

421424
// This is an LLP64 platform.
422425
// int:4, long:4, long long:8, long double:8.
423-
WCharType = UnsignedShort;
424426
IntWidth = IntAlign = 32;
425427
LongWidth = LongAlign = 32;
426428
DoubleAlign = LongLongAlign = 64;
@@ -502,7 +504,6 @@ DarwinAArch64TargetInfo::DarwinAArch64TargetInfo(const llvm::Triple &Triple,
502504
const TargetOptions &Opts)
503505
: DarwinTargetInfo<AArch64leTargetInfo>(Triple, Opts) {
504506
Int64Type = SignedLongLong;
505-
WCharType = SignedInt;
506507
UseSignedCharForObjCBool = false;
507508

508509
LongDoubleWidth = LongDoubleAlign = SuitableAlign = 64;

lib/Basic/Targets/ARM.cpp

+6-17
Original file line numberDiff line numberDiff line change
@@ -36,20 +36,10 @@ void ARMTargetInfo::setABIAAPCS() {
3636
else
3737
SizeType = UnsignedInt;
3838

39-
switch (T.getOS()) {
40-
case llvm::Triple::NetBSD:
41-
case llvm::Triple::OpenBSD:
42-
WCharType = SignedInt;
43-
break;
44-
case llvm::Triple::Win32:
45-
WCharType = UnsignedShort;
46-
break;
47-
case llvm::Triple::Linux:
48-
default:
49-
// AAPCS 7.1.1, ARM-Linux ABI 2.4: type of wchar_t is unsigned int.
39+
bool IsNetBSD = T.getOS() == llvm::Triple::NetBSD;
40+
bool IsOpenBSD = T.getOS() == llvm::Triple::OpenBSD;
41+
if (!T.isOSWindows() && !IsNetBSD && !IsOpenBSD)
5042
WCharType = UnsignedInt;
51-
break;
52-
}
5343

5444
UseBitFieldTypeAlignment = true;
5545

@@ -99,7 +89,6 @@ void ARMTargetInfo::setABIAPCS(bool IsAAPCS16) {
9989
else
10090
SizeType = UnsignedLong;
10191

102-
// Revert to using SignedInt on apcs-gnu to comply with existing behaviour.
10392
WCharType = SignedInt;
10493

10594
// Do not respect the alignment of bit-field types when laying out
@@ -689,7 +678,8 @@ void ARMTargetInfo::getTargetDefines(const LangOptions &Opts,
689678
"0x" + llvm::utohexstr(HW_FP & ~HW_FP_DP));
690679
}
691680

692-
Builder.defineMacro("__ARM_SIZEOF_WCHAR_T", Opts.ShortWChar ? "2" : "4");
681+
Builder.defineMacro("__ARM_SIZEOF_WCHAR_T",
682+
llvm::utostr(Opts.WCharSize ? Opts.WCharSize : 4));
693683

694684
Builder.defineMacro("__ARM_SIZEOF_MINIMAL_ENUM", Opts.ShortEnums ? "1" : "4");
695685

@@ -932,7 +922,6 @@ void ARMbeTargetInfo::getTargetDefines(const LangOptions &Opts,
932922
WindowsARMTargetInfo::WindowsARMTargetInfo(const llvm::Triple &Triple,
933923
const TargetOptions &Opts)
934924
: WindowsTargetInfo<ARMleTargetInfo>(Triple, Opts), Triple(Triple) {
935-
WCharType = UnsignedShort;
936925
SizeType = UnsignedInt;
937926
}
938927

@@ -1023,8 +1012,8 @@ void MinGWARMTargetInfo::getTargetDefines(const LangOptions &Opts,
10231012
CygwinARMTargetInfo::CygwinARMTargetInfo(const llvm::Triple &Triple,
10241013
const TargetOptions &Opts)
10251014
: ARMleTargetInfo(Triple, Opts) {
1015+
this->WCharType = TargetInfo::UnsignedShort;
10261016
TLSSupported = false;
1027-
WCharType = UnsignedShort;
10281017
DoubleAlign = LongLongAlign = 64;
10291018
resetDataLayout("e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64");
10301019
}

lib/Basic/Targets/AVR.h

-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ class LLVM_LIBRARY_VISIBILITY AVRTargetInfo : public TargetInfo {
5252
PtrDiffType = SignedInt;
5353
IntPtrType = SignedInt;
5454
Char16Type = UnsignedInt;
55-
WCharType = SignedInt;
5655
WIntType = SignedInt;
5756
Char32Type = UnsignedLong;
5857
SigAtomicType = SignedChar;

lib/Basic/Targets/OSTargets.h

+4-3
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,7 @@ class LLVM_LIBRARY_VISIBILITY PS4OSTargetInfo : public OSTargetInfo<Target> {
477477
public:
478478
PS4OSTargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
479479
: OSTargetInfo<Target>(Triple, Opts) {
480-
this->WCharType = this->UnsignedShort;
480+
this->WCharType = TargetInfo::UnsignedShort;
481481

482482
// On PS4, TLS variable cannot be aligned to more than 32 bytes (256 bits).
483483
this->MaxTLSAlign = 256;
@@ -561,7 +561,6 @@ class LLVM_LIBRARY_VISIBILITY SolarisTargetInfo : public OSTargetInfo<Target> {
561561
public:
562562
SolarisTargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
563563
: OSTargetInfo<Target>(Triple, Opts) {
564-
this->WCharType = this->SignedInt;
565564
// FIXME: WIntType should be SignedLong
566565
}
567566
};
@@ -628,7 +627,9 @@ class LLVM_LIBRARY_VISIBILITY WindowsTargetInfo : public OSTargetInfo<Target> {
628627

629628
public:
630629
WindowsTargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
631-
: OSTargetInfo<Target>(Triple, Opts) {}
630+
: OSTargetInfo<Target>(Triple, Opts) {
631+
this->WCharType = TargetInfo::UnsignedShort;
632+
}
632633
};
633634

634635
template <typename Target>

lib/Basic/Targets/X86.h

+2-4
Original file line numberDiff line numberDiff line change
@@ -639,7 +639,6 @@ class LLVM_LIBRARY_VISIBILITY WindowsX86_32TargetInfo
639639
public:
640640
WindowsX86_32TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
641641
: WindowsTargetInfo<X86_32TargetInfo>(Triple, Opts) {
642-
WCharType = UnsignedShort;
643642
DoubleAlign = LongLongAlign = 64;
644643
bool IsWinCOFF =
645644
getTriple().isOSWindows() && getTriple().isOSBinFormatCOFF();
@@ -700,7 +699,7 @@ class LLVM_LIBRARY_VISIBILITY CygwinX86_32TargetInfo : public X86_32TargetInfo {
700699
public:
701700
CygwinX86_32TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
702701
: X86_32TargetInfo(Triple, Opts) {
703-
WCharType = UnsignedShort;
702+
this->WCharType = TargetInfo::UnsignedShort;
704703
DoubleAlign = LongLongAlign = 64;
705704
resetDataLayout("e-m:x-p:32:32-i64:64-f80:32-n8:16:32-a:0:32-S32");
706705
}
@@ -886,7 +885,6 @@ class LLVM_LIBRARY_VISIBILITY WindowsX86_64TargetInfo
886885
public:
887886
WindowsX86_64TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
888887
: WindowsTargetInfo<X86_64TargetInfo>(Triple, Opts) {
889-
WCharType = UnsignedShort;
890888
LongWidth = LongAlign = 32;
891889
DoubleAlign = LongLongAlign = 64;
892890
IntMaxType = SignedLongLong;
@@ -979,8 +977,8 @@ class LLVM_LIBRARY_VISIBILITY CygwinX86_64TargetInfo : public X86_64TargetInfo {
979977
public:
980978
CygwinX86_64TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
981979
: X86_64TargetInfo(Triple, Opts) {
980+
this->WCharType = TargetInfo::UnsignedShort;
982981
TLSSupported = false;
983-
WCharType = UnsignedShort;
984982
}
985983

986984
void getTargetDefines(const LangOptions &Opts,

lib/Driver/ToolChains/Clang.cpp

+31-18
Original file line numberDiff line numberDiff line change
@@ -2601,6 +2601,33 @@ static void RenderModulesOptions(Compilation &C, const Driver &D,
26012601
Args.AddLastArg(CmdArgs, options::OPT_fmodules_disable_diagnostic_validation);
26022602
}
26032603

2604+
static void RenderCharacterOptions(const ArgList &Args, const llvm::Triple &T,
2605+
ArgStringList &CmdArgs) {
2606+
// -fsigned-char is default.
2607+
if (const Arg *A = Args.getLastArg(options::OPT_fsigned_char,
2608+
options::OPT_fno_signed_char,
2609+
options::OPT_funsigned_char,
2610+
options::OPT_fno_unsigned_char)) {
2611+
if (A->getOption().matches(options::OPT_funsigned_char) ||
2612+
A->getOption().matches(options::OPT_fno_signed_char)) {
2613+
CmdArgs.push_back("-fno-signed-char");
2614+
}
2615+
} else if (!isSignedCharDefault(T)) {
2616+
CmdArgs.push_back("-fno-signed-char");
2617+
}
2618+
2619+
if (const Arg *A = Args.getLastArg(options::OPT_fshort_wchar,
2620+
options::OPT_fno_short_wchar)) {
2621+
if (A->getOption().matches(options::OPT_fshort_wchar)) {
2622+
CmdArgs.push_back("-fwchar-type=short");
2623+
CmdArgs.push_back("-fno-signed-wchar");
2624+
} else {
2625+
CmdArgs.push_back("-fwchar-type=int");
2626+
CmdArgs.push_back("-fsigned-wchar");
2627+
}
2628+
}
2629+
}
2630+
26042631
static void RenderObjCOptions(const ToolChain &TC, const Driver &D,
26052632
const llvm::Triple &T, const ArgList &Args,
26062633
ObjCRuntime &Runtime, bool InferCovariantReturns,
@@ -2991,6 +3018,9 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
29913018
Inputs.size() == 1) &&
29923019
"Unable to handle multiple inputs.");
29933020

3021+
const llvm::Triple *AuxTriple =
3022+
IsCuda ? getToolChain().getAuxTriple() : nullptr;
3023+
29943024
bool IsWindowsGNU = RawTriple.isWindowsGNUEnvironment();
29953025
bool IsWindowsCygnus = RawTriple.isWindowsCygwinEnvironment();
29963026
bool IsWindowsMSVC = RawTriple.isWindowsMSVCEnvironment();
@@ -3000,7 +3030,6 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
30003030
// mode (i.e., getToolchain().getTriple() is NVPTX, not Windows), we need to
30013031
// pass Windows-specific flags to cc1.
30023032
if (IsCuda) {
3003-
const llvm::Triple *AuxTriple = getToolChain().getAuxTriple();
30043033
IsWindowsMSVC |= AuxTriple && AuxTriple->isWindowsMSVCEnvironment();
30053034
IsWindowsGNU |= AuxTriple && AuxTriple->isWindowsGNUEnvironment();
30063035
IsWindowsCygnus |= AuxTriple && AuxTriple->isWindowsCygwinEnvironment();
@@ -4003,17 +4032,7 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
40034032
getToolChain().getArch() == llvm::Triple::hexagon))
40044033
CmdArgs.push_back("-fshort-enums");
40054034

4006-
// -fsigned-char is default.
4007-
if (Arg *A = Args.getLastArg(
4008-
options::OPT_fsigned_char, options::OPT_fno_signed_char,
4009-
options::OPT_funsigned_char, options::OPT_fno_unsigned_char)) {
4010-
if (A->getOption().matches(options::OPT_funsigned_char) ||
4011-
A->getOption().matches(options::OPT_fno_signed_char)) {
4012-
CmdArgs.push_back("-fno-signed-char");
4013-
}
4014-
} else if (!isSignedCharDefault(RawTriple)) {
4015-
CmdArgs.push_back("-fno-signed-char");
4016-
}
4035+
RenderCharacterOptions(Args, AuxTriple ? *AuxTriple : RawTriple, CmdArgs);
40174036

40184037
// -fuse-cxa-atexit is default.
40194038
if (!Args.hasFlag(
@@ -4182,12 +4201,6 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
41824201
options::OPT_mno_constant_cfstrings))
41834202
CmdArgs.push_back("-fno-constant-cfstrings");
41844203

4185-
// -fshort-wchar default varies depending on platform; only
4186-
// pass if specified.
4187-
if (Arg *A = Args.getLastArg(options::OPT_fshort_wchar,
4188-
options::OPT_fno_short_wchar))
4189-
A->render(Args, CmdArgs);
4190-
41914204
// -fno-pascal-strings is default, only pass non-default.
41924205
if (Args.hasFlag(options::OPT_fpascal_strings,
41934206
options::OPT_fno_pascal_strings, false))

lib/Frontend/CompilerInstance.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -386,6 +386,7 @@ void CompilerInstance::createPreprocessor(TranslationUnitKind TUKind) {
386386
Invocation->getPreprocessorOptsPtr(), getDiagnostics(), getLangOpts(),
387387
getSourceManager(), getPCMCache(), *HeaderInfo, *this, PTHMgr,
388388
/*OwnsHeaderSearch=*/true, TUKind);
389+
getTarget().adjust(getLangOpts());
389390
PP->Initialize(getTarget(), getAuxTarget());
390391

391392
// Note that this is different then passing PTHMgr to Preprocessor's ctor.

lib/Frontend/CompilerInvocation.cpp

+10-1
Original file line numberDiff line numberDiff line change
@@ -2154,7 +2154,16 @@ static void ParseLangArgs(LangOptions &Opts, ArgList &Args, InputKind IK,
21542154
Opts.ImplicitModules = !Args.hasArg(OPT_fno_implicit_modules);
21552155
Opts.CharIsSigned = Opts.OpenCL || !Args.hasArg(OPT_fno_signed_char);
21562156
Opts.WChar = Opts.CPlusPlus && !Args.hasArg(OPT_fno_wchar);
2157-
Opts.ShortWChar = Args.hasFlag(OPT_fshort_wchar, OPT_fno_short_wchar, false);
2157+
if (const Arg *A = Args.getLastArg(OPT_fwchar_type_EQ)) {
2158+
Opts.WCharSize = llvm::StringSwitch<unsigned>(A->getValue())
2159+
.Case("char", 1)
2160+
.Case("short", 2)
2161+
.Case("int", 4)
2162+
.Default(0);
2163+
if (Opts.WCharSize == 0)
2164+
Diags.Report(diag::err_fe_invalid_wchar_type) << A->getValue();
2165+
}
2166+
Opts.WCharIsSigned = Args.hasFlag(OPT_fsigned_wchar, OPT_fno_signed_wchar, true);
21582167
Opts.ShortEnums = Args.hasArg(OPT_fshort_enums);
21592168
Opts.Freestanding = Args.hasArg(OPT_ffreestanding);
21602169
Opts.NoBuiltin = Args.hasArg(OPT_fno_builtin) || Opts.Freestanding;

test/CXX/conv/conv.prom/p2.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// RUN: %clang_cc1 -fsyntax-only -verify -std=c++0x -triple x86_64-pc-linux-gnu -ffreestanding %s
2-
// RUN: %clang_cc1 -fsyntax-only -verify -std=c++0x -triple x86_64-pc-linux-gnu -ffreestanding -fshort-wchar %s
2+
// RUN: %clang_cc1 -fsyntax-only -verify -std=c++0x -triple x86_64-pc-linux-gnu -ffreestanding -fwchar-type=short -fno-signed-wchar %s
33
// expected-no-diagnostics
44

55
#include <stdint.h>

test/CodeGen/arm-metadata.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// RUN: %clang_cc1 -triple armv7a-linux-gnueabi -emit-llvm -o - %s | FileCheck -check-prefix=DEFAULT %s
22
// RUN: %clang_cc1 -triple armv7a-linux-gnueabi -emit-llvm -o - %s -fshort-enums | FileCheck -check-prefix=SHORT-ENUM %s
3-
// RUN: %clang_cc1 -triple armv7a-linux-gnueabi -emit-llvm -o - %s -fshort-wchar | FileCheck -check-prefix=SHORT-WCHAR %s
3+
// RUN: %clang_cc1 -triple armv7a-linux-gnueabi -emit-llvm -o - %s -fwchar-type=short -fno-signed-wchar | FileCheck -check-prefix=SHORT-WCHAR %s
44

55
// DEFAULT: !{{[0-9]+}} = !{i32 1, !"wchar_size", i32 4}
66
// DEFAULT: !{{[0-9]+}} = !{i32 1, !"min_enum_size", i32 4}

test/CodeGen/pascal-wchar-string.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %clang_cc1 -emit-llvm -o - %s -fpascal-strings -fshort-wchar | FileCheck %s
1+
// RUN: %clang_cc1 -emit-llvm -o - %s -fpascal-strings -fwchar-type=short -fno-signed-wchar | FileCheck %s
22
// rdar://8020384
33

44
#include <stddef.h>

test/CodeGen/string-literal-short-wstring.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
// RUN: %clang_cc1 -x c++ -triple %itanium_abi_triple -emit-llvm -fshort-wchar %s -o - | FileCheck %s --check-prefix=CHECK --check-prefix=ITANIUM
2-
// RUN: %clang_cc1 -x c++ -triple %ms_abi_triple -emit-llvm -fshort-wchar %s -o - | FileCheck %s --check-prefix=CHECK --check-prefix=MSABI
1+
// RUN: %clang_cc1 -x c++ -triple %itanium_abi_triple -emit-llvm -fwchar-type=short -fno-signed-wchar %s -o - | FileCheck %s --check-prefix=CHECK --check-prefix=ITANIUM
2+
// RUN: %clang_cc1 -x c++ -triple %ms_abi_triple -emit-llvm -fwchar-type=short -fno-signed-wchar %s -o - | FileCheck %s --check-prefix=CHECK --check-prefix=MSABI
33
// Runs in c++ mode so that wchar_t is available.
44

55
// XFAIL: hexagon

0 commit comments

Comments
 (0)