зеркало из https://github.com/microsoft/clang.git
Merge commit '1db40ee0042d3ff4ca47ec282fadf5870268e397' into HEAD
This commit is contained in:
Коммит
2d5ab8398c
|
@ -6187,7 +6187,8 @@ bool IntExprEvaluator::CheckReferencedDecl(const Expr* E, const Decl* D) {
|
||||||
|
|
||||||
/// EvaluateBuiltinClassifyType - Evaluate __builtin_classify_type the same way
|
/// EvaluateBuiltinClassifyType - Evaluate __builtin_classify_type the same way
|
||||||
/// as GCC.
|
/// as GCC.
|
||||||
static int EvaluateBuiltinClassifyType(const CallExpr *E) {
|
static int EvaluateBuiltinClassifyType(const CallExpr *E,
|
||||||
|
const LangOptions &LangOpts) {
|
||||||
// The following enum mimics the values returned by GCC.
|
// The following enum mimics the values returned by GCC.
|
||||||
// FIXME: Does GCC differ between lvalue and rvalue references here?
|
// FIXME: Does GCC differ between lvalue and rvalue references here?
|
||||||
enum gcc_type_class {
|
enum gcc_type_class {
|
||||||
|
@ -6207,37 +6208,132 @@ static int EvaluateBuiltinClassifyType(const CallExpr *E) {
|
||||||
if (E->getNumArgs() == 0)
|
if (E->getNumArgs() == 0)
|
||||||
return no_type_class;
|
return no_type_class;
|
||||||
|
|
||||||
QualType ArgTy = E->getArg(0)->getType();
|
QualType CanTy = E->getArg(0)->getType().getCanonicalType();
|
||||||
if (ArgTy->isVoidType())
|
const BuiltinType *BT = dyn_cast<BuiltinType>(CanTy);
|
||||||
return void_type_class;
|
|
||||||
else if (ArgTy->isEnumeralType())
|
switch (CanTy->getTypeClass()) {
|
||||||
return enumeral_type_class;
|
#define TYPE(ID, BASE)
|
||||||
else if (ArgTy->isBooleanType())
|
#define DEPENDENT_TYPE(ID, BASE) case Type::ID:
|
||||||
return boolean_type_class;
|
#define NON_CANONICAL_TYPE(ID, BASE) case Type::ID:
|
||||||
else if (ArgTy->isCharType())
|
#define NON_CANONICAL_UNLESS_DEPENDENT_TYPE(ID, BASE) case Type::ID:
|
||||||
return string_type_class; // gcc doesn't appear to use char_type_class
|
#include "clang/AST/TypeNodes.def"
|
||||||
else if (ArgTy->isIntegerType())
|
llvm_unreachable("CallExpr::isBuiltinClassifyType(): unimplemented type");
|
||||||
return integer_type_class;
|
|
||||||
else if (ArgTy->isPointerType())
|
case Type::Builtin:
|
||||||
|
switch (BT->getKind()) {
|
||||||
|
#define BUILTIN_TYPE(ID, SINGLETON_ID)
|
||||||
|
#define SIGNED_TYPE(ID, SINGLETON_ID) case BuiltinType::ID: return integer_type_class;
|
||||||
|
#define FLOATING_TYPE(ID, SINGLETON_ID) case BuiltinType::ID: return real_type_class;
|
||||||
|
#define PLACEHOLDER_TYPE(ID, SINGLETON_ID) case BuiltinType::ID: break;
|
||||||
|
#include "clang/AST/BuiltinTypes.def"
|
||||||
|
case BuiltinType::Void:
|
||||||
|
return void_type_class;
|
||||||
|
|
||||||
|
case BuiltinType::Bool:
|
||||||
|
return boolean_type_class;
|
||||||
|
|
||||||
|
case BuiltinType::Char_U: // gcc doesn't appear to use char_type_class
|
||||||
|
case BuiltinType::UChar:
|
||||||
|
case BuiltinType::UShort:
|
||||||
|
case BuiltinType::UInt:
|
||||||
|
case BuiltinType::ULong:
|
||||||
|
case BuiltinType::ULongLong:
|
||||||
|
case BuiltinType::UInt128:
|
||||||
|
return integer_type_class;
|
||||||
|
|
||||||
|
case BuiltinType::NullPtr:
|
||||||
|
return pointer_type_class;
|
||||||
|
|
||||||
|
case BuiltinType::WChar_U:
|
||||||
|
case BuiltinType::Char16:
|
||||||
|
case BuiltinType::Char32:
|
||||||
|
case BuiltinType::ObjCId:
|
||||||
|
case BuiltinType::ObjCClass:
|
||||||
|
case BuiltinType::ObjCSel:
|
||||||
|
case BuiltinType::OCLImage1d:
|
||||||
|
case BuiltinType::OCLImage1dArray:
|
||||||
|
case BuiltinType::OCLImage2d:
|
||||||
|
case BuiltinType::OCLImage2dArray:
|
||||||
|
case BuiltinType::OCLImage1dBuffer:
|
||||||
|
case BuiltinType::OCLImage2dDepth:
|
||||||
|
case BuiltinType::OCLImage2dArrayDepth:
|
||||||
|
case BuiltinType::OCLImage2dMSAA:
|
||||||
|
case BuiltinType::OCLImage2dArrayMSAA:
|
||||||
|
case BuiltinType::OCLImage2dMSAADepth:
|
||||||
|
case BuiltinType::OCLImage2dArrayMSAADepth:
|
||||||
|
case BuiltinType::OCLImage3d:
|
||||||
|
case BuiltinType::OCLSampler:
|
||||||
|
case BuiltinType::OCLEvent:
|
||||||
|
case BuiltinType::OCLClkEvent:
|
||||||
|
case BuiltinType::OCLQueue:
|
||||||
|
case BuiltinType::OCLNDRange:
|
||||||
|
case BuiltinType::OCLReserveID:
|
||||||
|
case BuiltinType::Dependent:
|
||||||
|
llvm_unreachable("CallExpr::isBuiltinClassifyType(): unimplemented type");
|
||||||
|
};
|
||||||
|
|
||||||
|
case Type::Enum:
|
||||||
|
return LangOpts.CPlusPlus ? enumeral_type_class : integer_type_class;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Type::Pointer:
|
||||||
return pointer_type_class;
|
return pointer_type_class;
|
||||||
else if (ArgTy->isReferenceType())
|
break;
|
||||||
return reference_type_class;
|
|
||||||
else if (ArgTy->isRealType())
|
case Type::MemberPointer:
|
||||||
return real_type_class;
|
if (CanTy->isMemberDataPointerType())
|
||||||
else if (ArgTy->isComplexType())
|
return offset_type_class;
|
||||||
|
else {
|
||||||
|
// We expect member pointers to be either data or function pointers,
|
||||||
|
// nothing else.
|
||||||
|
assert(CanTy->isMemberFunctionPointerType());
|
||||||
|
return method_type_class;
|
||||||
|
}
|
||||||
|
|
||||||
|
case Type::Complex:
|
||||||
return complex_type_class;
|
return complex_type_class;
|
||||||
else if (ArgTy->isFunctionType())
|
|
||||||
return function_type_class;
|
case Type::FunctionNoProto:
|
||||||
else if (ArgTy->isStructureOrClassType())
|
case Type::FunctionProto:
|
||||||
return record_type_class;
|
return LangOpts.CPlusPlus ? function_type_class : pointer_type_class;
|
||||||
else if (ArgTy->isUnionType())
|
|
||||||
return union_type_class;
|
case Type::Record:
|
||||||
else if (ArgTy->isArrayType())
|
if (const RecordType *RT = CanTy->getAs<RecordType>()) {
|
||||||
return array_type_class;
|
switch (RT->getDecl()->getTagKind()) {
|
||||||
else if (ArgTy->isUnionType())
|
case TagTypeKind::TTK_Struct:
|
||||||
return union_type_class;
|
case TagTypeKind::TTK_Class:
|
||||||
else // FIXME: offset_type_class, method_type_class, & lang_type_class?
|
case TagTypeKind::TTK_Interface:
|
||||||
|
return record_type_class;
|
||||||
|
|
||||||
|
case TagTypeKind::TTK_Enum:
|
||||||
|
return LangOpts.CPlusPlus ? enumeral_type_class : integer_type_class;
|
||||||
|
|
||||||
|
case TagTypeKind::TTK_Union:
|
||||||
|
return union_type_class;
|
||||||
|
}
|
||||||
|
}
|
||||||
llvm_unreachable("CallExpr::isBuiltinClassifyType(): unimplemented type");
|
llvm_unreachable("CallExpr::isBuiltinClassifyType(): unimplemented type");
|
||||||
|
|
||||||
|
case Type::ConstantArray:
|
||||||
|
case Type::VariableArray:
|
||||||
|
case Type::IncompleteArray:
|
||||||
|
return LangOpts.CPlusPlus ? array_type_class : pointer_type_class;
|
||||||
|
|
||||||
|
case Type::BlockPointer:
|
||||||
|
case Type::LValueReference:
|
||||||
|
case Type::RValueReference:
|
||||||
|
case Type::Vector:
|
||||||
|
case Type::ExtVector:
|
||||||
|
case Type::Auto:
|
||||||
|
case Type::ObjCObject:
|
||||||
|
case Type::ObjCInterface:
|
||||||
|
case Type::ObjCObjectPointer:
|
||||||
|
case Type::Pipe:
|
||||||
|
case Type::Atomic:
|
||||||
|
llvm_unreachable("CallExpr::isBuiltinClassifyType(): unimplemented type");
|
||||||
|
}
|
||||||
|
|
||||||
|
llvm_unreachable("CallExpr::isBuiltinClassifyType(): unimplemented type");
|
||||||
}
|
}
|
||||||
|
|
||||||
/// EvaluateBuiltinConstantPForLValue - Determine the result of
|
/// EvaluateBuiltinConstantPForLValue - Determine the result of
|
||||||
|
@ -6609,7 +6705,7 @@ bool IntExprEvaluator::VisitCallExpr(const CallExpr *E) {
|
||||||
}
|
}
|
||||||
|
|
||||||
case Builtin::BI__builtin_classify_type:
|
case Builtin::BI__builtin_classify_type:
|
||||||
return Success(EvaluateBuiltinClassifyType(E), E);
|
return Success(EvaluateBuiltinClassifyType(E, Info.getLangOpts()), E);
|
||||||
|
|
||||||
// FIXME: BI__builtin_clrsb
|
// FIXME: BI__builtin_clrsb
|
||||||
// FIXME: BI__builtin_clrsbl
|
// FIXME: BI__builtin_clrsbl
|
||||||
|
|
|
@ -1060,7 +1060,7 @@ DerivedArgList *Darwin::TranslateArgs(const DerivedArgList &Args,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Args.getLastArg(options::OPT_stdlib_EQ) &&
|
if (!Args.getLastArg(options::OPT_stdlib_EQ) &&
|
||||||
GetDefaultCXXStdlibType() == ToolChain::CST_Libcxx)
|
GetCXXStdlibType(Args) == ToolChain::CST_Libcxx)
|
||||||
DAL->AddJoinedArg(nullptr, Opts.getOption(options::OPT_stdlib_EQ),
|
DAL->AddJoinedArg(nullptr, Opts.getOption(options::OPT_stdlib_EQ),
|
||||||
"libc++");
|
"libc++");
|
||||||
|
|
||||||
|
|
|
@ -559,7 +559,10 @@ bool WrapperFrontendAction::BeginSourceFileAction(CompilerInstance &CI,
|
||||||
StringRef Filename) {
|
StringRef Filename) {
|
||||||
WrappedAction->setCurrentInput(getCurrentInput());
|
WrappedAction->setCurrentInput(getCurrentInput());
|
||||||
WrappedAction->setCompilerInstance(&CI);
|
WrappedAction->setCompilerInstance(&CI);
|
||||||
return WrappedAction->BeginSourceFileAction(CI, Filename);
|
auto Ret = WrappedAction->BeginSourceFileAction(CI, Filename);
|
||||||
|
// BeginSourceFileAction may change CurrentInput, e.g. during module builds.
|
||||||
|
setCurrentInput(WrappedAction->getCurrentInput());
|
||||||
|
return Ret;
|
||||||
}
|
}
|
||||||
void WrapperFrontendAction::ExecuteAction() {
|
void WrapperFrontendAction::ExecuteAction() {
|
||||||
WrappedAction->ExecuteAction();
|
WrappedAction->ExecuteAction();
|
||||||
|
|
|
@ -1226,7 +1226,7 @@ void Preprocessor::HandleUserDiagnosticDirective(Token &Tok,
|
||||||
|
|
||||||
// Find the first non-whitespace character, so that we can make the
|
// Find the first non-whitespace character, so that we can make the
|
||||||
// diagnostic more succinct.
|
// diagnostic more succinct.
|
||||||
StringRef Msg = StringRef(Message).ltrim(" ");
|
StringRef Msg = StringRef(Message).ltrim(' ');
|
||||||
|
|
||||||
if (isWarning)
|
if (isWarning)
|
||||||
Diag(Tok, diag::pp_hash_warning) << Msg;
|
Diag(Tok, diag::pp_hash_warning) << Msg;
|
||||||
|
|
|
@ -1000,7 +1000,7 @@ void EmptyLocalizationContextChecker::MethodCrawler::VisitObjCMessageExpr(
|
||||||
return;
|
return;
|
||||||
|
|
||||||
StringRef Comment =
|
StringRef Comment =
|
||||||
StringRef(Result.getLiteralData(), Result.getLength()).trim("\"");
|
StringRef(Result.getLiteralData(), Result.getLength()).trim('"');
|
||||||
|
|
||||||
if ((Comment.trim().size() == 0 && Comment.size() > 0) || // Is Whitespace
|
if ((Comment.trim().size() == 0 && Comment.size() > 0) || // Is Whitespace
|
||||||
Comment.empty()) {
|
Comment.empty()) {
|
||||||
|
|
|
@ -75,7 +75,7 @@ void MacOSXAPIChecker::CheckDispatchOnce(CheckerContext &C, const CallExpr *CE,
|
||||||
// _dispatch_once is then a function which then calls the real dispatch_once.
|
// _dispatch_once is then a function which then calls the real dispatch_once.
|
||||||
// Users do not care; they just want the warning at the top-level call.
|
// Users do not care; they just want the warning at the top-level call.
|
||||||
if (CE->getLocStart().isMacroID()) {
|
if (CE->getLocStart().isMacroID()) {
|
||||||
StringRef TrimmedFName = FName.ltrim("_");
|
StringRef TrimmedFName = FName.ltrim('_');
|
||||||
if (TrimmedFName != FName)
|
if (TrimmedFName != FName)
|
||||||
FName = TrimmedFName;
|
FName = TrimmedFName;
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
|
|
||||||
// CHECK-X86_64-HIDDEN: @"OBJC_CLASS_$_MySecretNamespace.A" = hidden global {{.*}}, section "__DATA, __objc_data", align 8
|
// CHECK-X86_64-HIDDEN: @"OBJC_CLASS_$_MySecretNamespace.A" = hidden global {{.*}}, section "__DATA, __objc_data", align 8
|
||||||
// CHECK-X86_64-HIDDEN: @"OBJC_METACLASS_$_MySecretNamespace.A" = hidden global {{.*}}, section "__DATA, __objc_data", align 8
|
// CHECK-X86_64-HIDDEN: @"OBJC_METACLASS_$_MySecretNamespace.A" = hidden global {{.*}}, section "__DATA, __objc_data", align 8
|
||||||
// CHECK-X86_64-HIDDEN: @"OBJC_EHTYPE_$_MySecretNamespace.EH1" = weak hidden global {{.*}}
|
// CHECK-X86_64-HIDDEN: @"OBJC_EHTYPE_$_MySecretNamespace.EH1" = weak hidden global
|
||||||
// CHECK-X86_64-HIDDEN: @"OBJC_EHTYPE_$_MySecretNamespace.EH2" = external global
|
// CHECK-X86_64-HIDDEN: @"OBJC_EHTYPE_$_MySecretNamespace.EH2" = external global
|
||||||
// CHECK-X86_64-HIDDEN: @"OBJC_EHTYPE_$_MySecretNamespace.EH3" = hidden global {{.*}}, section "__DATA,__objc_const", align 8
|
// CHECK-X86_64-HIDDEN: @"OBJC_EHTYPE_$_MySecretNamespace.EH3" = hidden global {{.*}}, section "__DATA,__objc_const", align 8
|
||||||
// CHECK-X86_64-HIDDEN: define internal void @"\01-[A im0]"
|
// CHECK-X86_64-HIDDEN: define internal void @"\01-[A im0]"
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
|
|
||||||
// CHECK-X86_64-HIDDEN: @"OBJC_CLASS_$_A" = hidden global {{.*}}, section "__DATA, __objc_data", align 8
|
// CHECK-X86_64-HIDDEN: @"OBJC_CLASS_$_A" = hidden global {{.*}}, section "__DATA, __objc_data", align 8
|
||||||
// CHECK-X86_64-HIDDEN: @"OBJC_METACLASS_$_A" = hidden global {{.*}}, section "__DATA, __objc_data", align 8
|
// CHECK-X86_64-HIDDEN: @"OBJC_METACLASS_$_A" = hidden global {{.*}}, section "__DATA, __objc_data", align 8
|
||||||
// CHECK-X86_64-HIDDEN: @"OBJC_EHTYPE_$_EH1" = weak hidden global {{.*}}
|
// CHECK-X86_64-HIDDEN: @"OBJC_EHTYPE_$_EH1" = weak hidden global
|
||||||
// CHECK-X86_64-HIDDEN: @"OBJC_EHTYPE_$_EH2" = external global
|
// CHECK-X86_64-HIDDEN: @"OBJC_EHTYPE_$_EH2" = external global
|
||||||
// CHECK-X86_64-HIDDEN: @"OBJC_EHTYPE_$_EH3" = hidden global {{.*}}, section "__DATA,__objc_const", align 8
|
// CHECK-X86_64-HIDDEN: @"OBJC_EHTYPE_$_EH3" = hidden global {{.*}}, section "__DATA,__objc_const", align 8
|
||||||
// CHECK-X86_64-HIDDEN: define internal void @"\01-[A im0]"
|
// CHECK-X86_64-HIDDEN: define internal void @"\01-[A im0]"
|
||||||
|
|
|
@ -10,16 +10,16 @@
|
||||||
// RUN: touch %T/ps4-ld.exe
|
// RUN: touch %T/ps4-ld.exe
|
||||||
// RUN: touch %T/ps4-ld.gold.exe
|
// RUN: touch %T/ps4-ld.gold.exe
|
||||||
|
|
||||||
// RUN: env "PATH=%T;%PATH%" %clang -target x86_64-scei-ps4 %s -fuse-ld=gold -### 2>&1 \
|
// RUN: env "PATH=%T;%PATH%;" %clang -target x86_64-scei-ps4 %s -fuse-ld=gold -### 2>&1 \
|
||||||
// RUN: | FileCheck --check-prefix=CHECK-PS4-GOLD %s
|
// RUN: | FileCheck --check-prefix=CHECK-PS4-GOLD %s
|
||||||
// RUN: env "PATH=%T;%PATH%" %clang -target x86_64-scei-ps4 %s -shared -### 2>&1 \
|
// RUN: env "PATH=%T;%PATH%;" %clang -target x86_64-scei-ps4 %s -shared -### 2>&1 \
|
||||||
// RUN: | FileCheck --check-prefix=CHECK-PS4-GOLD %s
|
// RUN: | FileCheck --check-prefix=CHECK-PS4-GOLD %s
|
||||||
|
|
||||||
// RUN: env "PATH=%T;%PATH%" %clang -target x86_64-scei-ps4 %s -### 2>&1 \
|
// RUN: env "PATH=%T;%PATH%;" %clang -target x86_64-scei-ps4 %s -### 2>&1 \
|
||||||
// RUN: | FileCheck --check-prefix=CHECK-PS4-LINKER %s
|
// RUN: | FileCheck --check-prefix=CHECK-PS4-LINKER %s
|
||||||
// RUN: env "PATH=%T;%PATH%" %clang -target x86_64-scei-ps4 %s -fuse-ld=ps4 -### 2>&1 \
|
// RUN: env "PATH=%T;%PATH%;" %clang -target x86_64-scei-ps4 %s -fuse-ld=ps4 -### 2>&1 \
|
||||||
// RUN: | FileCheck --check-prefix=CHECK-PS4-LINKER %s
|
// RUN: | FileCheck --check-prefix=CHECK-PS4-LINKER %s
|
||||||
// RUN: env "PATH=%T;%PATH%" %clang -target x86_64-scei-ps4 %s -shared \
|
// RUN: env "PATH=%T;%PATH%;" %clang -target x86_64-scei-ps4 %s -shared \
|
||||||
// RUN: -fuse-ld=ps4 -### 2>&1 | FileCheck --check-prefix=CHECK-PS4-LINKER %s
|
// RUN: -fuse-ld=ps4 -### 2>&1 | FileCheck --check-prefix=CHECK-PS4-LINKER %s
|
||||||
|
|
||||||
// FIXME: "Output\\" is hardcoded part of %T.
|
// FIXME: "Output\\" is hardcoded part of %T.
|
||||||
|
|
|
@ -0,0 +1,42 @@
|
||||||
|
// RUN: %clang_cc1 -fsyntax-only -verify %s
|
||||||
|
|
||||||
|
// expected-no-diagnostics
|
||||||
|
|
||||||
|
enum gcc_type_class {
|
||||||
|
no_type_class = -1,
|
||||||
|
void_type_class, integer_type_class, char_type_class,
|
||||||
|
enumeral_type_class, boolean_type_class,
|
||||||
|
pointer_type_class, reference_type_class, offset_type_class,
|
||||||
|
real_type_class, complex_type_class,
|
||||||
|
function_type_class, method_type_class,
|
||||||
|
record_type_class, union_type_class,
|
||||||
|
array_type_class, string_type_class,
|
||||||
|
lang_type_class
|
||||||
|
};
|
||||||
|
|
||||||
|
void foo() {
|
||||||
|
int i;
|
||||||
|
char c;
|
||||||
|
enum { red, green, blue } enum_obj;
|
||||||
|
int *p;
|
||||||
|
double d;
|
||||||
|
_Complex double cc;
|
||||||
|
extern void f();
|
||||||
|
struct { int a; float b; } s_obj;
|
||||||
|
union { int a; float b; } u_obj;
|
||||||
|
int arr[10];
|
||||||
|
|
||||||
|
int a1[__builtin_classify_type(f()) == void_type_class ? 1 : -1];
|
||||||
|
int a2[__builtin_classify_type(i) == integer_type_class ? 1 : -1];
|
||||||
|
int a3[__builtin_classify_type(c) == integer_type_class ? 1 : -1];
|
||||||
|
int a4[__builtin_classify_type(enum_obj) == integer_type_class ? 1 : -1];
|
||||||
|
int a5[__builtin_classify_type(p) == pointer_type_class ? 1 : -1];
|
||||||
|
int a6[__builtin_classify_type(d) == real_type_class ? 1 : -1];
|
||||||
|
int a7[__builtin_classify_type(cc) == complex_type_class ? 1 : -1];
|
||||||
|
int a8[__builtin_classify_type(f) == pointer_type_class ? 1 : -1];
|
||||||
|
int a0[__builtin_classify_type(s_obj) == record_type_class ? 1 : -1];
|
||||||
|
int a10[__builtin_classify_type(u_obj) == union_type_class ? 1 : -1];
|
||||||
|
int a11[__builtin_classify_type(arr) == pointer_type_class ? 1 : -1];
|
||||||
|
int a12[__builtin_classify_type("abc") == pointer_type_class ? 1 : -1];
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,54 @@
|
||||||
|
// RUN: %clang_cc1 -fsyntax-only -verify %s
|
||||||
|
|
||||||
|
// expected-no-diagnostics
|
||||||
|
|
||||||
|
enum gcc_type_class {
|
||||||
|
no_type_class = -1,
|
||||||
|
void_type_class, integer_type_class, char_type_class,
|
||||||
|
enumeral_type_class, boolean_type_class,
|
||||||
|
pointer_type_class, reference_type_class, offset_type_class,
|
||||||
|
real_type_class, complex_type_class,
|
||||||
|
function_type_class, method_type_class,
|
||||||
|
record_type_class, union_type_class,
|
||||||
|
array_type_class, string_type_class,
|
||||||
|
lang_type_class
|
||||||
|
};
|
||||||
|
|
||||||
|
class cl {
|
||||||
|
public:
|
||||||
|
void bar() {}
|
||||||
|
int baz;
|
||||||
|
};
|
||||||
|
|
||||||
|
int builtin_result;
|
||||||
|
|
||||||
|
void foo() {
|
||||||
|
int i;
|
||||||
|
char c;
|
||||||
|
enum { red, green, blue} enum_obj;
|
||||||
|
bool b;
|
||||||
|
int *p;
|
||||||
|
int &r = i;
|
||||||
|
double d;
|
||||||
|
extern void f();
|
||||||
|
cl cl_obj;
|
||||||
|
union { int a; float b; } u_obj;
|
||||||
|
int arr[10];
|
||||||
|
|
||||||
|
int a1[__builtin_classify_type(f()) == void_type_class ? 1 : -1];
|
||||||
|
int a2[__builtin_classify_type(i) == integer_type_class ? 1 : -1];
|
||||||
|
int a3[__builtin_classify_type(c) == integer_type_class ? 1 : -1];
|
||||||
|
int a4[__builtin_classify_type(enum_obj) == enumeral_type_class ? 1 : -1];
|
||||||
|
int a5[__builtin_classify_type(b) == boolean_type_class ? 1 : -1];
|
||||||
|
int a6[__builtin_classify_type(p) == pointer_type_class ? 1 : -1];
|
||||||
|
int a7[__builtin_classify_type(r) == integer_type_class ? 1 : -1];
|
||||||
|
int a8[__builtin_classify_type(&cl::baz) == offset_type_class ? 1 : -1];
|
||||||
|
int a9[__builtin_classify_type(d) == real_type_class ? 1 : -1];
|
||||||
|
int a10[__builtin_classify_type(f) == function_type_class ? 1 : -1];
|
||||||
|
int a11[__builtin_classify_type(&cl::bar) == method_type_class ? 1 : -1];
|
||||||
|
int a12[__builtin_classify_type(cl_obj) == record_type_class ? 1 : -1];
|
||||||
|
int a13[__builtin_classify_type(u_obj) == union_type_class ? 1 : -1];
|
||||||
|
int a14[__builtin_classify_type(arr) == array_type_class ? 1 : -1];
|
||||||
|
int a15[__builtin_classify_type("abc") == array_type_class ? 1 : -1];
|
||||||
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче