File tree Expand file tree Collapse file tree 3 files changed +14
-0
lines changed Expand file tree Collapse file tree 3 files changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -220,6 +220,11 @@ Type emitc::OpaqueType::parse(AsmParser &parser) {
220
220
parser.emitError (loc) << " expected non empty string in !emitc.opaque type" ;
221
221
return Type ();
222
222
}
223
+ if (value.back () == ' *' ) {
224
+ parser.emitError (loc) << " pointer not allowed as outer type with "
225
+ " !emitc.opaque, use !emitc.ptr instead" ;
226
+ return Type ();
227
+ }
223
228
if (parser.parseGreater ())
224
229
return Type ();
225
230
return get (parser.getContext (), value);
Original file line number Diff line number Diff line change @@ -4,3 +4,10 @@ func.func @illegal_opaque_type_1() {
4
4
// expected-error @+1 {{expected non empty string in !emitc.opaque type}}
5
5
%1 = " emitc.variable" (){value = " 42" : !emitc.opaque <" " >} : () -> !emitc.opaque <" mytype" >
6
6
}
7
+
8
+ // -----
9
+
10
+ func.func @illegal_opaque_type_2 () {
11
+ // expected-error @+1 {{pointer not allowed as outer type with !emitc.opaque, use !emitc.ptr instead}}
12
+ %1 = " emitc.variable" (){value = " nullptr" : !emitc.opaque <" int32_t*" >} : () -> !emitc.opaque <" int32_t*" >
13
+ }
Original file line number Diff line number Diff line change @@ -14,6 +14,8 @@ func.func @opaque_types() {
14
14
emitc.call " f" () {template_args = [!emitc <" opaque<\" status_t\" >" >]} : () -> ()
15
15
// CHECK-NEXT: !emitc.opaque<"std::vector<std::string>">
16
16
emitc.call " f" () {template_args = [!emitc.opaque <" std::vector<std::string>" >]} : () -> ()
17
+ // CHECK-NEXT: !emitc.opaque<"SmallVector<int*, 4>">
18
+ emitc.call " f" () {template_args = [!emitc.opaque <" SmallVector<int*, 4>" >]} : () -> ()
17
19
18
20
return
19
21
}
You can’t perform that action at this time.
0 commit comments