[clang] 0091893 - [clang-format] Undo the change to TestLexer() in commit 32e65b0b8a74

Owen Pan via cfe-commits cfe-commits at lists.llvm.org
Sun Feb 11 22:51:25 PST 2024


Author: Owen Pan
Date: 2024-02-11T22:51:18-08:00
New Revision: 00918933fc4e181fe3c74006d81d7a598c2227b3

URL: https://github.com/llvm/llvm-project/commit/00918933fc4e181fe3c74006d81d7a598c2227b3
DIFF: https://github.com/llvm/llvm-project/commit/00918933fc4e181fe3c74006d81d7a598c2227b3.diff

LOG: [clang-format] Undo the change to TestLexer() in commit 32e65b0b8a74

We can't skip calling getFormattingLangOpts() because LangOpts is not
initialized in the unit tests.

Added: 
    

Modified: 
    clang/unittests/Format/TestLexer.h

Removed: 
    


################################################################################
diff  --git a/clang/unittests/Format/TestLexer.h b/clang/unittests/Format/TestLexer.h
index 6a3d0bdedcee0a..8b5949b32fc9ed 100644
--- a/clang/unittests/Format/TestLexer.h
+++ b/clang/unittests/Format/TestLexer.h
@@ -61,9 +61,7 @@ class TestLexer : public UnwrappedLineConsumer {
             std::vector<std::unique_ptr<llvm::MemoryBuffer>> &Buffers,
             FormatStyle Style = getLLVMStyle())
       : Allocator(Allocator), Buffers(Buffers), Style(Style),
-        SourceMgr("test.cpp", ""), IdentTable(LangOpts) {
-    assert(LangOpts.CPlusPlus);
-  }
+        SourceMgr("test.cpp", ""), IdentTable(getFormattingLangOpts(Style)) {}
 
   TokenList lex(llvm::StringRef Code) {
     FormatTokenLexer Lex = getNewLexer(Code);


        


More information about the cfe-commits mailing list