aboutsummaryrefslogtreecommitdiff
path: root/clang/unittests/Format
diff options
context:
space:
mode:
authormingmingl <mingmingl@google.com>2025-02-04 11:11:14 -0800
committermingmingl <mingmingl@google.com>2025-02-04 11:11:14 -0800
commite91747a92d27ecf799427bf563f9f64f7c4d2447 (patch)
tree7aa5a8a9170deec293e152bdf2be804399dcd612 /clang/unittests/Format
parent3a8d9337d816aef41c3ca1484be8b933a71a3c46 (diff)
parent53d6e59b594639417cdbfcfa2d18cea64acb4009 (diff)
downloadllvm-users/mingmingl-llvm/spr/sdpglobalvariable.zip
llvm-users/mingmingl-llvm/spr/sdpglobalvariable.tar.gz
llvm-users/mingmingl-llvm/spr/sdpglobalvariable.tar.bz2
Merge branch 'main' into users/mingmingl-llvm/spr/sdpglobalvariableusers/mingmingl-llvm/spr/sdpglobalvariable
Diffstat (limited to 'clang/unittests/Format')
-rw-r--r--clang/unittests/Format/QualifierFixerTest.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/clang/unittests/Format/QualifierFixerTest.cpp b/clang/unittests/Format/QualifierFixerTest.cpp
index 129828b..3eae39f 100644
--- a/clang/unittests/Format/QualifierFixerTest.cpp
+++ b/clang/unittests/Format/QualifierFixerTest.cpp
@@ -1291,6 +1291,21 @@ TEST_F(QualifierFixerTest, WithCpp11Attribute) {
"[[maybe_unused]] constexpr static int A", Style);
}
+TEST_F(QualifierFixerTest, WithQualifiedTypeName) {
+ auto Style = getLLVMStyle();
+ Style.QualifierAlignment = FormatStyle::QAS_Custom;
+ Style.QualifierOrder = {"constexpr", "type", "const"};
+
+ verifyFormat("constexpr ::int64_t x{1};", "::int64_t constexpr x{1};", Style);
+ verifyFormat("constexpr std::int64_t x{123};",
+ "std::int64_t constexpr x{123};", Style);
+ verifyFormat("constexpr ::std::int64_t x{123};",
+ "::std::int64_t constexpr x{123};", Style);
+
+ Style.TypeNames.push_back("bar");
+ verifyFormat("constexpr foo::bar x{12};", "foo::bar constexpr x{12};", Style);
+}
+
TEST_F(QualifierFixerTest, DisableRegions) {
FormatStyle Style = getLLVMStyle();
Style.QualifierAlignment = FormatStyle::QAS_Custom;