forked from mirrors/gecko-dev
		
	 34a6c4ff8f
			
		
	
	
		34a6c4ff8f
		
	
	
	
	
		
			
			Differential Revision: https://phabricator.services.mozilla.com/D3980 --HG-- rename : tools/clang-tidy/test/misc-bool-pointer-implicit-conversion.cpp => tools/clang-tidy/test/bugprone-bool-pointer-implicit-conversion.cpp rename : tools/clang-tidy/test/misc-forward-declaration-namespace.cpp => tools/clang-tidy/test/bugprone-forward-declaration-namespace.cpp rename : tools/clang-tidy/test/misc-macro-repeated-side-effects.cpp => tools/clang-tidy/test/bugprone-macro-repeated-side-effects.cpp rename : tools/clang-tidy/test/misc-string-constructor.cpp => tools/clang-tidy/test/bugprone-string-constructor.cpp rename : tools/clang-tidy/test/misc-string-integer-assignment.cpp => tools/clang-tidy/test/bugprone-string-integer-assignment.cpp rename : tools/clang-tidy/test/misc-suspicious-missing-comma.cpp => tools/clang-tidy/test/bugprone-suspicious-missing-comma.cpp rename : tools/clang-tidy/test/misc-swapped-arguments.cpp => tools/clang-tidy/test/bugprone-swapped-arguments.cpp rename : tools/clang-tidy/test/misc-unused-raii.cpp => tools/clang-tidy/test/bugprone-unused-raii.cpp extra : moz-landing-system : lando
		
			
				
	
	
		
			20 lines
		
	
	
	
		
			549 B
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			20 lines
		
	
	
	
		
			549 B
		
	
	
	
		
			C++
		
	
	
	
	
	
| // https://clang.llvm.org/extra/clang-tidy/checks/bugprone-bool-pointer-implicit-conversion.html
 | |
| 
 | |
| bool test(bool* pointer_to_bool, int* pointer_to_int)
 | |
| {
 | |
|   if (pointer_to_bool) { // warning for pointer to bool
 | |
|   }
 | |
| 
 | |
|   if (pointer_to_int) { // no warning for pointer to int
 | |
|   }
 | |
| 
 | |
|   if (!pointer_to_bool) { // no warning, but why not??
 | |
|   }
 | |
| 
 | |
|   if (pointer_to_bool != nullptr) { // no warning for nullptr comparison
 | |
|   }
 | |
| 
 | |
|   // no warning on return, but why not??
 | |
|   // clang-tidy bug: https://bugs.llvm.org/show_bug.cgi?id=38060
 | |
|   return pointer_to_bool;
 | |
| }
 |