xref: /llvm-project/clang-tools-extra/test/clang-tidy/checkers/misc/const-correctness-unaligned.cpp (revision 1af159e98c23a293c103e1f548866488126ed6f6)
1 // RUN: %check_clang_tidy %s misc-const-correctness %t -- \
2 // RUN:   -config="{CheckOptions: {\
3 // RUN:   misc-const-correctness.TransformValues: true, \
4 // RUN:   misc-const-correctness.WarnPointersAsValues: false, \
5 // RUN:   misc-const-correctness.TransformPointersAsValues: false} \
6 // RUN:   }" -- -fno-delayed-template-parsing -fms-extensions
7 
8 struct S {};
9 
10 void f(__unaligned S *);
11 
scope()12 void scope() {
13   // FIXME: This is a bug in the analysis, that is confused by '__unaligned'.
14   // https://bugs.llvm.org/show_bug.cgi?id=51756
15   S s;
16   // CHECK-MESSAGES:[[@LINE-1]]:3: warning: variable 's' of type 'S' can be declared 'const'
17   // CHECK-FIXES: S const s;
18   f(&s);
19 }
20