xref: /llvm-project/clang-tools-extra/test/clang-tidy/checkers/misc/const-correctness-unaligned.cpp (revision 1af159e98c23a293c103e1f548866488126ed6f6)
146ae26e7SJonas Toth // RUN: %check_clang_tidy %s misc-const-correctness %t -- \
2*1af159e9SPiotr Zegar // RUN:   -config="{CheckOptions: {\
3*1af159e9SPiotr Zegar // RUN:   misc-const-correctness.TransformValues: true, \
4*1af159e9SPiotr Zegar // RUN:   misc-const-correctness.WarnPointersAsValues: false, \
5*1af159e9SPiotr Zegar // RUN:   misc-const-correctness.TransformPointersAsValues: false} \
6*1af159e9SPiotr Zegar // RUN:   }" -- -fno-delayed-template-parsing -fms-extensions
746ae26e7SJonas Toth 
846ae26e7SJonas Toth struct S {};
946ae26e7SJonas Toth 
1046ae26e7SJonas Toth void f(__unaligned S *);
1146ae26e7SJonas Toth 
scope()1246ae26e7SJonas Toth void scope() {
1346ae26e7SJonas Toth   // FIXME: This is a bug in the analysis, that is confused by '__unaligned'.
1446ae26e7SJonas Toth   // https://bugs.llvm.org/show_bug.cgi?id=51756
1546ae26e7SJonas Toth   S s;
1646ae26e7SJonas Toth   // CHECK-MESSAGES:[[@LINE-1]]:3: warning: variable 's' of type 'S' can be declared 'const'
1746ae26e7SJonas Toth   // CHECK-FIXES: S const s;
1846ae26e7SJonas Toth   f(&s);
1946ae26e7SJonas Toth }
20