Skip to content

Commit 03fc0aa

Browse files
committed
some more invalid tests and tidy
1 parent c192b0b commit 03fc0aa

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

clang/lib/CIR/Dialect/IR/CIRAttrs.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -547,6 +547,7 @@ void MethodAttr::print(AsmPrinter &printer) const {
547547
//===----------------------------------------------------------------------===//
548548
// GlobalAnnotationValuesAttr definitions
549549
//===----------------------------------------------------------------------===//
550+
550551
LogicalResult GlobalAnnotationValuesAttr::verify(
551552
function_ref<::mlir::InFlightDiagnostic()> emitError,
552553
mlir::ArrayAttr annotations) {

clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2044,7 +2044,7 @@ class CIRGlobalOpLowering
20442044
// Rewrite op.
20452045
auto llvmGlobalOp = rewriter.replaceOpWithNewOp<mlir::LLVM::GlobalOp>(
20462046
op, llvmType, isConst, linkage, symbol, init.value(),
2047-
/*alignment*/op.getAlignment().value_or(0),
2047+
/*alignment*/ op.getAlignment().value_or(0),
20482048
/*addrSpace*/ getGlobalOpTargetAddrSpace(op),
20492049
/*dsoLocal*/ false, /*threadLocal*/ (bool)op.getTlsModelAttr(),
20502050
/*comdat*/ mlir::SymbolRefAttr(), attributes);

clang/test/CIR/IR/invalid-annotations.cir

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
// Test attempt to construct ill-formed global annotations
22
// RUN: cir-opt %s -verify-diagnostics -split-input-file
33

4+
5+
// expected-error @below {{invalid kind of attribute specified}}
6+
// expected-error @below {{failed to parse AnnotationAttr parameter 'name' which is to be a `StringAttr`}}
7+
cir.global external @a = #cir.ptr<null> : !cir.ptr<!cir.double> [#cir.annotation<name = 18, args = ["21", 12 : i32]>]
8+
9+
// -----
10+
411
// expected-error @below {{GlobalAnnotationValuesAttr should at least have one annotation}}
512
module attributes {cir.global_annotations = #cir<annotation_values []>} {}
613

0 commit comments

Comments
 (0)