@@ -29,7 +29,7 @@ class TestLeakAutoVar : public TestFixture {
2929 TestLeakAutoVar () : TestFixture(" TestLeakAutoVar" ) {}
3030
3131private:
32- const Settings settings = settingsBuilder().library(" std.cfg" ).build();
32+ const Settings settings = settingsBuilder().library(" std.cfg" ).checkLibrary(). build();
3333
3434 void run () override {
3535 mNewTemplate = true ;
@@ -223,7 +223,7 @@ class TestLeakAutoVar : public TestFixture {
223223#define check (...) check_(__FILE__, __LINE__, __VA_ARGS__)
224224 template <size_t size>
225225 void check_ (const char * file, int line, const char (&code)[size], const CheckOptions& options = make_default_obj()) {
226- const Settings settings1 = settingsBuilder ( options.s ? *options.s : settings). checkLibrary (). build () ;
226+ const Settings& settings1 = options.s ? *options.s : settings;
227227
228228 // Tokenize..
229229 SimpleTokenizer tokenizer (settings1, *this , options.cpp );
@@ -235,10 +235,8 @@ class TestLeakAutoVar : public TestFixture {
235235
236236 template <size_t size>
237237 void check_ (const char * file, int line, const char (&code)[size], const Settings & s) {
238- const Settings settings0 = settingsBuilder (s).checkLibrary ().build ();
239-
240238 // Tokenize..
241- SimpleTokenizer tokenizer (settings0 , *this );
239+ SimpleTokenizer tokenizer (s , *this );
242240 ASSERT_LOC (tokenizer.tokenize (code), file, line);
243241
244242 // Check for leaks..
@@ -454,7 +452,7 @@ class TestLeakAutoVar : public TestFixture {
454452 }
455453
456454 void assign22 () { // #9139
457- const Settings s = settingsBuilder ().library (" posix.cfg" ).build ();
455+ const Settings s = settingsBuilder ().library (" posix.cfg" ).checkLibrary (). build ();
458456 check (" void f(char tempFileName[256]) {\n "
459457 " const int fd = socket(AF_INET, SOCK_PACKET, 0 );\n "
460458 " }" , dinit (CheckOptions, $.cpp = true , $.s = &s));
@@ -467,7 +465,7 @@ class TestLeakAutoVar : public TestFixture {
467465 }
468466
469467 void assign23 () {
470- const Settings s = settingsBuilder ().library (" posix.cfg" ).build ();
468+ const Settings s = settingsBuilder ().library (" posix.cfg" ).checkLibrary (). build ();
471469 check (" void f() {\n "
472470 " int n1, n2, n3, n4, n5, n6, n7, n8, n9, n10, n11, n12, n13, n14;\n "
473471 " *&n1 = open(\" xx.log\" , O_RDONLY);\n "
@@ -2277,7 +2275,7 @@ class TestLeakAutoVar : public TestFixture {
22772275 }
22782276
22792277 void ifelse24 () { // #1733
2280- const Settings s = settingsBuilder ().library (" std.cfg" ).library (" posix.cfg" ).build ();
2278+ const Settings s = settingsBuilder ().library (" std.cfg" ).library (" posix.cfg" ).checkLibrary (). build ();
22812279
22822280 check (" void f() {\n "
22832281 " char* temp = strdup(\" temp.txt\" );\n "
@@ -3190,7 +3188,7 @@ class TestLeakAutoVar : public TestFixture {
31903188 " <arg nr=\" 1\" direction=\" in\" />\n "
31913189 " </function>\n "
31923190 " </def>\n " ;
3193- const Settings settingsLeakIgnore = settingsBuilder ().libraryxml (xmldata).build ();
3191+ const Settings settingsLeakIgnore = settingsBuilder ().libraryxml (xmldata).checkLibrary (). build ();
31943192 check (" void f() {\n "
31953193 " double* a = new double[1024];\n "
31963194 " SomeClass::someMethod(a);\n "
0 commit comments