//===- llvm/unittest/TableGen/CodeExpanderTest.cpp - Tests ----------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// #include "Common/GlobalISel/CodeExpander.h" #include "Common/GlobalISel/CodeExpansions.h" #include "llvm/Support/raw_ostream.h" #include "llvm/TableGen/Error.h" #include "gtest/gtest.h" usingnamespacellvm; static StringRef bufferize(StringRef Str) { … } class RAIIDiagnosticChecker { … }; TEST(CodeExpander, NoExpansions) { … } // Indentation is applied to all lines except the first TEST(CodeExpander, Indentation) { … } // \ is an escape character that removes special meanings from the next // character. TEST(CodeExpander, Escape) { … } // $foo is not an expansion. It should warn though. TEST(CodeExpander, NotAnExpansion) { … } // \$foo is not an expansion but shouldn't warn as it's using the escape. TEST(CodeExpander, EscapedNotAnExpansion) { … } // \${foo is not an expansion but shouldn't warn as it's using the escape. TEST(CodeExpander, EscapedUnterminatedExpansion) { … } // \${foo is not an expansion but shouldn't warn as it's using the escape. TEST(CodeExpander, EscapedExpansion) { … } // ${foo} is an undefined expansion and should error. TEST(CodeExpander, UndefinedExpansion) { … } // ${bar is an unterminated expansion. Warn and implicitly terminate it. TEST(CodeExpander, UnterminatedExpansion) { … }