62 changes: 31 additions & 31 deletions clang/test/Analysis/dead-stores.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// RUN: -analyzer-config deadcode.DeadStores:ShowFixIts=true \
// RUN: -verify=non-nested,nested

void f1() {
void f1(void) {
int k, y; // non-nested-warning {{unused variable 'k'}}
// non-nested-warning@-1 {{unused variable 'y'}}
int abc = 1;
Expand All @@ -34,8 +34,8 @@ void f2(void *b) {
// non-nested-note@-2 {{include the header <stdio.h> or explicitly provide a declaration for 'printf'}}
}

int f();
void f3() {
int f(void);
void f3(void) {
int r;
if ((r = f()) != 0) { // no-warning
int y = r; // no-warning
Expand All @@ -50,15 +50,15 @@ void f4(int k) {
k = 2; // non-nested-warning {{never read}}
}

void f5() {
void f5(void) {
int x = 4; // no-warning
int *p = &x; // non-nested-warning {{never read}}
// non-nested-warning@-1 {{unused variable 'p'}}
// CHECK-FIXES: int x = 4;
// CHECK-FIXES-NEXT: int *p;
}

int f6() {
int f6(void) {
int x = 4;
++x; // no-warning
return 1;
Expand Down Expand Up @@ -90,30 +90,30 @@ int f7d(int *p) {

// Warn for dead stores in nested expressions.
int f8(int *p) {
extern int *baz();
extern int *baz(void);
if ((p = baz())) // nested-warning {{Although the value stored}}
return 1;
return 0;
}

int f9() {
int f9(void) {
int x = 4;
x = x + 10; // non-nested-warning {{never read}}
return 1;
}

int f10() {
int f10(void) {
int x = 4;
x = 10 + x; // non-nested-warning {{never read}}
return 1;
}

int f11() {
int f11(void) {
int x = 4;
return x++; // non-nested-warning {{never read}}
}

int f11b() {
int f11b(void) {
int x = 4;
return ((((++x)))); // no-warning
}
Expand Down Expand Up @@ -171,7 +171,7 @@ int f16(int x) {
}

// Self-assignments should not be flagged as dead stores.
void f17() {
void f17(void) {
int x = 1;
x = x;
}
Expand All @@ -180,7 +180,7 @@ void f17() {
// The values of dead stores are only "consumed" in an enclosing expression
// what that value is actually used. In other words, don't say "Although the
// value stored to 'x' is used...".
int f18() {
int f18(void) {
int x = 0; // no-warning
if (1)
x = 10; // non-nested-warning {{Value stored to 'x' is never read}}
Expand All @@ -193,24 +193,24 @@ int f18() {
return (x = 10); // no-warning
}

int f18_a() {
int f18_a(void) {
int x = 0; // no-warning
return (x = 10); // nested-warning {{Although the value stored}}
}

void f18_b() {
void f18_b(void) {
int x = 0; // no-warning
if (1)
x = 10; // non-nested-warning {{Value stored to 'x' is never read}}
}

void f18_c() {
void f18_c(void) {
int x = 0;
while (1)
x = 10; // non-nested-warning {{Value stored to 'x' is never read}}
}

void f18_d() {
void f18_d(void) {
int x = 0; // no-warning
do
x = 10; // non-nested-warning {{Value stored to 'x' is never read}}
Expand Down Expand Up @@ -238,8 +238,8 @@ void f20(void) {
#pragma unused(x)
}

void halt() __attribute__((noreturn));
int f21() {
void halt(void) __attribute__((noreturn));
int f21(void) {
int x = 4;
x = x + 1; // non-nested-warning {{never read}}
if (1) {
Expand All @@ -250,7 +250,7 @@ int f21() {
}

int j;
void f22() {
void f22(void) {
int x = 4;
int y1 = 4;
int y2 = 4;
Expand Down Expand Up @@ -473,7 +473,7 @@ int f24_D(int y) {
int f25(int y) {
__block int x = (y > 2);
__block int z = 0;
void (^foo)() = ^{
void (^foo)(void) = ^{
z = x + y;
};
x = 4; // no-warning
Expand All @@ -492,7 +492,7 @@ int f25_b(int y) {
return z;
}

int f26_nestedblocks() {
int f26_nestedblocks(void) {
int z;
z = 1;
__block int y = 0;
Expand All @@ -508,7 +508,7 @@ int f26_nestedblocks() {

// The FOREACH macro in QT uses 'break' statements within statement expressions
// placed within the increment code of for loops.
void rdar8014335() {
void rdar8014335(void) {
for (int i = 0 ; i != 10 ; ({ break; })) {
for (;; ({ ++i; break; }))
;
Expand Down Expand Up @@ -546,7 +546,7 @@ void rdar8320674(s_rdar8320674 *z, unsigned y, s2_rdar8320674 *st, int m)

// Avoid dead stores resulting from an assignment (and use) being unreachable.
void rdar8405222_aux(int i);
void rdar8405222() {
void rdar8405222(void) {
const int show = 0;
int i = 0;
if (show)
Expand All @@ -557,29 +557,29 @@ void rdar8405222() {

// Look through chains of assignments, e.g.: int x = y = 0, when employing
// silencing heuristics.
int radar11185138_foo() {
int radar11185138_foo(void) {
int x, y;
x = y = 0; // non-nested-warning {{never read}}
return y;
}

int rdar11185138_bar() {
int rdar11185138_bar(void) {
int y;
int x = y = 0; // nested-warning {{Although the value stored}}
x = 2;
y = 2;
return x + y;
}

int *radar11185138_baz() {
int *radar11185138_baz(void) {
int *x, *y;
x = y = 0; // no-warning
return y;
}

int getInt();
int *getPtr();
void testBOComma() {
int getInt(void);
int *getPtr(void);
void testBOComma(void) {
int x0 = (getInt(), 0); // non-nested-warning {{unused variable 'x0'}}
int x1 = (getInt(), getInt());
// non-nested-warning@-1 {{Value stored to 'x1' during its initialization is never read}}
Expand Down Expand Up @@ -631,7 +631,7 @@ void testBOComma() {
p = (getPtr(), (int *)0); // no warning
}

void testVolatile() {
void testVolatile(void) {
volatile int v;
v = 0; // no warning
}
Expand All @@ -654,7 +654,7 @@ int rdar34122265_test(int input) {
return foo.x + foo.y;
}

void rdar34122265_test_cast() {
void rdar34122265_test_cast(void) {
// This is allowed for defensive programming.
struct Foo foo = {0, 0};
(void)foo;
Expand Down
12 changes: 6 additions & 6 deletions clang/test/Analysis/dead-stores.m
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ void rdar_7631278(NSObject *x) {
// This test case issuing a bogus warning for the declaration of 'isExec'
// because the compound statement for the @synchronized was being visited
// twice by the LiveVariables analysis.
BOOL baz_rdar8527823();
void foo_rdar8527823();
BOOL baz_rdar8527823(void);
void foo_rdar8527823(void);
@interface RDar8527823
- (void) bar_rbar8527823;
@end
Expand Down Expand Up @@ -83,9 +83,9 @@ @interface RDar10591355
@property (assign) int x;
@end

RDar10591355 *rdar10591355_aux();
RDar10591355 *rdar10591355_aux(void);

void rdar10591355() {
void rdar10591355(void) {
RDar10591355 *p = rdar10591355_aux();
^{ (void) p.x; }();
}
Expand All @@ -110,8 +110,8 @@ - (int*)usePath {
}
@end

id test_objc_precise_lifetime_foo();
void test_objc_precise_lifetime() {
id test_objc_precise_lifetime_foo(void);
void test_objc_precise_lifetime(void) {
__attribute__((objc_precise_lifetime)) id dead = test_objc_precise_lifetime_foo(); // no-warning
dead = 0;
dead = test_objc_precise_lifetime_foo(); // no-warning
Expand Down
4 changes: 2 additions & 2 deletions clang/test/Analysis/debug-exprinspection-istainted.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ void clang_analyzer_isTainted(char);
void clang_analyzer_isTainted_any_suffix(char);
void clang_analyzer_isTainted_many_arguments(char, int, int);

void foo() {
void foo(void) {
char buf[32] = "";
clang_analyzer_isTainted(buf[0]); // expected-warning {{NO}}
clang_analyzer_isTainted_any_suffix(buf[0]); // expected-warning {{NO}}
Expand All @@ -19,7 +19,7 @@ void foo() {
int tainted_value = buf[0]; // no-warning
}

void exactly_one_argument_required() {
void exactly_one_argument_required(void) {
char buf[32] = "";
scanf("%s", buf);
clang_analyzer_isTainted_many_arguments(buf[0], 42, 42);
Expand Down
4 changes: 2 additions & 2 deletions clang/test/Analysis/default-analyze.m
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ static __inline__ __attribute__((always_inline)) CGFloat NSHeight(NSRect aRect)
return (aRect.size.height);
}

NSSize rdar880566_size();
NSSize rdar880566_size(void);

double rdar8808566() {
double rdar8808566(void) {
NSRect myRect;
myRect.size = rdar880566_size();
double x = NSWidth(myRect) + NSHeight(myRect); // no-warning
Expand Down
2 changes: 1 addition & 1 deletion clang/test/Analysis/default-diagnostic-visitors.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

// This file is for testing enhanced diagnostics produced by the default BugReporterVisitors.

int getPasswordAndItem()
int getPasswordAndItem(void)
{
int err = 0;
int *password; // expected-note {{'password' declared without an initial value}}
Expand Down
6 changes: 3 additions & 3 deletions clang/test/Analysis/designated-initializer-values.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

void clang_analyzer_eval(int);

void array_init() {
void array_init(void) {
int a[5] = {[4] = 29, [2] = 15, [0] = 4};
clang_analyzer_eval(a[0] == 4); // expected-warning{{TRUE}}
clang_analyzer_eval(a[1] == 0); // expected-warning{{TRUE}}
Expand All @@ -21,13 +21,13 @@ struct point {
int x, y;
};

void struct_init() {
void struct_init(void) {
struct point p = {.y = 5, .x = 3};
clang_analyzer_eval(p.x == 3); // expected-warning{{TRUE}}
clang_analyzer_eval(p.y == 5); // expected-warning{{TRUE}}
}

void array_of_struct() {
void array_of_struct(void) {
struct point ptarray[3] = { [2].y = 1, [2].x = 2, [0].x = 3 };
clang_analyzer_eval(ptarray[0].x == 3); // expected-warning{{TRUE}}
clang_analyzer_eval(ptarray[0].y == 0); // expected-warning{{TRUE}}
Expand Down
6 changes: 3 additions & 3 deletions clang/test/Analysis/designated-initializer.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@

struct Q { int a, b, c; };
union UQ { struct Q q; };
union UQ getUQ() {
union UQ getUQ(void) {
union UQ u = { { 1, 2, 3 } };
return u;
}

void test() {
void test(void) {
struct LUQ { union UQ uq; } var = { getUQ(), .uq.q.a = 100 };
struct Q s[] = {
[0] = (struct Q){1, 2},
Expand All @@ -19,7 +19,7 @@ void test() {
// CHECK: void test()
// CHECK: [B1]
// CHECK: 1: getUQ
// CHECK: 2: [B1.1] (ImplicitCastExpr, FunctionToPointerDecay, union UQ (*)())
// CHECK: 2: [B1.1] (ImplicitCastExpr, FunctionToPointerDecay, union UQ (*)(void))
// CHECK: 3: [B1.2]()
// CHECK: 4: 100
// CHECK: 5: /*no init*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
{
"artifacts": [
{
"length": 1077,
"length": 1081,
"location": {
},
"mimeType": "text/plain",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ struct S {
int y;
};

int *foo();
int *foo(void);

void test(struct S syz, int *pp) {
int m = 0;
Expand Down
4 changes: 2 additions & 2 deletions clang/test/Analysis/diagnostics/false-positive-suppression.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
typedef __typeof(sizeof(int)) size_t;
void *malloc(size_t);

int radar12491259() {
int radar12491259(void) {
int *p = malloc(12);
FREE_POINTER(p);
FREE_POINTER(p); // no-warning: we are suppressing errors coming from sys/queue macros.
Expand All @@ -15,7 +15,7 @@ int radar12491259() {

#define MYMACRO(p) FREE_POINTER(p)

int radar12491259_inside_macro() {
int radar12491259_inside_macro(void) {
int *p = malloc(12);
MYMACRO(p);
MYMACRO(p); // no-warning: we are suppressing errors coming from sys/queue macros.
Expand Down
6 changes: 3 additions & 3 deletions clang/test/Analysis/diagnostics/find_last_store.c
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// RUN: %clang_analyze_cc1 -analyzer-checker=core -analyzer-output=text -verify %s
typedef struct { float b; } c;
void *a();
void *d() {
void *a(void);
void *d(void) {
return a();
}

void no_find_last_store() {
void no_find_last_store(void) {
c *e = d(); // expected-note{{'e' initialized here}}

(void)(e || e->b); // expected-note{{Assuming 'e' is null}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#define NULL 0

int test_noparammacro() {
int test_noparammacro(void) {
int *x = NULL; // expected-note{{'x' initialized to a null pointer value}}
return *x; // expected-warning{{Dereference of null pointer (loaded from variable 'x')}}
// expected-note@-1{{Dereference of null pointer (loaded from variable 'x')}}
Expand All @@ -22,7 +22,7 @@ char test_declaration(int *param) {
return *param2;
}

int coin();
int coin(void);

int test_multi_decl(int *paramA, int *paramB) {
char *param1 = DYN_CAST(paramA), *param2 = DYN_CAST(paramB);
Expand All @@ -38,7 +38,7 @@ int testDivision(int a) {
}

// Warning should not be suppressed if it happens in the same macro.
#define DEREF_IN_MACRO(X) int fn() {int *p = 0; return *p; }
#define DEREF_IN_MACRO(X) int fn(void) {int *p = 0; return *p; }

DEREF_IN_MACRO(0) // expected-warning{{Dereference of null pointer}}
// expected-note@-1{{'p' initialized to a null}}
Expand All @@ -47,8 +47,8 @@ DEREF_IN_MACRO(0) // expected-warning{{Dereference of null pointer}}
// Warning should not be suppressed if the null returned by the macro
// is not related to the warning.
#define RETURN_NULL() (0)
extern int* returnFreshPointer();
int noSuppressMacroUnrelated() {
extern int* returnFreshPointer(void);
int noSuppressMacroUnrelated(void) {
int *x = RETURN_NULL();
x = returnFreshPointer(); // expected-note{{Value assigned to 'x'}}
if (x) {} // expected-note{{Taking false branch}}
Expand All @@ -59,7 +59,7 @@ int noSuppressMacroUnrelated() {

// Value haven't changed by the assignment, but the null pointer
// did not come from the macro.
int noSuppressMacroUnrelatedOtherReason() {
int noSuppressMacroUnrelatedOtherReason(void) {
int *x = RETURN_NULL();
x = returnFreshPointer();
x = 0; // expected-note{{Null pointer value stored to 'x'}}
Expand Down
6 changes: 3 additions & 3 deletions clang/test/Analysis/diagnostics/no-prune-paths.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
// "prune-paths" is a debug option only; this is just a simple test to see that
// it's being honored.

void helper() {
extern void foo();
void helper(void) {
extern void foo(void);
foo();
}

void test() {
void test(void) {
helper();
#if NPRUNE
// expected-note@-2 {{Calling 'helper'}}
Expand Down
32 changes: 16 additions & 16 deletions clang/test/Analysis/diagnostics/no-store-func-path-notes.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ int initializer1(int *p, int x) {
}
}

int param_not_initialized_by_func() {
int param_not_initialized_by_func(void) {
int p; // expected-note {{'p' declared without an initial value}}
int out = initializer1(&p, 0); // expected-note{{Calling 'initializer1'}}
// expected-note@-1{{Returning from 'initializer1'}}
return p; // expected-note{{Undefined or garbage value returned to caller}}
// expected-warning@-1{{Undefined or garbage value returned to caller}}
}

int param_initialized_properly() {
int param_initialized_properly(void) {
int p;
int out = initializer1(&p, 1);
return p; //no-warning
Expand All @@ -40,7 +40,7 @@ int initializer2(int **p, int x) {
}
}

int param_not_written_into_by_func() {
int param_not_written_into_by_func(void) {
int *p = 0; // expected-note{{'p' initialized to a null pointer value}}
int out = initializer2(&p, 0); // expected-note{{Calling 'initializer2'}}
// expected-note@-1{{Returning from 'initializer2'}}
Expand All @@ -54,7 +54,7 @@ void initializer3(int *p, int param) {
*p = 0;
} // expected-note{{Returning without writing to '*p'}}

int param_written_into_by_void_func() {
int param_written_into_by_void_func(void) {
int p; // expected-note{{'p' declared without an initial value}}
initializer3(&p, 0); // expected-note{{Calling 'initializer3'}}
// expected-note@-1{{Returning from 'initializer3'}}
Expand All @@ -74,7 +74,7 @@ void initializer5(int *p, int param) {
*p = 0;
} // expected-note{{Returning without writing to '*p'}}

int multi_init_tries_func() {
int multi_init_tries_func(void) {
int p; // expected-note{{'p' declared without an initial value}}
initializer4(&p, 0); // expected-note{{Calling 'initializer4'}}
// expected-note@-1{{Returning from 'initializer4'}}
Expand All @@ -88,7 +88,7 @@ int initializer6(const int *p) {
return 0;
}

int no_msg_on_const() {
int no_msg_on_const(void) {
int p; // expected-note{{'p' declared without an initial value}}
initializer6(&p);
return p; // expected-warning{{Undefined or garbage value returned to caller}}
Expand All @@ -108,7 +108,7 @@ int initializer7(S *s, int param) {
return 1; // expected-note{{Returning without writing to 's->x'}}
}

int initialize_struct_field() {
int initialize_struct_field(void) {
S local;
initializer7(&local, 0); // expected-note{{Calling 'initializer7'}}
// expected-note@-1{{Returning from 'initializer7'}}
Expand All @@ -120,7 +120,7 @@ void nullwriter(int **p) {
*p = 0; // expected-note{{Null pointer value stored to 'p'}}
} // no extra note

int usage() {
int usage(void) {
int x = 0;
int *p = &x;
nullwriter(&p); // expected-note{{Calling 'nullwriter'}}
Expand All @@ -138,7 +138,7 @@ void partial_initializer(A *a) {
a->x = 0;
} // expected-note{{Returning without writing to 'a->y'}}

int use_partial_initializer() {
int use_partial_initializer(void) {
A a;
partial_initializer(&a); // expected-note{{Calling 'partial_initializer'}}
// expected-note@-1{{Returning from 'partial_initializer'}}
Expand All @@ -159,7 +159,7 @@ void partial_nested_initializer(C *c) {
c->b.x = 0;
} // expected-note{{Returning without writing to 'c->b.y'}}

int use_partial_nested_initializer() {
int use_partial_nested_initializer(void) {
B localB;
C localC;
localC.b = localB;
Expand All @@ -174,7 +174,7 @@ void test_subregion_assignment(C* c) {
c->b = b;
}

int use_subregion_assignment() {
int use_subregion_assignment(void) {
C c;
test_subregion_assignment(&c); // expected-note{{Calling 'test_subregion_assignment'}}
// expected-note@-1{{Returning from 'test_subregion_assignment'}}
Expand All @@ -187,15 +187,15 @@ int confusing_signature(int *p) {
return 0; // expected-note{{Returning without writing to '*p'}}
}

int use_confusing_signature() {
int use_confusing_signature(void) {
int a; // expected-note {{'a' declared without an initial value}}
confusing_signature(&a); // expected-note{{Calling 'confusing_signature'}}
// expected-note@-1{{Returning from 'confusing_signature'}}
return a; // expected-note{{Undefined or garbage value returned to caller}}
// expected-warning@-1{{Undefined or garbage value returned to caller}}
}

int coin();
int coin(void);

int multiindirection(int **p) {
if (coin()) // expected-note{{Assuming the condition is true}}
Expand All @@ -205,7 +205,7 @@ int multiindirection(int **p) {
return 0;
}

int usemultiindirection() {
int usemultiindirection(void) {
int a; // expected-note {{'a' declared without an initial value}}
int *b = &a;
multiindirection(&b); // expected-note{{Calling 'multiindirection'}}
Expand All @@ -223,7 +223,7 @@ int indirectingstruct(S** s) {
return 0;
}

int useindirectingstruct() {
int useindirectingstruct(void) {
S s;
S* p = &s;
indirectingstruct(&p); //expected-note{{Calling 'indirectingstruct'}}
Expand All @@ -242,7 +242,7 @@ void initializeMaybeInStruct(D* pD) {
*pD->x = 120;
} // expected-note{{Returning without writing to 'pD->x'}}

int useInitializeMaybeInStruct() {
int useInitializeMaybeInStruct(void) {
int z; // expected-note{{'z' declared without an initial value}}
D d;
d.x = &z;
Expand Down
4 changes: 2 additions & 2 deletions clang/test/Analysis/diagnostics/no-store-func-path-notes.m
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include "../Inputs/system-header-simulator-for-nullability.h"

extern int coin();
extern int coin(void);

@interface I : NSObject
- (int)initVar:(int *)var param:(int)param;
Expand Down Expand Up @@ -41,7 +41,7 @@ int initializer1(int *p, int x) {
}
}

int initFromBlock() {
int initFromBlock(void) {
__block int z;
^{ // expected-note {{Calling anonymous block}}
int p; // expected-note{{'p' declared without an initial value}}
Expand Down
2 changes: 1 addition & 1 deletion clang/test/Analysis/diagnostics/plist-multi-file.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@

#include "plist-multi-file.h"

void bar() {
void bar(void) {
foo(0);
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ int leak(int i) {
return 0;
}

int unicode() {
int unicode(void) {
int løçål = 0;
/* ☃ */ return 1 / løçål; // expected-warning {{Division by zero}}
}
Expand Down
4 changes: 2 additions & 2 deletions clang/test/Analysis/diagnostics/shortest-path-suppression.c
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// RUN: %clang_analyze_cc1 -analyzer-checker=core -analyzer-config suppress-null-return-paths=true -analyzer-output=text -verify %s
// expected-no-diagnostics

int *returnNull() { return 0; }
int coin();
int *returnNull(void) { return 0; }
int coin(void);

// Use a float parameter to ensure that the value is unknown. This will create
// a cycle in the generated ExplodedGraph.
Expand Down
2 changes: 1 addition & 1 deletion clang/test/Analysis/diagnostics/text-diagnostics.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// RUN: %clang_analyze_cc1 -analyzer-checker=core.NullDereference -analyzer-output=text -fno-caret-diagnostics %s 2>&1 | FileCheck %s

void testA() {
void testA(void) {
int *p = 0;
*p = 1;

Expand Down
2 changes: 1 addition & 1 deletion clang/test/Analysis/diagnostics/undef-value-callee.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

void callee() {
void callee(void) {
;
}
2 changes: 1 addition & 1 deletion clang/test/Analysis/diagnostics/undef-value-param.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ int testPassingParentRegionArray(int x) {
//expected-note@-1 {{The right operand of '*' is a garbage value}}
}

double *getValidPtr();
double *getValidPtr(void);
struct WithFields {
double *f1;
};
Expand Down
2 changes: 1 addition & 1 deletion clang/test/Analysis/disable-all-checks.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

// CHECK: no analyzer checkers or packages are associated with 'non.existant.Checker'
// CHECK: use -analyzer-disable-all-checks to disable all static analyzer checkers
int buggy() {
int buggy(void) {
int x = 0;
return 5/x; // no warning
}
22 changes: 11 additions & 11 deletions clang/test/Analysis/dispatch-once.m
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,17 @@
typedef long dispatch_once_t;
void dispatch_once(dispatch_once_t *predicate, dispatch_block_t block);

void test_stack() {
void test_stack(void) {
dispatch_once_t once;
dispatch_once(&once, ^{}); // expected-warning{{Call to 'dispatch_once' uses the local variable 'once' for the predicate value. Using such transient memory for the predicate is potentially dangerous. Perhaps you intended to declare the variable as 'static'?}}
}

void test_static_local() {
void test_static_local(void) {
static dispatch_once_t once;
dispatch_once(&once, ^{}); // no-warning
}

void test_heap_var() {
void test_heap_var(void) {
dispatch_once_t *once = calloc(1, sizeof(dispatch_once_t));
// Use regexps to check that we're NOT suggesting to make this static.
dispatch_once(once, ^{}); // expected-warning-re{{{{^Call to 'dispatch_once' uses heap-allocated memory for the predicate value. Using such transient memory for the predicate is potentially dangerous$}}}}
Expand All @@ -44,12 +44,12 @@ void test_external_pointer(dispatch_once_t *once) {
dispatch_once_t once;
} Struct;

void test_local_struct() {
void test_local_struct(void) {
Struct s;
dispatch_once(&s.once, ^{}); // expected-warning{{Call to 'dispatch_once' uses memory within the local variable 's' for the predicate value.}}
}

void test_heap_struct() {
void test_heap_struct(void) {
Struct *s = calloc(1, sizeof(Struct));
dispatch_once(&s->once, ^{}); // expected-warning{{Call to 'dispatch_once' uses heap-allocated memory for the predicate value.}}
}
Expand All @@ -76,15 +76,15 @@ - (void)test_ivar_array_from_inside {
}
@end

void test_ivar_from_alloc_init() {
void test_ivar_from_alloc_init(void) {
Object *o = [[Object alloc] init];
dispatch_once(&o->once, ^{}); // expected-warning{{Call to 'dispatch_once' uses the instance variable 'once' for the predicate value.}}
}
void test_ivar_struct_from_alloc_init() {
void test_ivar_struct_from_alloc_init(void) {
Object *o = [[Object alloc] init];
dispatch_once(&o->s.once, ^{}); // expected-warning{{Call to 'dispatch_once' uses memory within the instance variable 's' for the predicate value.}}
}
void test_ivar_array_from_alloc_init() {
void test_ivar_array_from_alloc_init(void) {
Object *o = [[Object alloc] init];
dispatch_once(&o->once_array[1], ^{}); // expected-warning{{Call to 'dispatch_once' uses memory within the instance variable 'once_array' for the predicate value.}}
}
Expand All @@ -100,7 +100,7 @@ void test_ivar_array_from_external_obj(Object *o) {
dispatch_once(&o->once_array[1], ^{}); // expected-warning{{Call to 'dispatch_once' uses memory within the instance variable 'once_array' for the predicate value.}}
}

void test_block_var_from_block() {
void test_block_var_from_block(void) {
__block dispatch_once_t once;
^{
dispatch_once(&once, ^{}); // expected-warning{{Call to 'dispatch_once' uses the block variable 'once' for the predicate value.}}
Expand All @@ -109,15 +109,15 @@ void test_block_var_from_block() {

void use_block_var(dispatch_once_t *once);

void test_block_var_from_outside_block() {
void test_block_var_from_outside_block(void) {
__block dispatch_once_t once;
^{
use_block_var(&once);
};
dispatch_once(&once, ^{}); // expected-warning{{Call to 'dispatch_once' uses the block variable 'once' for the predicate value.}}
}

void test_static_var_from_outside_block() {
void test_static_var_from_outside_block(void) {
static dispatch_once_t once;
^{
dispatch_once(&once, ^{}); // no-warning
Expand Down
10 changes: 5 additions & 5 deletions clang/test/Analysis/domtest.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// RUN: 2>&1 | FileCheck %s

// Test the DominatorsTree implementation with various control flows
int test1()
int test1(void)
{
int x = 6;
int y = x/2;
Expand Down Expand Up @@ -65,7 +65,7 @@ int test1()
// CHECK-NEXT: (8,7)
// CHECK-NEXT: (9,8)

int test2()
int test2(void)
{
int x,y,z;

Expand Down Expand Up @@ -117,7 +117,7 @@ int test2()
// CHECK-NEXT: (6,1)
// CHECK-NEXT: (7,6)

int test3()
int test3(void)
{
int x,y,z;

Expand Down Expand Up @@ -178,7 +178,7 @@ int test3()
// CHECK-NEXT: (7,1)
// CHECK-NEXT: (8,7)

int test4()
int test4(void)
{
int y = 3;
while(y > 0) {
Expand Down Expand Up @@ -257,7 +257,7 @@ int test4()
// CHECK-NEXT: (11,10)
// CHECK-NEXT: (12,11)

int test5()
int test5(void)
{
int x,y,z,a,b,c;
x = 1;
Expand Down
2 changes: 1 addition & 1 deletion clang/test/Analysis/double-ranges-bug.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ typedef unsigned long int A;

extern int fill(A **values, int *nvalues);

void foo() {
void foo(void) {
A *values;
int nvalues;
fill(&values, &nvalues);
Expand Down
4 changes: 2 additions & 2 deletions clang/test/Analysis/dump_egraph.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@

// REQUIRES: asserts

int getJ();
int getJ(void);

int foo() {
int foo(void) {
int *x = 0, *y = 0;
char c = '\x13';

Expand Down
2 changes: 1 addition & 1 deletion clang/test/Analysis/elementtype.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ typedef struct added_obj_st {
} ADDED_OBJ;

// Test if we are using the canonical type for ElementRegion.
void f() {
void f(void) {
ADDED_OBJ *ao[4]={((void*)0),((void*)0),((void*)0),((void*)0)};
if (ao[0] != ((void*)0)) {
ao[0]->type=0;
Expand Down
4 changes: 2 additions & 2 deletions clang/test/Analysis/enum-cast-out-of-range.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ enum En_t {
En_4 = 4
};

void unscopedUnspecifiedCStyle() {
void unscopedUnspecifiedCStyle(void) {
enum En_t Below = (enum En_t)(-5); // expected-warning {{not in the valid range}}
enum En_t NegVal1 = (enum En_t)(-4); // OK.
enum En_t NegVal2 = (enum En_t)(-3); // OK.
Expand All @@ -25,7 +25,7 @@ void unscopedUnspecifiedCStyle() {
}

enum En_t unused;
void unusedExpr() {
void unusedExpr(void) {
// Following line is not something that EnumCastOutOfRangeChecker should
// evaluate. Checker should either ignore this line or process it without
// producing any warnings. However, compilation will (and should) still
Expand Down
4 changes: 2 additions & 2 deletions clang/test/Analysis/equality_tracking.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
#define CHAR_MIN (char)(UCHAR_MAX & ~(UCHAR_MAX >> 1))

void clang_analyzer_eval(int);
void clang_analyzer_warnIfReached();
void clang_analyzer_warnIfReached(void);

int getInt();
int getInt(void);

void zeroImpliesEquality(int a, int b) {
clang_analyzer_eval((a - b) == 0); // expected-warning{{UNKNOWN}}
Expand Down
2 changes: 1 addition & 1 deletion clang/test/Analysis/exercise-ps.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ static void f1(const char *x, char *y) {
// the RvalueType of an ElementRegion.
typedef struct F12_struct {} F12_typedef;
typedef void* void_typedef;
void_typedef f2_helper();
void_typedef f2_helper(void);
static void f2(void *buf) {
F12_typedef* x;
x = f2_helper();
Expand Down
2 changes: 1 addition & 1 deletion clang/test/Analysis/explain-svals.m
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ void test_1(Object *p) {
clang_analyzer_explain(q->x); // expected-warning-re{{{{^initial value of instance variable 'x' of object at symbol of type 'Object \*' conjured at statement '\[\[Object alloc\] init\]'$}}}}
}

void test_2() {
void test_2(void) {
__block int x;
^{
clang_analyzer_explain(&x); // expected-warning-re{{{{^pointer to block variable 'x'$}}}}
Expand Down
17 changes: 0 additions & 17 deletions clang/test/CodeGenCUDA/amdgpu-asan-printf.cu

This file was deleted.

6 changes: 2 additions & 4 deletions clang/test/CodeGenCUDA/amdgpu-asan.cu
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
// RUN: %clang_cc1 %s -emit-llvm -o - -triple=amdgcn-amd-amdhsa \
// RUN: -fcuda-is-device -target-cpu gfx906 -fsanitize=address \
// RUN: -mlink-bitcode-file %t.asanrtl.bc -x hip \
// RUN: | FileCheck -check-prefixes=ASAN,MFCHECK %s
// RUN: | FileCheck -check-prefixes=ASAN %s

// RUN: %clang_cc1 %s -emit-llvm -o - -triple=amdgcn-amd-amdhsa \
// RUN: -fcuda-is-device -target-cpu gfx906 -fsanitize=address \
// RUN: -O3 -mlink-bitcode-file %t.asanrtl.bc -x hip \
// RUN: | FileCheck -check-prefixes=ASAN,MFCHECK %s
// RUN: | FileCheck -check-prefixes=ASAN %s

// RUN: %clang_cc1 %s -emit-llvm -o - -triple=amdgcn-amd-amdhsa \
// RUN: -fcuda-is-device -target-cpu gfx906 -x hip \
Expand All @@ -27,7 +27,5 @@
// ASAN-DAG: @llvm.compiler.used = {{.*}}@__amdgpu_device_library_preserve_asan_functions_ptr
// ASAN-DAG: define weak void @__asan_report_load1(i64 %{{.*}})

// MFCHECK: !{{.*}} = !{i32 4, !"amdgpu_hostcall", i32 1}

// CHECK-NOT: @__amdgpu_device_library_preserve_asan_functions
// CHECK-NOT: @__asan_report_load1
2 changes: 2 additions & 0 deletions clang/test/Driver/cl-options.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,9 @@
// CHECK-NO-MIX-GEN-USE: '{{[a-z=-]*}}' not allowed with '{{[a-z=-]*}}'

// RUN: %clang_cl -### /FA -fprofile-instr-use -- %s 2>&1 | FileCheck -check-prefix=CHECK-PROFILE-USE %s
// RUN: %clang_cl -### /FA -fprofile-use -- %s 2>&1 | FileCheck -check-prefix=CHECK-PROFILE-USE %s
// RUN: %clang_cl -### /FA -fprofile-instr-use=/tmp/somefile.prof -- %s 2>&1 | FileCheck -check-prefix=CHECK-PROFILE-USE-FILE %s
// RUN: %clang_cl -### /FA -fprofile-use=/tmp/somefile.prof -- %s 2>&1 | FileCheck -check-prefix=CHECK-PROFILE-USE-FILE %s
// CHECK-PROFILE-USE: "-fprofile-instrument-use-path=default.profdata"
// CHECK-PROFILE-USE-FILE: "-fprofile-instrument-use-path=/tmp/somefile.prof"

Expand Down
2 changes: 1 addition & 1 deletion clang/test/PCH/decl-in-prototype.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ static inline __attribute__((always_inline)) f(enum { x, y } p) {

#else

int main() {
int main(void) {
return f(0);
}

Expand Down
4 changes: 2 additions & 2 deletions clang/test/PCH/designated-init.c.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ struct P1 l1 = {
.q.b = { [1] = 'x' }
};

extern struct Q1 *foo();
static struct P1 test_foo() {
extern struct Q1 *foo(void);
static struct P1 test_foo(void) {
struct P1 l = { *foo(),
.q.b = { "boo" },
.q.b = { [1] = 'x' }
Expand Down
2 changes: 1 addition & 1 deletion clang/test/PCH/different-diagnostic-level.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ extern int foo;

#else

void f() {
void f(void) {
int a = foo;
// Make sure we parsed this by getting an error.
int b = bar; // expected-error {{undeclared}}
Expand Down
2 changes: 1 addition & 1 deletion clang/test/PCH/different-linker-version.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ extern int foo;

#else

void f() {
void f(void) {
int a = foo;
// Make sure we parsed this by getting an error.
int b = bar; // expected-error {{undeclared}}
Expand Down
2 changes: 1 addition & 1 deletion clang/test/PCH/emit-dependencies.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// RUN: %clang_cc1 -include-pch %t.pch -fsyntax-only -MT %s.o -dependency-file - %s | FileCheck %s
// CHECK: chain-decls1.h

int main() {
int main(void) {
f();
return 0;
}
2 changes: 1 addition & 1 deletion clang/test/PCH/enum.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

int i = Red;

int return_enum_constant() {
int return_enum_constant(void) {
int result = aRoundShape;
return result;
}
Expand Down
2 changes: 1 addition & 1 deletion clang/test/PCH/exprs.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ floating_literal *double_ptr = &floating;
imaginary_literal *cdouble_ptr = &floating_complex;

// StringLiteral
const char* printHello() {
const char* printHello(void) {
return hello;
}

Expand Down
2 changes: 1 addition & 1 deletion clang/test/PCH/externally-retained.m
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#else
//===----------------------------------------------------------------------===//

void callDoSomething() {
void callDoSomething(void) {
doSomething(sharedObject);
}

Expand Down
2 changes: 1 addition & 1 deletion clang/test/PCH/field-designator.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ struct U {
#endif
//===----------------------------------------------------------------------===//

void bar() {
void bar(void) {
static const struct U plan = { .e = 1 };
}

Expand Down
2 changes: 1 addition & 1 deletion clang/test/PCH/format-strings.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ extern int printf(const char *restrict, ...);

#else

void foo() {
void foo(void) {
LOG;
}

Expand Down
2 changes: 1 addition & 1 deletion clang/test/PCH/multiple-include-pch.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ extern int x;

#warning parsed this
// expected-warning@-1 {{parsed this}}
int foo() {
int foo(void) {
return x;
}

Expand Down
2 changes: 1 addition & 1 deletion clang/test/PCH/nonvisible-external-defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@



void f() {
void f(void) {
extern int g(int, int);
}
2 changes: 1 addition & 1 deletion clang/test/PCH/objc_container.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
- (void)setObject:(id)object forKeyedSubscript:(id)key;
@end

void all() {
void all(void) {
NSMutableArray *array;
id oldObject = array[10];

Expand Down
2 changes: 1 addition & 1 deletion clang/test/PCH/objc_import.m
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

#import "objc_import.h"

void func() {
void func(void) {
TestPCH *xx;

xx = [TestPCH alloc];
Expand Down
8 changes: 4 additions & 4 deletions clang/test/PCH/objc_literals.m
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ + (id)dictionaryWithObjects:(const id [])objects forKeys:(const id [])keys count
@end

// CHECK-IR: define internal {{.*}}void @test_numeric_literals()
static inline void test_numeric_literals() {
static inline void test_numeric_literals(void) {
// CHECK-PRINT: id intlit = @17
// CHECK-IR: {{call.*17}}
id intlit = @17;
Expand All @@ -50,18 +50,18 @@ static inline void test_numeric_literals() {
id floatlit = @17.45;
}

static inline void test_array_literals() {
static inline void test_array_literals(void) {
// CHECK-PRINT: id arraylit = @[ @17, @17.449999999999999
id arraylit = @[@17, @17.45];
}

static inline void test_dictionary_literals() {
static inline void test_dictionary_literals(void) {
// CHECK-PRINT: id dictlit = @{ @17 : {{@17.449999999999999[^,]*}}, @"hello" : @"world" };
id dictlit = @{@17 : @17.45, @"hello" : @"world" };
}

#else
void test_all() {
void test_all(void) {
test_numeric_literals();
test_array_literals();
test_dictionary_literals();
Expand Down
2 changes: 1 addition & 1 deletion clang/test/PCH/objc_methods.m
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

// expected-no-diagnostics

void func() {
void func(void) {
TestPCH *xx;
TestForwardClassDecl *yy;
// FIXME:
Expand Down
2 changes: 1 addition & 1 deletion clang/test/PCH/objc_property.m
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

// expected-no-diagnostics

void func() {
void func(void) {
TestProperties *xx = [TestProperties alloc];
xx.value = 5;
}
2 changes: 1 addition & 1 deletion clang/test/PCH/pch-dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
// CHECK-CBAR: int bar
int FOO;

int get() {
int get(void) {
#ifdef __cplusplus
// CHECK-CPP: .h.gch{{[/\\]}}cpp.gch
return i;
Expand Down
2 changes: 1 addition & 1 deletion clang/test/PCH/pragma-diag.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

#else

void f() {
void f(void) {
int a = 0;
int b = a==a;
}
Expand Down
2 changes: 1 addition & 1 deletion clang/test/PCH/pragma-optimize.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

int a;

void f() {
void f(void) {
a = 12345;
}

Expand Down
2 changes: 1 addition & 1 deletion clang/test/PCH/rdar8852495.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

#else

int f() {
int f(void) {
int a;
int b = a==a;
unsigned x;
Expand Down
4 changes: 2 additions & 2 deletions clang/test/PCH/struct.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ float getX(struct Point *p1) {
return p1->x;
}

void *get_fun_ptr() {
void *get_fun_ptr(void) {
return fun->is_ptr? fun->ptr : 0;
}

struct Fun2 {
int very_fun;
};

int get_very_fun() {
int get_very_fun(void) {
return fun2->very_fun;
}

Expand Down
2 changes: 1 addition & 1 deletion clang/test/PCH/subscripting-literals.m
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ void testDict(NSString *key, id newObject, id oldObject) {
NSDictionary *dict = @{ key: newObject, key: oldObject };
}

void testBoxableValue() {
void testBoxableValue(void) {
some_struct ss;
id value = @(ss);
}
Expand Down
2 changes: 1 addition & 1 deletion clang/test/PCH/typo.m
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// RUN: %clang_cc1 -x objective-c-header -emit-pch -o %t %S/Inputs/typo.h
// RUN: %clang_cc1 -include-pch %t -verify %s

void f() {
void f(void) {
[NSstring alloc]; // expected-error{{unknown receiver 'NSstring'; did you mean 'NSString'?}}
// expected-note@Inputs/typo.h:3{{declared here}}
}
8 changes: 4 additions & 4 deletions clang/test/PCH/undefined-internal.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
// RUN: %clang_cc1 -include-pch %t %s -verify
#ifndef HEADER_H
#define HEADER_H
static void f();
static void g();
void h() {
static void f(void);
static void g(void);
void h(void) {
f();
g();
}
#else
static void g() {}
static void g(void) {}
// expected-warning@5{{function 'f' has internal linkage but is not defined}}
// expected-note@8{{used here}}
#endif
2 changes: 1 addition & 1 deletion clang/test/Preprocessor/extension-warning.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ TY(1) x; // FIXME: And we should warn here
// Current list of keywords this can trigger on:
// inline, restrict, asm, typeof, _asm

void whatever() {}
void whatever(void) {}
2 changes: 1 addition & 1 deletion clang/test/Preprocessor/macro_raw_string.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

extern void foo(const char *str);

void bar() {
void bar(void) {
FOO(R"(foo
bar)");
}
2 changes: 1 addition & 1 deletion clang/test/Preprocessor/pragma_assume_nonnull.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ int bar(int * ip) { return *ip; }

int foo(int * _Nonnull ip) { return *ip; }

int main() {
int main(void) {
return bar(0) + foo(0); // expected-warning 2 {{null passed to a callee that requires a non-null argument}}
}
4 changes: 2 additions & 2 deletions clang/test/Preprocessor/pragma_microsoft.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ __pragma(comment(linker," bar=" BAR))

#define PRAGMA_IN_ARGS(p) p

void f()
void f(void)
{
__pragma() // expected-warning{{unknown pragma ignored}}
// CHECK: #pragma
Expand Down Expand Up @@ -112,7 +112,7 @@ void test( void ) {
// Test to make sure there are no use-after-free problems
#define B "pp-record.h"
#pragma include_alias("quux.h", B)
void g() {}
void g(int k) {}
#include "quux.h"

// Make sure that empty includes don't work
Expand Down
2 changes: 1 addition & 1 deletion clang/test/Preprocessor/user_defined_system_framework.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
// Check that TestFramework is treated as a system header.
#include <TestFramework/TestFramework.h>

int f1() {
int f1(void) {
return test_framework_func(1) + another_test_framework_func(2);
}
2 changes: 1 addition & 1 deletion clang/test/Profile/c-captured.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

// PGOALL-LABEL: define{{.*}} void @debug_captured()
// PGOGEN: store {{.*}} @[[DCC]], i32 0, i32 0
void debug_captured() {
void debug_captured(void) {
int x = 10;

// Check both debug_captured counters, so we can do this all in one pass
Expand Down
2 changes: 1 addition & 1 deletion clang/test/Profile/c-collision.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// CHECK-EXTRA: @__profd_foo = private global { {{.*}} } { i64 6699318081062747564, i64 -4383447408116050035,

extern int bar;
void foo() {
void foo(void) {
if (bar) {
}
if (bar) {
Expand Down
22 changes: 11 additions & 11 deletions clang/test/Profile/c-general.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
// PGOGEN-LABEL: @simple_loops()
// PGOUSE-LABEL: @simple_loops()
// PGOGEN: store {{.*}} @[[SLC]], i32 0, i32 0
void simple_loops() {
void simple_loops(void) {
int i;
// PGOGEN: store {{.*}} @[[SLC]], i32 0, i32 1
// PGOUSE: br {{.*}} !prof ![[SL1:[0-9]+]]
Expand All @@ -46,7 +46,7 @@ void simple_loops() {
// PGOGEN-LABEL: @conditionals()
// PGOUSE-LABEL: @conditionals()
// PGOGEN: store {{.*}} @[[IFC]], i32 0, i32 0
void conditionals() {
void conditionals(void) {
// PGOGEN: store {{.*}} @[[IFC]], i32 0, i32 1
// PGOUSE: br {{.*}} !prof ![[IF1:[0-9]+]]
for (int i = 0; i < 100; ++i) {
Expand Down Expand Up @@ -87,7 +87,7 @@ void conditionals() {
// PGOGEN-LABEL: @early_exits()
// PGOUSE-LABEL: @early_exits()
// PGOGEN: store {{.*}} @[[EEC]], i32 0, i32 0
void early_exits() {
void early_exits(void) {
int i = 0;

// PGOGEN: store {{.*}} @[[EEC]], i32 0, i32 1
Expand Down Expand Up @@ -134,7 +134,7 @@ void early_exits() {
// PGOGEN-LABEL: @jumps()
// PGOUSE-LABEL: @jumps()
// PGOGEN: store {{.*}} @[[JMC]], i32 0, i32 0
void jumps() {
void jumps(void) {
int i;

// PGOGEN: store {{.*}} @[[JMC]], i32 0, i32 1
Expand Down Expand Up @@ -216,7 +216,7 @@ void jumps() {
// PGOGEN-LABEL: @switches()
// PGOUSE-LABEL: @switches()
// PGOGEN: store {{.*}} @[[SWC]], i32 0, i32 0
void switches() {
void switches(void) {
static int weights[] = {1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5};

// No cases -> no weights
Expand Down Expand Up @@ -289,7 +289,7 @@ void switches() {
// PGOGEN-LABEL: @big_switch()
// PGOUSE-LABEL: @big_switch()
// PGOGEN: store {{.*}} @[[BSC]], i32 0, i32 0
void big_switch() {
void big_switch(void) {
// PGOGEN: store {{.*}} @[[BSC]], i32 0, i32 1
// PGOUSE: br {{.*}} !prof ![[BS1:[0-9]+]]
for (int i = 0; i < 32; ++i) {
Expand Down Expand Up @@ -356,7 +356,7 @@ void big_switch() {
// PGOGEN-LABEL: @boolean_operators()
// PGOUSE-LABEL: @boolean_operators()
// PGOGEN: store {{.*}} @[[BOC]], i32 0, i32 0
void boolean_operators() {
void boolean_operators(void) {
int v;
// PGOGEN: store {{.*}} @[[BOC]], i32 0, i32 1
// PGOUSE: br {{.*}} !prof ![[BO1:[0-9]+]]
Expand Down Expand Up @@ -395,7 +395,7 @@ void boolean_operators() {
// PGOGEN-LABEL: @boolop_loops()
// PGOUSE-LABEL: @boolop_loops()
// PGOGEN: store {{.*}} @[[BLC]], i32 0, i32 0
void boolop_loops() {
void boolop_loops(void) {
int i = 100;

// PGOGEN: store {{.*}} @[[BLC]], i32 0, i32 2
Expand Down Expand Up @@ -435,7 +435,7 @@ void boolop_loops() {
// PGOGEN-LABEL: @conditional_operator()
// PGOUSE-LABEL: @conditional_operator()
// PGOGEN: store {{.*}} @[[COC]], i32 0, i32 0
void conditional_operator() {
void conditional_operator(void) {
int i = 100;

// PGOGEN: store {{.*}} @[[COC]], i32 0, i32 1
Expand All @@ -453,7 +453,7 @@ void conditional_operator() {
// PGOGEN-LABEL: @do_fallthrough()
// PGOUSE-LABEL: @do_fallthrough()
// PGOGEN: store {{.*}} @[[DFC]], i32 0, i32 0
void do_fallthrough() {
void do_fallthrough(void) {
// PGOGEN: store {{.*}} @[[DFC]], i32 0, i32 1
// PGOUSE: br {{.*}} !prof ![[DF1:[0-9]+]]
for (int i = 0; i < 10; ++i) {
Expand All @@ -475,7 +475,7 @@ void do_fallthrough() {
// PGOGEN-LABEL: @static_func()
// PGOUSE-LABEL: @static_func()
// PGOGEN: store {{.*}} @[[STC]], i32 0, i32 0
static void static_func() {
static void static_func(void) {
// PGOGEN: store {{.*}} @[[STC]], i32 0, i32 1
// PGOUSE: br {{.*}} !prof ![[ST1:[0-9]+]]
for (int i = 0; i < 10; ++i) {
Expand Down
4 changes: 2 additions & 2 deletions clang/test/Profile/c-outdated-data.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@
// WITH_MISSING: warning: profile data may be out of date: of 3 functions, 2 have mismatched data that will be ignored
// WITH_MISSING: warning: profile data may be incomplete: of 3 functions, 1 has no data

void no_usable_data() {
void no_usable_data(void) {
int i = 0;

if (i) {}
}

void no_data() {
void no_data(void) {
}

int main(int argc, const char *argv[]) {
Expand Down
2 changes: 1 addition & 1 deletion clang/test/Profile/c-unreachable-after-switch.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

// CHECK-LABEL: @foo()
// CHECK: store {{.*}} @[[C]], i64 0, i64 0
void foo() {
void foo(void) {
// CHECK: store {{.*}} @[[C]], i64 0, i64 2
switch (0) {
default:
Expand Down
2 changes: 1 addition & 1 deletion clang/test/Profile/coverage-prefix-map.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// clean directory, put the source there, and cd into it.
// RUN: rm -rf %t
// RUN: mkdir -p %t/root/nested
// RUN: echo "void f1() {}" > %t/root/nested/coverage-prefix-map.c
// RUN: echo "void f1(void) {}" > %t/root/nested/coverage-prefix-map.c
// RUN: cd %t/root

// RUN: %clang_cc1 -fprofile-instrument=clang -fcoverage-mapping -emit-llvm -mllvm -enable-name-compression=false -main-file-name coverage-prefix-map.c %t/root/nested/coverage-prefix-map.c -o - | FileCheck --check-prefix=ABSOLUTE %s
Expand Down
2 changes: 1 addition & 1 deletion clang/test/Profile/gcc-flag-compatibility-aix.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@

int X = 0;

int main() {
int main(void) {
int i;
for (i = 0; i < 100; i++)
X += i;
Expand Down
2 changes: 1 addition & 1 deletion clang/test/Profile/gcc-flag-compatibility.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@

int X = 0;

int main() {
int main(void) {
int i;
for (i = 0; i < 100; i++)
X += i;
Expand Down
6 changes: 3 additions & 3 deletions clang/test/Refactor/Extract/ExtractionSemicolonPolicy.m
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ void extractStatementNoSemiObjCFor(NSArray *array) {
// CHECK-NEXT: }{{$}}
// CHECK-NEXT: }{{[[:space:]].*}}

void extractStatementNoSemiSync() {
void extractStatementNoSemiSync(void) {
id lock;
/*range bstmt=->+2:4*/@synchronized(lock) {
int x = 0;
Expand All @@ -29,7 +29,7 @@ void extractStatementNoSemiSync() {
// CHECK-NEXT: }{{$}}
// CHECK-NEXT: }{{[[:space:]].*}}

void extractStatementNoSemiAutorel() {
void extractStatementNoSemiAutorel(void) {
/*range cstmt=->+2:4*/@autoreleasepool {
int x = 0;
}
Expand All @@ -41,7 +41,7 @@ void extractStatementNoSemiAutorel() {
// CHECK-NEXT: }{{$}}
// CHECK-NEXT: }{{[[:space:]].*}}

void extractStatementNoSemiTryFinalllllly() {
void extractStatementNoSemiTryFinalllllly(void) {
/*range dstmt=->+3:4*/@try {
int x = 0;
} @finally {
Expand Down
4 changes: 2 additions & 2 deletions clang/test/Rewriter/blockstruct.m
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ void a(b_t work) { }
struct _s {
int a;
};
struct _s *r();
struct _s *r(void);

void f() {
void f(void) {
__block struct _s *s = 0;
a(^{
s = (struct _s *)r();
Expand Down
4 changes: 2 additions & 2 deletions clang/test/Rewriter/crash.m
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ + (id)arrayWithObjects:(id)firstObj, ...;
@interface NSConstantString {}
@end

int main() {
int main(void) {
id foo = [NSArray arrayWithObjects:@"1", @"2", @"3", @"4", @"5", @"6", @"7", @"8", @"9", @"10", @"11", @"12", 0];
return 0;
}
Expand All @@ -19,7 +19,7 @@ @protocol A
@interface Foo
@end

void func() {
void func(void) {
id <A> obj = (id <A>)[Foo bar];
}

6 changes: 3 additions & 3 deletions clang/test/Rewriter/finally.m
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// RUN: %clang_cc1 -rewrite-objc -fobjc-runtime=macosx-fragile-10.5 -fobjc-exceptions -verify %s -o -

int main() {
int main(void) {
@try {
printf("executing try"); // expected-warning{{implicitly declaring library function 'printf' with type 'int (const char *, ...)'}} \
// expected-note{{include the header <stdio.h> or explicitly provide a declaration for 'printf'}}
Expand All @@ -25,14 +25,14 @@ int main() {
return 0;
}

void test_sync_with_implicit_finally() {
void test_sync_with_implicit_finally(void) {
id foo;
@synchronized (foo) {
return; // The rewriter knows how to generate code for implicit finally
}
}

void test2_try_with_implicit_finally() {
void test2_try_with_implicit_finally(void) {
@try {
return; // The rewriter knows how to generate code for implicit finally
} @catch (id e) {
Expand Down
8 changes: 4 additions & 4 deletions clang/test/Rewriter/objc-synchronized-1.m
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// RUN: %clang_cc1 -rewrite-objc -fobjc-runtime=macosx-fragile-10.5 %s -o -

id SYNCH_EXPR();
void SYNCH_BODY();
void SYNCH_BEFORE();
void SYNC_AFTER();
id SYNCH_EXPR(void);
void SYNCH_BODY(void);
void SYNCH_BEFORE(void);
void SYNC_AFTER(void);

void foo(id sem)
{
Expand Down
4 changes: 2 additions & 2 deletions clang/test/Rewriter/rewrite-captured-nested-bvar.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ void q(void (^p)(void)) {
p();
}

void f() {
void f(void) {
__block char BYREF_VAR_CHECK = 'a';
__block char d = 'd';
q(^{
Expand All @@ -25,7 +25,7 @@ void f() {
});
}

int main() {
int main(void) {
f();
return 0;
}
Expand Down
2 changes: 1 addition & 1 deletion clang/test/Rewriter/rewrite-foreach-1.m
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ @interface MyList (BasicTest)
- (void)compilerTestAgainst;
@end

int LOOP();
int LOOP(void);
@implementation MyList (BasicTest)
- (void)compilerTestAgainst {
id el;
Expand Down
6 changes: 3 additions & 3 deletions clang/test/Rewriter/rewrite-foreach-2.m
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ @interface MyList (BasicTest)
- (void)compilerTestAgainst;
@end

int LOOP();
int INNERLOOP();
void END_LOOP();
int LOOP(void);
int INNERLOOP(void);
void END_LOOP(void);
@implementation MyList (BasicTest)
- (void)compilerTestAgainst {
id el;
Expand Down
2 changes: 1 addition & 1 deletion clang/test/Rewriter/rewrite-foreach-3.m
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ @interface MyList (BasicTest)
- (void)compilerTestAgainst;
@end

int LOOP();
int LOOP(void);
@implementation MyList (BasicTest)
- (void)compilerTestAgainst {
MyList * el;
Expand Down
2 changes: 1 addition & 1 deletion clang/test/Rewriter/rewrite-foreach-4.m
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ @interface MyList (BasicTest)
- (void)compilerTestAgainst;
@end

int LOOP();
int LOOP(void);
@implementation MyList (BasicTest)
- (void)compilerTestAgainst {
MyList * el;
Expand Down
2 changes: 1 addition & 1 deletion clang/test/Rewriter/rewrite-foreach-7.m
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// RUN: %clang_cc1 -rewrite-objc -fobjc-runtime=macosx-fragile-10.5 %s -o -

@class NSArray;
int main() {
int main(void) {
NSArray *foo;
for (Class c in foo) { }
}
10 changes: 5 additions & 5 deletions clang/test/Rewriter/rewrite-modern-synchronized.m
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@

void *sel_registerName(const char *);

id SYNCH_EXPR();
void SYNCH_BODY();
void SYNCH_BEFORE();
void SYNC_AFTER();
id SYNCH_EXPR(void);
void SYNCH_BODY(void);
void SYNCH_BEFORE(void);
void SYNC_AFTER(void);

void foo(id sem)
{
Expand All @@ -26,7 +26,7 @@ void foo(id sem)
}
}

void test_sync_with_implicit_finally() {
void test_sync_with_implicit_finally(void) {
id foo;
@synchronized (foo) {
return; // The rewriter knows how to generate code for implicit finally
Expand Down
12 changes: 6 additions & 6 deletions clang/test/Rewriter/rewrite-modern-throw.m
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@
void *sel_registerName(const char *);

@interface Foo @end
void TRY();
void SPLATCH();
void MYTRY();
void MYCATCH();
void TRY(void);
void SPLATCH(void);
void MYTRY(void);
void MYCATCH(void);

void foo() {
void foo(void) {
@try { TRY(); }
@catch (...) { SPLATCH(); @throw; }
}

int main()
int main(void)
{

@try {
Expand Down
10 changes: 5 additions & 5 deletions clang/test/Rewriter/rewrite-modern-try-catch-finally.m
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

extern int printf(const char *, ...);

int main() {
int main(void) {
@try {
}
@finally {
Expand All @@ -30,17 +30,17 @@ int main() {
return 0;
}

void test2_try_with_implicit_finally() {
void test2_try_with_implicit_finally(void) {
@try {
return;
} @catch (id e) {

}
}

void FINALLY();
void TRY();
void CATCH();
void FINALLY(void);
void TRY(void);
void CATCH(void);

@interface NSException
@end
Expand Down
10 changes: 5 additions & 5 deletions clang/test/Rewriter/rewrite-modern-try-finally.m
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
Class isa;
} *id;

void FINALLY();
void TRY();
void INNER_FINALLY();
void INNER_TRY();
void CHECK();
void FINALLY(void);
void TRY(void);
void INNER_FINALLY(void);
void INNER_TRY(void);
void CHECK(void);

@interface Foo
@end
Expand Down
4 changes: 2 additions & 2 deletions clang/test/Rewriter/rewrite-try-catch.m
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
@interface Foo @end
@interface GARF @end

void foo() {
void foo(void) {
@try { TRY(); }
@catch (...) { SPLATCH(); @throw; }
}

int main()
int main(void)
{

@try {
Expand Down
4 changes: 2 additions & 2 deletions clang/test/Rewriter/rewrite-weak-attr.m
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// RUN: %clang_cc1 -triple i686-pc-win32 -fms-extensions -fblocks -Dnil=0 -rewrite-objc -fobjc-runtime=macosx-fragile-10.5 -o - %s
int main() {
int main(void) {
__weak __block id foo = nil;
__block id foo2 = nil;
id foo3 = nil;

void (^myblock)() = ^{
void (^myblock)(void) = ^{
foo = nil;
foo2 = nil;
[foo3 bar];
Expand Down
2 changes: 1 addition & 1 deletion clang/test/Rewriter/undef-field-reference-1.m
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ @interface MyDerived
@end

MyDerived *pd;
int main() {
int main(void) {
return pd->IVAR;
}

Expand Down
4 changes: 2 additions & 2 deletions clang/test/Rewriter/weak_byref_objects.m
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
// RUN: %clang_cc1 -fblocks -triple i386-apple-darwin9 -fobjc-gc -rewrite-objc -fobjc-runtime=macosx-fragile-10.5 %s -o -

#define nil 0
int main() {
int main(void) {
__weak __block id foo = nil;
__block id foo2 = nil;
id foo3 = nil;

void (^myblock)() = ^{
void (^myblock)(void) = ^{
foo = nil;
foo2 = nil;
[foo3 bar];
Expand Down
2 changes: 1 addition & 1 deletion clang/test/VFS/framework-import.m
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@

#import <SomeFramework/public_header.h>

void foo() {
void foo(void) {
from_framework();
}
2 changes: 1 addition & 1 deletion clang/test/VFS/implicit-include.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// RUN: sed -e "s@INPUT_DIR@%{/S:regex_replacement}/Inputs@g" -e "s@OUT_DIR@%{/t:regex_replacement}@g" %S/Inputs/vfsoverlay.yaml > %t.yaml
// RUN: %clang_cc1 -Werror -ivfsoverlay %t.yaml -I %t -include "not_real.h" -fsyntax-only %s

void foo() {
void foo(void) {
bar();
}
2 changes: 1 addition & 1 deletion clang/test/VFS/include-mixed-real-and-virtual.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#include "not_real.h"
#include "real.h"

void foo() {
void foo(void) {
bar();
baz();
}
2 changes: 1 addition & 1 deletion clang/test/VFS/include-real-from-virtual.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@

#include "include_real.h"

void foo() {
void foo(void) {
baz();
}
2 changes: 1 addition & 1 deletion clang/test/VFS/include-virtual-from-real.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@

#include "include_not_real.h"

void foo() {
void foo(void) {
bar();
}
2 changes: 1 addition & 1 deletion clang/test/VFS/include.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@

#include "not_real.h"

void foo() {
void foo(void) {
bar();
}
2 changes: 1 addition & 1 deletion clang/test/VFS/module-import.m
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

@import not_real;

void foo() {
void foo(void) {
bar();
}

Expand Down
2 changes: 1 addition & 1 deletion clang/test/VFS/relative-path.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@

#include "not_real.h"

void foo() {
void foo(void) {
bar();
}
2 changes: 1 addition & 1 deletion clang/test/VFS/vfsroot-with-overlay.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@

#include "not_real.h"

void foo() {
void foo(void) {
bar();
}
4 changes: 2 additions & 2 deletions clang/test/utils/update_cc_test_checks/Inputs/check-globals.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
// RUN: true
// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -emit-llvm -o - %s | FileCheck %s

void foo() {
void foo(void) {
static int i, j;
}
void bar() {
void bar(void) {
static int i, j;
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ int foo(int arg);

void empty_function(void);

int main() {
int main(void) {
empty_function();
return foo(1);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ void empty_function(void);
// CHECK-NEXT: [[CALL:%.*]] = call i32 @foo(i32 noundef 1)
// CHECK-NEXT: ret i32 [[CALL]]
//
int main() {
int main(void) {
empty_function();
return foo(1);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fopenmp %s -emit-llvm -o - | FileCheck %s

void __test_offloading_42_abcdef_bar_l123();
void __test_offloading_42_abcdef_bar_l123(void);
void use(int);

void foo(int a)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --include-generated-funcs --replace-value-regex "__([a-z]+)_offloading_[a-z0-9]+_[a-z0-9]+_(.*)_l[0-9]+" "somevar_[a-z0-9]+_"
// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fopenmp %s -emit-llvm -o - | FileCheck %s

void __test_offloading_42_abcdef_bar_l123();
void __test_offloading_42_abcdef_bar_l123(void);
void use(int);

void foo(int a)
Expand All @@ -23,7 +23,7 @@ void foo(int a)
// CHECK-NEXT: store i32 [[TMP0]], i32* [[CONV]], align 4
// CHECK-NEXT: [[TMP1:%.*]] = load i64, i64* [[A_CASTED]], align 8
// CHECK-NEXT: call void @{{__omp_offloading_[a-z0-9]+_[a-z0-9]+_foo_l[0-9]+}}(i64 [[TMP1]]) #[[ATTR3:[0-9]+]]
// CHECK-NEXT: call void (...) @{{__test_offloading_[a-z0-9]+_[a-z0-9]+_bar_l[0-9]+}}()
// CHECK-NEXT: call void @{{__test_offloading_[a-z0-9]+_[a-z0-9]+_bar_l[0-9]+}}()
// CHECK-NEXT: ret void
//
//
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ double A[size];

void foo(void);

int main() {
int main(void) {
int i = 0;

#pragma omp parallel for
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ double A[size];

void foo(void);

int main() {
int main(void) {
int i = 0;

#pragma omp parallel for
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ void foo(void);
// NOOMP-NEXT: call void @foo()
// NOOMP-NEXT: ret i32 0
//
int main() {
int main(void) {
int i = 0;

#pragma omp parallel for
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -emit-llvm -o - %s | FileCheck %s

void foo() {
void foo(void) {
static int hex = 0x10;
static int dec = 10;
}
void bar() {
void bar(void) {
static int hex = 0x20;
static int dec = 20;
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@
// CHECK-NEXT: entry:
// CHECK-NEXT: ret void
//
void foo() {
void foo(void) {
static int hex = 0x10;
static int dec = 10;
}
// CHECK-LABEL: @bar(
// CHECK-NEXT: entry:
// CHECK-NEXT: ret void
//
void bar() {
void bar(void) {
static int hex = 0x20;
static int dec = 20;
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -emit-llvm -o - %s | FileCheck %s

void foo() {
void foo(void) {
static int i, j;
}
void bar() {
void bar(void) {
static int i, j;
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@
// CHECK-NEXT: entry:
// CHECK-NEXT: ret void
//
void foo() {
void foo(void) {
static int i, j;
}
// CHECK-LABEL: @bar(
// CHECK-NEXT: entry:
// CHECK-NEXT: ret void
//
void bar() {
void bar(void) {
static int i, j;
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
// RUN: %clang_cc1 -triple=x86_64-unknown-linux-gnu -emit-llvm -o - %s | FileCheck %s

int checks_please() {
int checks_please(void) {
return 1;
}

// UTC_ARGS: --disable

int no_checks_please() {
int no_checks_please(void) {
// Manual CHECK line should be retained:
// CHECK: manual check line
return -1;
Expand All @@ -15,6 +15,6 @@ int no_checks_please() {
// UTC_ARGS: --enable


int checks_again() {
int checks_again(void) {
return 2;
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
// CHECK-NEXT: entry:
// CHECK-NEXT: ret i32 1
//
int checks_please() {
int checks_please(void) {
return 1;
}

// UTC_ARGS: --disable

int no_checks_please() {
int no_checks_please(void) {
// Manual CHECK line should be retained:
// CHECK: manual check line
return -1;
Expand All @@ -24,6 +24,6 @@ int no_checks_please() {
// CHECK-NEXT: entry:
// CHECK-NEXT: ret i32 2
//
int checks_again() {
int checks_again(void) {
return 2;
}
8 changes: 4 additions & 4 deletions clang/test/utils/update_cc_test_checks/check-globals.test
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@ END.
BOTH-NEXT:// RUN: true
BOTH-NEXT:// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -emit-llvm -o - %s | FileCheck %s
BOTH-EMPTY:
IGF-NEXT:void foo() {
IGF-NEXT:void foo(void) {
IGF-NEXT: static int i, j;
IGF-NEXT:}
IGF-NEXT:void bar() {
IGF-NEXT:void bar(void) {
IGF-NEXT: static int i, j;
IGF-NEXT:}
BOTH-NEXT://.
Expand All @@ -60,15 +60,15 @@ BOTH-EMPTY:
BOTH-NEXT:// CHECK-NEXT: entry:
BOTH-NEXT:// CHECK-NEXT: ret void
BOTH-NEXT://
NRM-NEXT:void foo() {
NRM-NEXT:void foo(void) {
NRM-NEXT: static int i, j;
NRM-NEXT:}
IGF-NEXT://
BOTH-NEXT:// CHECK-LABEL: @bar(
BOTH-NEXT:// CHECK-NEXT: entry:
BOTH-NEXT:// CHECK-NEXT: ret void
BOTH-NEXT://
NRM-NEXT:void bar() {
NRM-NEXT:void bar(void) {
NRM-NEXT: static int i, j;
NRM-NEXT:}
BOTH-NEXT://.
Expand Down
735 changes: 534 additions & 201 deletions clang/unittests/Format/FormatTest.cpp

Large diffs are not rendered by default.

263 changes: 263 additions & 0 deletions clang/unittests/Format/TokenAnnotatorTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,14 @@

namespace clang {
namespace format {

// Not really the equality, but everything we need.
static bool operator==(const FormatToken &LHS,
const FormatToken &RHS) noexcept {
return LHS.Tok.getKind() == RHS.Tok.getKind() &&
LHS.getType() == RHS.getType();
}

namespace {

class TokenAnnotatorTest : public ::testing::Test {
Expand Down Expand Up @@ -119,6 +127,261 @@ TEST_F(TokenAnnotatorTest, UnderstandsDelete) {
EXPECT_TOKEN(Tokens[7], tok::r_paren, TT_CastRParen);
}

TEST_F(TokenAnnotatorTest, UnderstandsRequiresClausesAndConcepts) {
auto Tokens = annotate("template <typename T>\n"
"concept C = (Foo && Bar) && (Bar && Baz);");

ASSERT_EQ(Tokens.size(), 21u) << Tokens;
EXPECT_TOKEN(Tokens[10], tok::ampamp, TT_BinaryOperator);
EXPECT_TOKEN(Tokens[13], tok::ampamp, TT_BinaryOperator);
EXPECT_TOKEN(Tokens[16], tok::ampamp, TT_BinaryOperator);

Tokens = annotate("template <typename T>\n"
"concept C = requires(T t) {\n"
" { t.foo() };\n"
"} && Bar<T> && Baz<T>;");
ASSERT_EQ(Tokens.size(), 35u) << Tokens;
EXPECT_TOKEN(Tokens[23], tok::ampamp, TT_BinaryOperator);
EXPECT_TOKEN(Tokens[28], tok::ampamp, TT_BinaryOperator);

Tokens = annotate("template<typename T>\n"
"requires C1<T> && (C21<T> || C22<T> && C2e<T>) && C3<T>\n"
"struct Foo;");
ASSERT_EQ(Tokens.size(), 36u) << Tokens;
EXPECT_TOKEN(Tokens[6], tok::identifier, TT_Unknown);
EXPECT_EQ(Tokens[6]->FakeLParens.size(), 1u);
EXPECT_TOKEN(Tokens[10], tok::ampamp, TT_BinaryOperator);
EXPECT_TOKEN(Tokens[16], tok::pipepipe, TT_BinaryOperator);
EXPECT_TOKEN(Tokens[21], tok::ampamp, TT_BinaryOperator);
EXPECT_TOKEN(Tokens[27], tok::ampamp, TT_BinaryOperator);
EXPECT_TOKEN(Tokens[31], tok::greater, TT_TemplateCloser);
EXPECT_EQ(Tokens[31]->FakeRParens, 1u);
EXPECT_TRUE(Tokens[31]->ClosesRequiresClause);

Tokens =
annotate("template<typename T>\n"
"requires (C1<T> && (C21<T> || C22<T> && C2e<T>) && C3<T>)\n"
"struct Foo;");
ASSERT_EQ(Tokens.size(), 38u) << Tokens;
EXPECT_TOKEN(Tokens[7], tok::identifier, TT_Unknown);
EXPECT_EQ(Tokens[7]->FakeLParens.size(), 1u);
EXPECT_TOKEN(Tokens[11], tok::ampamp, TT_BinaryOperator);
EXPECT_TOKEN(Tokens[17], tok::pipepipe, TT_BinaryOperator);
EXPECT_TOKEN(Tokens[22], tok::ampamp, TT_BinaryOperator);
EXPECT_TOKEN(Tokens[28], tok::ampamp, TT_BinaryOperator);
EXPECT_TOKEN(Tokens[32], tok::greater, TT_TemplateCloser);
EXPECT_EQ(Tokens[32]->FakeRParens, 1u);
EXPECT_TOKEN(Tokens[33], tok::r_paren, TT_Unknown);
EXPECT_TRUE(Tokens[33]->ClosesRequiresClause);
}

TEST_F(TokenAnnotatorTest, RequiresDoesNotChangeParsingOfTheRest) {
auto NumberOfAdditionalRequiresClauseTokens = 5u;
auto NumberOfTokensBeforeRequires = 5u;

auto BaseTokens = annotate("template<typename T>\n"
"T Pi = 3.14;");
auto ConstrainedTokens = annotate("template<typename T>\n"
" requires Foo<T>\n"
"T Pi = 3.14;");

auto NumberOfBaseTokens = 11u;

ASSERT_EQ(BaseTokens.size(), NumberOfBaseTokens) << BaseTokens;
ASSERT_EQ(ConstrainedTokens.size(),
NumberOfBaseTokens + NumberOfAdditionalRequiresClauseTokens)
<< ConstrainedTokens;

for (auto I = 0u; I < NumberOfBaseTokens; ++I)
if (I < NumberOfTokensBeforeRequires)
EXPECT_EQ(*BaseTokens[I], *ConstrainedTokens[I]) << I;
else
EXPECT_EQ(*BaseTokens[I],
*ConstrainedTokens[I + NumberOfAdditionalRequiresClauseTokens])
<< I;

BaseTokens = annotate("template<typename T>\n"
"struct Bar;");
ConstrainedTokens = annotate("template<typename T>\n"
" requires Foo<T>\n"
"struct Bar;");
NumberOfBaseTokens = 9u;

ASSERT_EQ(BaseTokens.size(), NumberOfBaseTokens) << BaseTokens;
ASSERT_EQ(ConstrainedTokens.size(),
NumberOfBaseTokens + NumberOfAdditionalRequiresClauseTokens)
<< ConstrainedTokens;

for (auto I = 0u; I < NumberOfBaseTokens; ++I)
if (I < NumberOfTokensBeforeRequires)
EXPECT_EQ(*BaseTokens[I], *ConstrainedTokens[I]) << I;
else
EXPECT_EQ(*BaseTokens[I],
*ConstrainedTokens[I + NumberOfAdditionalRequiresClauseTokens])
<< I;

BaseTokens = annotate("template<typename T>\n"
"struct Bar {"
" T foo();\n"
" T bar();\n"
"};");
ConstrainedTokens = annotate("template<typename T>\n"
" requires Foo<T>\n"
"struct Bar {"
" T foo();\n"
" T bar();\n"
"};");
NumberOfBaseTokens = 21u;

ASSERT_EQ(BaseTokens.size(), NumberOfBaseTokens) << BaseTokens;
ASSERT_EQ(ConstrainedTokens.size(),
NumberOfBaseTokens + NumberOfAdditionalRequiresClauseTokens)
<< ConstrainedTokens;

for (auto I = 0u; I < NumberOfBaseTokens; ++I)
if (I < NumberOfTokensBeforeRequires)
EXPECT_EQ(*BaseTokens[I], *ConstrainedTokens[I]) << I;
else
EXPECT_EQ(*BaseTokens[I],
*ConstrainedTokens[I + NumberOfAdditionalRequiresClauseTokens])
<< I;

BaseTokens = annotate("template<typename T>\n"
"Bar(T) -> Bar<T>;");
ConstrainedTokens = annotate("template<typename T>\n"
" requires Foo<T>\n"
"Bar(T) -> Bar<T>;");
NumberOfBaseTokens = 16u;

ASSERT_EQ(BaseTokens.size(), NumberOfBaseTokens) << BaseTokens;
ASSERT_EQ(ConstrainedTokens.size(),
NumberOfBaseTokens + NumberOfAdditionalRequiresClauseTokens)
<< ConstrainedTokens;

for (auto I = 0u; I < NumberOfBaseTokens; ++I)
if (I < NumberOfTokensBeforeRequires)
EXPECT_EQ(*BaseTokens[I], *ConstrainedTokens[I]) << I;
else
EXPECT_EQ(*BaseTokens[I],
*ConstrainedTokens[I + NumberOfAdditionalRequiresClauseTokens])
<< I;

BaseTokens = annotate("template<typename T>\n"
"T foo();");
ConstrainedTokens = annotate("template<typename T>\n"
" requires Foo<T>\n"
"T foo();");
NumberOfBaseTokens = 11u;

ASSERT_EQ(BaseTokens.size(), NumberOfBaseTokens) << BaseTokens;
ASSERT_EQ(ConstrainedTokens.size(),
NumberOfBaseTokens + NumberOfAdditionalRequiresClauseTokens)
<< ConstrainedTokens;

for (auto I = 0u; I < NumberOfBaseTokens; ++I)
if (I < NumberOfTokensBeforeRequires)
EXPECT_EQ(*BaseTokens[I], *ConstrainedTokens[I]) << I;
else
EXPECT_EQ(*BaseTokens[I],
*ConstrainedTokens[I + NumberOfAdditionalRequiresClauseTokens])
<< I;

BaseTokens = annotate("template<typename T>\n"
"T foo() {\n"
" auto bar = baz();\n"
" return bar + T{};\n"
"}");
ConstrainedTokens = annotate("template<typename T>\n"
" requires Foo<T>\n"
"T foo() {\n"
" auto bar = baz();\n"
" return bar + T{};\n"
"}");
NumberOfBaseTokens = 26u;

ASSERT_EQ(BaseTokens.size(), NumberOfBaseTokens) << BaseTokens;
ASSERT_EQ(ConstrainedTokens.size(),
NumberOfBaseTokens + NumberOfAdditionalRequiresClauseTokens)
<< ConstrainedTokens;

for (auto I = 0u; I < NumberOfBaseTokens; ++I)
if (I < NumberOfTokensBeforeRequires)
EXPECT_EQ(*BaseTokens[I], *ConstrainedTokens[I]) << I;
else
EXPECT_EQ(*BaseTokens[I],
*ConstrainedTokens[I + NumberOfAdditionalRequiresClauseTokens])
<< I;

BaseTokens = annotate("template<typename T>\n"
"T foo();");
ConstrainedTokens = annotate("template<typename T>\n"
"T foo() requires Foo<T>;");
NumberOfBaseTokens = 11u;
NumberOfTokensBeforeRequires = 9u;

ASSERT_EQ(BaseTokens.size(), NumberOfBaseTokens) << BaseTokens;
ASSERT_EQ(ConstrainedTokens.size(),
NumberOfBaseTokens + NumberOfAdditionalRequiresClauseTokens)
<< ConstrainedTokens;

for (auto I = 0u; I < NumberOfBaseTokens; ++I)
if (I < NumberOfTokensBeforeRequires)
EXPECT_EQ(*BaseTokens[I], *ConstrainedTokens[I]) << I;
else
EXPECT_EQ(*BaseTokens[I],
*ConstrainedTokens[I + NumberOfAdditionalRequiresClauseTokens])
<< I;

BaseTokens = annotate("template<typename T>\n"
"T foo() {\n"
" auto bar = baz();\n"
" return bar + T{};\n"
"}");
ConstrainedTokens = annotate("template<typename T>\n"
"T foo() requires Foo<T> {\n"
" auto bar = baz();\n"
" return bar + T{};\n"
"}");
NumberOfBaseTokens = 26u;

ASSERT_EQ(BaseTokens.size(), NumberOfBaseTokens) << BaseTokens;
ASSERT_EQ(ConstrainedTokens.size(),
NumberOfBaseTokens + NumberOfAdditionalRequiresClauseTokens)
<< ConstrainedTokens;

for (auto I = 0u; I < NumberOfBaseTokens; ++I)
if (I < NumberOfTokensBeforeRequires)
EXPECT_EQ(*BaseTokens[I], *ConstrainedTokens[I]) << I;
else
EXPECT_EQ(*BaseTokens[I],
*ConstrainedTokens[I + NumberOfAdditionalRequiresClauseTokens])
<< I;

BaseTokens = annotate("template<typename T>\n"
"Bar(T) -> Bar<typename T::I>;");
ConstrainedTokens = annotate("template<typename T>\n"
" requires requires(T &&t) {\n"
" typename T::I;\n"
" }\n"
"Bar(T) -> Bar<typename T::I>;");
NumberOfBaseTokens = 19u;
NumberOfAdditionalRequiresClauseTokens = 14u;
NumberOfTokensBeforeRequires = 5u;

ASSERT_EQ(BaseTokens.size(), NumberOfBaseTokens) << BaseTokens;
ASSERT_EQ(ConstrainedTokens.size(),
NumberOfBaseTokens + NumberOfAdditionalRequiresClauseTokens)
<< ConstrainedTokens;

for (auto I = 0u; I < NumberOfBaseTokens; ++I)
if (I < NumberOfTokensBeforeRequires)
EXPECT_EQ(*BaseTokens[I], *ConstrainedTokens[I]) << I;
else
EXPECT_EQ(*BaseTokens[I],
*ConstrainedTokens[I + NumberOfAdditionalRequiresClauseTokens])
<< I;
}

} // namespace
} // namespace format
} // namespace clang
1 change: 1 addition & 0 deletions compiler-rt/cmake/Modules/AddCompilerRT.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -638,6 +638,7 @@ macro(add_custom_libcxx name prefix)
-DLIBCXXABI_ENABLE_SHARED=OFF
-DLIBCXXABI_HERMETIC_STATIC_LIBRARY=ON
-DLIBCXXABI_INCLUDE_TESTS=OFF
-DLIBCXX_CXX_ABI=libcxxabi
-DLIBCXX_ENABLE_EXPERIMENTAL_LIBRARY=OFF
-DLIBCXX_ENABLE_SHARED=OFF
-DLIBCXX_HERMETIC_STATIC_LIBRARY=ON
Expand Down
27 changes: 9 additions & 18 deletions compiler-rt/lib/asan/asan_linux.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,30 +131,21 @@ static int FindFirstDSOCallback(struct dl_phdr_info *info, size_t size,
VReport(2, "info->dlpi_name = %s\tinfo->dlpi_addr = %p\n", info->dlpi_name,
(void *)info->dlpi_addr);

// Continue until the first dynamic library is found
if (!info->dlpi_name || info->dlpi_name[0] == 0)
return 0;

// Ignore vDSO
if (internal_strncmp(info->dlpi_name, "linux-", sizeof("linux-") - 1) == 0)
return 0;
const char **name = (const char **)data;

#if SANITIZER_FREEBSD || SANITIZER_NETBSD
// Ignore first entry (the main program)
char **p = (char **)data;
if (!(*p)) {
*p = (char *)-1;
if (!*name) {
*name = "";
return 0;
}
#endif

#if SANITIZER_SOLARIS
// Ignore executable on Solaris
if (info->dlpi_addr == 0)
# if SANITIZER_LINUX
// Ignore vDSO
if (internal_strncmp(info->dlpi_name, "linux-", sizeof("linux-") - 1) == 0)
return 0;
#endif
# endif

*(const char **)data = info->dlpi_name;
*name = info->dlpi_name;
return 1;
}

Expand All @@ -175,7 +166,7 @@ void AsanCheckDynamicRTPrereqs() {
// Ensure that dynamic RT is the first DSO in the list
const char *first_dso_name = nullptr;
dl_iterate_phdr(FindFirstDSOCallback, &first_dso_name);
if (first_dso_name && !IsDynamicRTName(first_dso_name)) {
if (first_dso_name && first_dso_name[0] && !IsDynamicRTName(first_dso_name)) {
Report("ASan runtime does not come first in initial library list; "
"you should either link runtime to your application or "
"manually preload it with LD_PRELOAD.\n");
Expand Down
4 changes: 3 additions & 1 deletion compiler-rt/lib/asan/asan_poisoning.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,13 @@
//===----------------------------------------------------------------------===//

#include "asan_poisoning.h"

#include "asan_report.h"
#include "asan_stack.h"
#include "sanitizer_common/sanitizer_atomic.h"
#include "sanitizer_common/sanitizer_libc.h"
#include "sanitizer_common/sanitizer_flags.h"
#include "sanitizer_common/sanitizer_interface_internal.h"
#include "sanitizer_common/sanitizer_libc.h"

namespace __asan {

Expand Down
6 changes: 4 additions & 2 deletions compiler-rt/lib/asan/asan_report.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,19 @@
// This file contains error reporting code.
//===----------------------------------------------------------------------===//

#include "asan_report.h"

#include "asan_descriptions.h"
#include "asan_errors.h"
#include "asan_flags.h"
#include "asan_descriptions.h"
#include "asan_internal.h"
#include "asan_mapping.h"
#include "asan_report.h"
#include "asan_scariness_score.h"
#include "asan_stack.h"
#include "asan_thread.h"
#include "sanitizer_common/sanitizer_common.h"
#include "sanitizer_common/sanitizer_flags.h"
#include "sanitizer_common/sanitizer_interface_internal.h"
#include "sanitizer_common/sanitizer_report_decorator.h"
#include "sanitizer_common/sanitizer_stackdepot.h"
#include "sanitizer_common/sanitizer_symbolizer.h"
Expand Down
5 changes: 4 additions & 1 deletion compiler-rt/lib/asan/asan_rtl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include "lsan/lsan_common.h"
#include "sanitizer_common/sanitizer_atomic.h"
#include "sanitizer_common/sanitizer_flags.h"
#include "sanitizer_common/sanitizer_interface_internal.h"
#include "sanitizer_common/sanitizer_libc.h"
#include "sanitizer_common/sanitizer_symbolizer.h"
#include "ubsan/ubsan_init.h"
Expand All @@ -44,7 +45,9 @@ static void AsanDie() {
static atomic_uint32_t num_calls;
if (atomic_fetch_add(&num_calls, 1, memory_order_relaxed) != 0) {
// Don't die twice - run a busy loop.
while (1) { }
while (1) {
internal_sched_yield();
}
}
if (common_flags()->print_module_map >= 1)
DumpProcessMap();
Expand Down
1 change: 1 addition & 0 deletions compiler-rt/lib/hwasan/hwasan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include "sanitizer_common/sanitizer_common.h"
#include "sanitizer_common/sanitizer_flag_parser.h"
#include "sanitizer_common/sanitizer_flags.h"
#include "sanitizer_common/sanitizer_interface_internal.h"
#include "sanitizer_common/sanitizer_libc.h"
#include "sanitizer_common/sanitizer_procmaps.h"
#include "sanitizer_common/sanitizer_stackdepot.h"
Expand Down
5 changes: 3 additions & 2 deletions compiler-rt/lib/lsan/lsan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,12 @@

#include "lsan.h"

#include "sanitizer_common/sanitizer_flags.h"
#include "sanitizer_common/sanitizer_flag_parser.h"
#include "lsan_allocator.h"
#include "lsan_common.h"
#include "lsan_thread.h"
#include "sanitizer_common/sanitizer_flag_parser.h"
#include "sanitizer_common/sanitizer_flags.h"
#include "sanitizer_common/sanitizer_interface_internal.h"

bool lsan_inited;
bool lsan_init_is_running;
Expand Down
2 changes: 2 additions & 0 deletions compiler-rt/lib/memprof/memprof_rtl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include "memprof_thread.h"
#include "sanitizer_common/sanitizer_atomic.h"
#include "sanitizer_common/sanitizer_flags.h"
#include "sanitizer_common/sanitizer_interface_internal.h"
#include "sanitizer_common/sanitizer_libc.h"
#include "sanitizer_common/sanitizer_symbolizer.h"

Expand All @@ -38,6 +39,7 @@ static void MemprofDie() {
if (atomic_fetch_add(&num_calls, 1, memory_order_relaxed) != 0) {
// Don't die twice - run a busy loop.
while (1) {
internal_sched_yield();
}
}
if (common_flags()->print_module_map >= 1)
Expand Down
8 changes: 5 additions & 3 deletions compiler-rt/lib/msan/msan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,22 @@
//===----------------------------------------------------------------------===//

#include "msan.h"

#include "msan_chained_origin_depot.h"
#include "msan_origin.h"
#include "msan_poisoning.h"
#include "msan_report.h"
#include "msan_thread.h"
#include "msan_poisoning.h"
#include "sanitizer_common/sanitizer_atomic.h"
#include "sanitizer_common/sanitizer_common.h"
#include "sanitizer_common/sanitizer_flags.h"
#include "sanitizer_common/sanitizer_flag_parser.h"
#include "sanitizer_common/sanitizer_flags.h"
#include "sanitizer_common/sanitizer_interface_internal.h"
#include "sanitizer_common/sanitizer_libc.h"
#include "sanitizer_common/sanitizer_procmaps.h"
#include "sanitizer_common/sanitizer_stackdepot.h"
#include "sanitizer_common/sanitizer_stacktrace.h"
#include "sanitizer_common/sanitizer_symbolizer.h"
#include "sanitizer_common/sanitizer_stackdepot.h"
#include "ubsan/ubsan_flags.h"
#include "ubsan/ubsan_init.h"

Expand Down
2 changes: 2 additions & 0 deletions compiler-rt/lib/sanitizer_common/sanitizer_common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@
//===----------------------------------------------------------------------===//

#include "sanitizer_common.h"

#include "sanitizer_allocator_interface.h"
#include "sanitizer_allocator_internal.h"
#include "sanitizer_atomic.h"
#include "sanitizer_flags.h"
#include "sanitizer_interface_internal.h"
#include "sanitizer_libc.h"
#include "sanitizer_placement_new.h"

Expand Down
3 changes: 1 addition & 2 deletions compiler-rt/lib/sanitizer_common/sanitizer_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
#define SANITIZER_COMMON_H

#include "sanitizer_flags.h"
#include "sanitizer_interface_internal.h"
#include "sanitizer_internal_defs.h"
#include "sanitizer_libc.h"
#include "sanitizer_list.h"
Expand Down Expand Up @@ -286,7 +285,7 @@ void SetStackSizeLimitInBytes(uptr limit);
bool AddressSpaceIsUnlimited();
void SetAddressSpaceUnlimited();
void AdjustStackSize(void *attr);
void PlatformPrepareForSandboxing(__sanitizer_sandbox_arguments *args);
void PlatformPrepareForSandboxing(void *args);
void SetSandboxingCallback(void (*f)());

void InitializeCoverage(bool enabled, const char *coverage_dir);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include "sanitizer_allocator_interface.h"
#include "sanitizer_common.h"
#include "sanitizer_flags.h"
#include "sanitizer_interface_internal.h"
#include "sanitizer_procmaps.h"
#include "sanitizer_stackdepot.h"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@

#include "sanitizer_atomic.h"
#include "sanitizer_common.h"
#include "sanitizer_interface_internal.h"
#include "sanitizer_internal_defs.h"
#include "sanitizer_symbolizer_fuchsia.h"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@
#include "sanitizer_platform.h"

#if !SANITIZER_FUCHSIA
#include "sancov_flags.h"
#include "sanitizer_allocator_internal.h"
#include "sanitizer_atomic.h"
#include "sanitizer_common.h"
#include "sanitizer_file.h"
# include "sancov_flags.h"
# include "sanitizer_allocator_internal.h"
# include "sanitizer_atomic.h"
# include "sanitizer_common.h"
# include "sanitizer_file.h"
# include "sanitizer_interface_internal.h"

using namespace __sanitizer;

Expand Down
1 change: 1 addition & 0 deletions compiler-rt/lib/sanitizer_common/sanitizer_file.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

#include "sanitizer_common.h"
#include "sanitizer_file.h"
# include "sanitizer_interface_internal.h"

namespace __sanitizer {

Expand Down
1 change: 0 additions & 1 deletion compiler-rt/lib/sanitizer_common/sanitizer_file.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
#ifndef SANITIZER_FILE_H
#define SANITIZER_FILE_H

#include "sanitizer_interface_internal.h"
#include "sanitizer_internal_defs.h"
#include "sanitizer_libc.h"
#include "sanitizer_mutex.h"
Expand Down
25 changes: 13 additions & 12 deletions compiler-rt/lib/sanitizer_common/sanitizer_fuchsia.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,18 @@
#include "sanitizer_fuchsia.h"
#if SANITIZER_FUCHSIA

#include <pthread.h>
#include <stdlib.h>
#include <unistd.h>
#include <zircon/errors.h>
#include <zircon/process.h>
#include <zircon/syscalls.h>
#include <zircon/utc.h>

#include "sanitizer_common.h"
#include "sanitizer_libc.h"
#include "sanitizer_mutex.h"
# include <pthread.h>
# include <stdlib.h>
# include <unistd.h>
# include <zircon/errors.h>
# include <zircon/process.h>
# include <zircon/syscalls.h>
# include <zircon/utc.h>

# include "sanitizer_common.h"
# include "sanitizer_interface_internal.h"
# include "sanitizer_libc.h"
# include "sanitizer_mutex.h"

namespace __sanitizer {

Expand Down Expand Up @@ -89,7 +90,7 @@ void InitializePlatformEarly() {}
void MaybeReexec() {}
void CheckASLR() {}
void CheckMPROTECT() {}
void PlatformPrepareForSandboxing(__sanitizer_sandbox_arguments *args) {}
void PlatformPrepareForSandboxing(void *args) {}
void DisableCoreDumperIfNecessary() {}
void InstallDeadlySignalHandlers(SignalHandlerType handler) {}
void SetAlternateSignalStack() {}
Expand Down
1 change: 1 addition & 0 deletions compiler-rt/lib/sanitizer_common/sanitizer_mac.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include "sanitizer_common.h"
#include "sanitizer_file.h"
#include "sanitizer_flags.h"
#include "sanitizer_interface_internal.h"
#include "sanitizer_internal_defs.h"
#include "sanitizer_libc.h"
#include "sanitizer_platform_limits_posix.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ bool IsAccessibleMemoryRange(uptr beg, uptr size) {
return result;
}

void PlatformPrepareForSandboxing(__sanitizer_sandbox_arguments *args) {
void PlatformPrepareForSandboxing(void *args) {
// Some kinds of sandboxes may forbid filesystem access, so we won't be able
// to read the file mappings from /proc/self/maps. Luckily, neither the
// process will be able to load additional libraries, so it's fine to use the
Expand Down
2 changes: 1 addition & 1 deletion compiler-rt/lib/sanitizer_common/sanitizer_win.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,7 @@ void ReExec() {
UNIMPLEMENTED();
}

void PlatformPrepareForSandboxing(__sanitizer_sandbox_arguments *args) {}
void PlatformPrepareForSandboxing(void *args) {}

bool StackSizeIsUnlimited() {
UNIMPLEMENTED();
Expand Down
14 changes: 11 additions & 3 deletions compiler-rt/lib/sanitizer_common/tests/sanitizer_common_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,25 @@
//===----------------------------------------------------------------------===//
#include <algorithm>

// This ensures that including both internal sanitizer_common headers
// and the interface headers does not lead to compilation failures.
// Both may be included in unit tests, where googletest transitively
// pulls in sanitizer interface headers.
// The headers are specifically included using relative paths,
// because a compiler may use a different mismatching version
// of sanitizer headers.
#include "../../../include/sanitizer/asan_interface.h"
#include "../../../include/sanitizer/msan_interface.h"
#include "../../../include/sanitizer/tsan_interface.h"
#include "gtest/gtest.h"
#include "sanitizer_common/sanitizer_allocator_internal.h"
#include "sanitizer_common/sanitizer_common.h"
#include "sanitizer_common/sanitizer_file.h"
#include "sanitizer_common/sanitizer_flags.h"
#include "sanitizer_common/sanitizer_libc.h"
#include "sanitizer_common/sanitizer_platform.h"

#include "sanitizer_pthread_wrappers.h"

#include "gtest/gtest.h"

namespace __sanitizer {

static bool IsSorted(const uptr *array, uptr n) {
Expand Down
10 changes: 5 additions & 5 deletions compiler-rt/lib/tsan/rtl/tsan_interceptors_posix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1554,16 +1554,16 @@ TSAN_INTERCEPTOR(int, __fxstat, int version, int fd, void *buf) {
#endif

TSAN_INTERCEPTOR(int, fstat, int fd, void *buf) {
#if SANITIZER_FREEBSD || SANITIZER_MAC || SANITIZER_ANDROID || SANITIZER_NETBSD
SCOPED_TSAN_INTERCEPTOR(fstat, fd, buf);
#if SANITIZER_GLIBC
SCOPED_TSAN_INTERCEPTOR(__fxstat, 0, fd, buf);
if (fd > 0)
FdAccess(thr, pc, fd);
return REAL(fstat)(fd, buf);
return REAL(__fxstat)(0, fd, buf);
#else
SCOPED_TSAN_INTERCEPTOR(__fxstat, 0, fd, buf);
SCOPED_TSAN_INTERCEPTOR(fstat, fd, buf);
if (fd > 0)
FdAccess(thr, pc, fd);
return REAL(__fxstat)(0, fd, buf);
return REAL(fstat)(fd, buf);
#endif
}

Expand Down
1 change: 1 addition & 0 deletions compiler-rt/lib/tsan/rtl/tsan_rtl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include "sanitizer_common/sanitizer_atomic.h"
#include "sanitizer_common/sanitizer_common.h"
#include "sanitizer_common/sanitizer_file.h"
#include "sanitizer_common/sanitizer_interface_internal.h"
#include "sanitizer_common/sanitizer_libc.h"
#include "sanitizer_common/sanitizer_placement_new.h"
#include "sanitizer_common/sanitizer_stackdepot.h"
Expand Down
7 changes: 4 additions & 3 deletions compiler-rt/lib/ubsan/ubsan_init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,14 @@

#include "ubsan_platform.h"
#if CAN_SANITIZE_UB
#include "ubsan_diag.h"
#include "ubsan_init.h"
#include "ubsan_flags.h"
#include "sanitizer_common/sanitizer_common.h"
#include "sanitizer_common/sanitizer_interface_internal.h"
#include "sanitizer_common/sanitizer_libc.h"
#include "sanitizer_common/sanitizer_mutex.h"
#include "sanitizer_common/sanitizer_symbolizer.h"
#include "ubsan_diag.h"
#include "ubsan_flags.h"
#include "ubsan_init.h"

using namespace __ubsan;

Expand Down
7 changes: 7 additions & 0 deletions flang/include/flang/Optimizer/Dialect/FIRType.h
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,13 @@ inline bool singleIndirectionLevel(mlir::Type ty) {
}
#endif

/// Return true iff `ty` is a RecordType with type parameters.
inline bool isRecordWithTypeParameters(mlir::Type ty) {
if (auto recTy = ty.dyn_cast_or_null<fir::RecordType>())
return recTy.getNumLenParams() != 0;
return false;
}

/// Apply the components specified by `path` to `rootTy` to determine the type
/// of the resulting component element. `rootTy` should be an aggregate type.
/// Returns null on error.
Expand Down
8 changes: 2 additions & 6 deletions flang/lib/Evaluate/check-expression.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -526,18 +526,14 @@ class CheckSpecificationExprHelper
} else {
return "dummy procedure argument";
}
} else if (&symbol.owner() != &scope_ || &ultimate.owner() != &scope_) {
return std::nullopt; // host association is in play
} else if (const auto *object{
ultimate.detailsIf<semantics::ObjectEntityDetails>()}) {
if (object->commonBlock()) {
return std::nullopt;
}
}
for (const semantics::Scope *s{&scope_}; !s->IsGlobal();) {
s = &s->parent();
if (s == &ultimate.owner()) {
return std::nullopt;
}
}
return "reference to local entity '"s + ultimate.name().ToString() + "'";
}

Expand Down
13 changes: 10 additions & 3 deletions flang/lib/Evaluate/tools.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -971,11 +971,18 @@ std::optional<parser::MessageFixedText> CheckProcCompatibility(bool isCall,
} else if (lhsProcedure->HasExplicitInterface() &&
!rhsProcedure->HasExplicitInterface()) {
// Section 10.2.2.4, paragraph 3 prohibits associating a procedure pointer
// with an explicit interface with a procedure with an implicit interface
msg = "Procedure %s with explicit interface may not be associated with"
" procedure designator '%s' with implicit interface"_err_en_US;
// with an explicit interface with a procedure whose characteristics don't
// match. That's the case if the target procedure has an implicit
// interface. But this case is allowed by several other compilers as long
// as the explicit interface can be called via an implicit interface.
if (!lhsProcedure->CanBeCalledViaImplicitInterface()) {
msg = "Procedure %s with explicit interface that cannot be called via "
"an implicit interface cannot be associated with procedure "
"designator with an implicit interface"_err_en_US;
}
} else if (!lhsProcedure->HasExplicitInterface() &&
rhsProcedure->HasExplicitInterface()) {
// OK if the target can be called via an implicit interface
if (!rhsProcedure->CanBeCalledViaImplicitInterface()) {
msg = "Procedure %s with implicit interface may not be associated "
"with procedure designator '%s' with explicit interface that "
Expand Down
25 changes: 17 additions & 8 deletions flang/lib/Optimizer/CodeGen/CodeGen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -927,18 +927,27 @@ struct AllocMemOpConversion : public FIROpConversion<fir::AllocMemOp> {
mlir::LogicalResult
matchAndRewrite(fir::AllocMemOp heap, OpAdaptor adaptor,
mlir::ConversionPatternRewriter &rewriter) const override {
mlir::Type ty = convertType(heap.getType());
auto heapTy = heap.getType();
auto ty = convertType(heapTy);
mlir::LLVM::LLVMFuncOp mallocFunc = getMalloc(heap, rewriter);
mlir::Location loc = heap.getLoc();
auto ity = lowerTy().indexType();
if (auto recTy = fir::unwrapSequenceType(heap.getAllocatedType())
.dyn_cast<fir::RecordType>())
if (recTy.getNumLenParams() != 0) {
TODO(loc,
"fir.allocmem codegen of derived type with length parameters");
return failure();
}
auto dataTy = fir::unwrapRefType(heapTy);
if (fir::isRecordWithTypeParameters(fir::unwrapSequenceType(dataTy)))
TODO(loc, "fir.allocmem codegen of derived type with length parameters");
mlir::Value size = genTypeSizeInBytes(loc, ity, rewriter, ty);
// !fir.array<NxMx!fir.char<K,?>> sets `size` to the width of !fir.char<K>.
// So multiply the constant dimensions here.
if (fir::hasDynamicSize(dataTy))
if (auto seqTy = dataTy.dyn_cast<fir::SequenceType>())
if (fir::characterWithDynamicLen(seqTy.getEleTy())) {
fir::SequenceType::Extent arrSize = 1;
for (auto d : seqTy.getShape())
if (d != fir::SequenceType::getUnknownExtent())
arrSize *= d;
size = rewriter.create<mlir::LLVM::MulOp>(
loc, ity, size, genConstantIndex(loc, ity, rewriter, arrSize));
}
for (mlir::Value opnd : adaptor.getOperands())
size = rewriter.create<mlir::LLVM::MulOp>(
loc, ity, size, integerCast(loc, rewriter, ity, opnd));
Expand Down
1 change: 0 additions & 1 deletion flang/lib/Semantics/check-declarations.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ using characteristics::Procedure;
class CheckHelper {
public:
explicit CheckHelper(SemanticsContext &c) : context_{c} {}
CheckHelper(SemanticsContext &c, const Scope &s) : context_{c}, scope_{&s} {}

SemanticsContext &context() { return context_; }
void Check() { Check(context_.globalScope()); }
Expand Down
37 changes: 37 additions & 0 deletions flang/lib/Semantics/program-tree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,37 @@ static void GetEntryStmts(
}
}

// Collects generics that define simple names that could include
// identically-named subprograms as specific procedures.
static void GetGenerics(
ProgramTree &node, const parser::SpecificationPart &spec) {
for (const auto &decl :
std::get<std::list<parser::DeclarationConstruct>>(spec.t)) {
if (const auto *spec{
std::get_if<parser::SpecificationConstruct>(&decl.u)}) {
if (const auto *generic{std::get_if<
parser::Statement<common::Indirection<parser::GenericStmt>>>(
&spec->u)}) {
const parser::GenericStmt &genericStmt{generic->statement.value()};
const auto &genericSpec{std::get<parser::GenericSpec>(genericStmt.t)};
node.AddGeneric(genericSpec);
} else if (const auto *interface{
std::get_if<common::Indirection<parser::InterfaceBlock>>(
&spec->u)}) {
const parser::InterfaceBlock &interfaceBlock{interface->value()};
const parser::InterfaceStmt &interfaceStmt{
std::get<parser::Statement<parser::InterfaceStmt>>(interfaceBlock.t)
.statement};
const auto *genericSpec{
std::get_if<std::optional<parser::GenericSpec>>(&interfaceStmt.u)};
if (genericSpec && genericSpec->has_value()) {
node.AddGeneric(**genericSpec);
}
}
}
}
}

template <typename T>
static ProgramTree BuildSubprogramTree(const parser::Name &name, const T &x) {
const auto &spec{std::get<parser::SpecificationPart>(x.t)};
Expand All @@ -53,6 +84,7 @@ static ProgramTree BuildSubprogramTree(const parser::Name &name, const T &x) {
ProgramTree node{name, spec, &exec};
GetEntryStmts(node, spec);
GetEntryStmts(node, exec);
GetGenerics(node, spec);
if (subps) {
for (const auto &subp :
std::get<std::list<parser::InternalSubprogram>>(subps->t)) {
Expand All @@ -75,6 +107,7 @@ static ProgramTree BuildModuleTree(const parser::Name &name, const T &x) {
const auto &spec{std::get<parser::SpecificationPart>(x.t)};
const auto &subps{std::get<std::optional<parser::ModuleSubprogramPart>>(x.t)};
ProgramTree node{name, spec};
GetGenerics(node, spec);
if (subps) {
for (const auto &subp :
std::get<std::list<parser::ModuleSubprogram>>(subps->t)) {
Expand Down Expand Up @@ -230,4 +263,8 @@ void ProgramTree::AddEntry(const parser::EntryStmt &entryStmt) {
entryStmts_.emplace_back(entryStmt);
}

void ProgramTree::AddGeneric(const parser::GenericSpec &generic) {
genericSpecs_.emplace_back(generic);
}

} // namespace Fortran::semantics
11 changes: 7 additions & 4 deletions flang/lib/Semantics/program-tree.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ class Scope;
class ProgramTree {
public:
using EntryStmtList = std::list<common::Reference<const parser::EntryStmt>>;
using GenericSpecList =
std::list<common::Reference<const parser::GenericSpec>>;

// Build the ProgramTree rooted at one of these program units.
static ProgramTree Build(const parser::ProgramUnit &);
Expand Down Expand Up @@ -71,17 +73,17 @@ class ProgramTree {
const parser::ExecutionPart *exec() const { return exec_; }
std::list<ProgramTree> &children() { return children_; }
const std::list<ProgramTree> &children() const { return children_; }
const std::list<common::Reference<const parser::EntryStmt>> &
entryStmts() const {
return entryStmts_;
}
const EntryStmtList &entryStmts() const { return entryStmts_; }
const GenericSpecList &genericSpecs() const { return genericSpecs_; }

Symbol::Flag GetSubpFlag() const;
bool IsModule() const; // Module or Submodule
bool HasModulePrefix() const; // in function or subroutine stmt
Scope *scope() const { return scope_; }
void set_scope(Scope &);
void AddChild(ProgramTree &&);
void AddEntry(const parser::EntryStmt &);
void AddGeneric(const parser::GenericSpec &);

template <typename T>
ProgramTree &set_stmt(const parser::Statement<T> &stmt) {
Expand All @@ -102,6 +104,7 @@ class ProgramTree {
const parser::ExecutionPart *exec_{nullptr};
std::list<ProgramTree> children_;
EntryStmtList entryStmts_;
GenericSpecList genericSpecs_;
Scope *scope_{nullptr};
const parser::CharBlock *endStmt_{nullptr};
bool isSpecificationPartResolved_{false};
Expand Down
12 changes: 12 additions & 0 deletions flang/lib/Semantics/resolve-names.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7054,6 +7054,18 @@ void ResolveNamesVisitor::AddSubpNames(ProgramTree &node) {
symbol.set(child.GetSubpFlag());
}
}
for (const auto &generic : node.genericSpecs()) {
if (const auto *name{std::get_if<parser::Name>(&generic->u)}) {
if (currScope().find(name->source) != currScope().end()) {
// If this scope has both a generic interface and a contained
// subprogram with the same name, create the generic's symbol
// now so that any other generics of the same name that are pulled
// into scope later via USE association will properly merge instead
// of raising a bogus error due a conflict with the subprogram.
CreateGeneric(*generic);
}
}
}
}

// Push a new scope for this node or return false on error.
Expand Down
17 changes: 12 additions & 5 deletions flang/runtime/transformational.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,9 @@ void RTNAME(Reshape)(Descriptor &result, const Descriptor &source,
for (SubscriptValue j{0}; j < resultRank; ++j, ++shapeSubscript) {
resultExtent[j] = GetInt64(
shape.Element<char>(&shapeSubscript), shapeElementBytes, terminator);
RUNTIME_CHECK(terminator, resultExtent[j] >= 0);
if (resultExtent[j] < 0)
terminator.Crash(
"RESHAPE: bad value for SHAPE(%d)=%d", j + 1, resultExtent[j]);
resultElements *= resultExtent[j];
}

Expand All @@ -387,7 +389,9 @@ void RTNAME(Reshape)(Descriptor &result, const Descriptor &source,
std::size_t sourceElements{source.Elements()};
std::size_t padElements{pad ? pad->Elements() : 0};
if (resultElements > sourceElements) {
RUNTIME_CHECK(terminator, padElements > 0);
if (padElements <= 0)
terminator.Crash("RESHAPE: not eough elements, need %d but only have %d",
resultElements, sourceElements);
RUNTIME_CHECK(terminator, pad->ElementBytes() == elementBytes);
}

Expand All @@ -397,15 +401,18 @@ void RTNAME(Reshape)(Descriptor &result, const Descriptor &source,
if (order) {
RUNTIME_CHECK(terminator, order->rank() == 1);
RUNTIME_CHECK(terminator, order->type().IsInteger());
RUNTIME_CHECK(terminator, order->GetDimension(0).Extent() == resultRank);
if (order->GetDimension(0).Extent() != resultRank)
terminator.Crash("RESHAPE: the extent of ORDER (%d) must match the rank"
" of the SHAPE (%d)",
order->GetDimension(0).Extent(), resultRank);
std::uint64_t values{0};
SubscriptValue orderSubscript{order->GetDimension(0).LowerBound()};
std::size_t orderElementBytes{order->ElementBytes()};
for (SubscriptValue j{0}; j < resultRank; ++j, ++orderSubscript) {
auto k{GetInt64(order->Element<char>(&orderSubscript), orderElementBytes,
terminator)};
RUNTIME_CHECK(
terminator, k >= 1 && k <= resultRank && !((values >> k) & 1));
if (k < 1 || k > resultRank || ((values >> k) & 1))
terminator.Crash("RESHAPE: bad value for ORDER element (%d)", k);
values |= std::uint64_t{1} << k;
dimOrder[j] = k - 1;
}
Expand Down
Loading