llvm-project/clang/docs
Muhammad Usman Shahid 0cc3c184c7 Missing tautological compare warnings due to unary operators
The patch mainly focuses on the lack of warnings for
-Wtautological-compare. It works fine for positive numbers but doesn't
for negative numbers. This is because the warning explicitly checks for
an IntegerLiteral AST node, but -1 is represented by a UnaryOperator
with an IntegerLiteral sub-Expr.

For the below code we have warnings:

if (0 == (5 | x)) {}

but not for

if (0 == (-5 | x)) {}

This patch changes the analysis to not look at the AST node directly to
see if it is an IntegerLiteral, but instead attempts to evaluate the
expression to see if it is an integer constant expression. This handles
unary negation signs, but also handles all the other possible operators
as well.

Fixes #42918
Differential Revision: https://reviews.llvm.org/D130510
2022-07-28 07:45:28 -04:00
..
CommandGuide [docs] Update supported language standards list for C++ 2022-06-09 22:14:08 +09:00
DataFlowAnalysisIntroImages [clang][docs][dataflow] Added an introduction to dataflow analysis 2021-12-06 12:16:35 +01:00
analyzer Bump the trunk major version to 16 2022-07-26 21:34:45 -07:00
tools [clang][dataflow] Move NoopAnalysis from unittests to include 2022-07-22 14:11:32 +00:00
APINotes.rst [docs][clang] Fix a broken link on the APINotes doc 2022-06-12 22:53:32 +09:00
AddressSanitizer.rst [asan] Enable detect_stack_use_after_return=1 by default on Linux 2022-04-28 21:08:16 -07:00
AutomaticReferenceCounting.rst [clang] Document objc_unsafeClaimAutoreleasedReturnValue. 2022-02-08 14:30:39 -08:00
Block-ABI-Apple.rst [NFC] Trim trailing whitespace in *.rst 2021-11-15 09:17:08 +08:00
BlockLanguageSpec.rst
CMakeLists.txt
ClangCheck.rst
ClangCommandLineReference.rst [clang] Add a new flag -fexperimental-library to enable experimental library features 2022-07-19 15:04:58 -04:00
ClangFormat.rst [docs] Document git-clang-format 2022-07-13 21:06:00 -04:00
ClangFormatStyleOptions.rst [clang-format][docs] Fix incorrect 'clang-format 7' option markers 2022-07-16 18:19:11 +02:00
ClangFormattedStatus.rst [mlir] Remove VectorToROCDL 2022-07-12 15:21:22 +00:00
ClangLinkerWrapper.rst [Clang][Docs] Update the clang-linker-wrapper documentation. 2022-07-08 14:30:07 -04:00
ClangNvlinkWrapper.rst [NFC] Trim trailing whitespace in *.rst 2021-11-15 09:17:08 +08:00
ClangOffloadBundler.rst [clang][NFC] Fix Typo 2022-01-28 11:55:46 -08:00
ClangOffloadPackager.rst [CommandLine] --help: print "-o <xxx>" instead of "-o=<xxx>" 2022-07-14 01:28:28 -07:00
ClangOffloadWrapper.rst [CommandLine] --help: print "-o <xxx>" instead of "-o=<xxx>" 2022-07-14 01:28:28 -07:00
ClangPlugins.rst [docs] Add note about interaction between clang plugins and -clear-ast-before-backend 2022-02-28 12:53:09 -08:00
ClangStaticAnalyzer.rst
ClangTools.rst
ClangTransformerTutorial.rst Add a clang-transformer tutorial 2021-11-17 13:40:46 +00:00
ConstantInterpreter.rst
ControlFlowIntegrity.rst [NFC] Trim trailing whitespace in *.rst 2021-11-15 09:17:08 +08:00
ControlFlowIntegrityDesign.rst [NFC] Trim trailing whitespace in *.rst 2021-11-15 09:17:08 +08:00
CrossCompilation.rst
DataFlowAnalysisIntro.md [analyzer][NFC] Merge similar conditional paths 2022-03-07 22:05:27 +05:30
DataFlowSanitizer.rst Update all LLVM documentation mentioning runtimes in LLVM_ENABLE_PROJECTS 2022-02-10 15:05:23 -05:00
DataFlowSanitizerDesign.rst [clang] Fix typos in documentation (NFC) 2021-08-21 12:17:58 -07:00
DebuggingCoroutines.rst Fix the Clang sphinx bot 2022-07-08 07:23:40 -04:00
DriverArchitecture.png
DriverInternals.rst
ExternalClangExamples.rst Update references to Discourse instead of the mailing lists. 2022-07-08 11:16:47 -07:00
FAQ.rst
HLSLSupport.rst [Clang] [Docs] Add HLSLSupport page 2022-04-08 12:17:45 -05:00
HardwareAssistedAddressSanitizerDesign.rst [HWASan] Mention x86_64 aliasing mode in design doc. 2021-03-25 14:22:20 -07:00
HowToSetupToolingForLLVM.rst [tooling] Explain how to create a compilation database on Windows [NFC] 2022-03-04 13:06:08 -07:00
InternalsManual.rst Update references to Discourse instead of the mailing lists. 2022-07-08 11:16:47 -07:00
IntroductionToTheClangAST.rst [clang] Fix typos in documentation (NFC) 2021-08-21 12:17:58 -07:00
ItaniumMangleAbiTags.rst
JSONCompilationDatabase.rst [docs] [clang] Small documentation change for compilation databases 2022-01-22 17:30:34 -08:00
LTOVisibility.rst [clang] Don't emit type test/assume for virtual classes that should never participate in WPD 2022-06-16 09:38:14 -07:00
LanguageExtensions.rst [X86] Support `_Float16` on SSE2 and up 2022-06-30 17:21:37 +08:00
LeakSanitizer.rst [lsan][docs] Clarify supported platforms 2021-04-21 10:27:55 -07:00
LibASTImporter.rst Update LibASTImporter.rst 2022-06-26 19:22:52 +05:30
LibASTMatchers.rst
LibASTMatchersReference.html [ASTMatchers] Adding a new matcher for callee declarations of Obj-C 2022-07-21 13:35:31 -07:00
LibASTMatchersTutorial.rst [Documentation] Fixed typos in LibASTMatchers tutorial 2022-06-10 10:22:36 +02:00
LibFormat.rst [NFC] Inclusive language: Remove instances of master in URLs 2021-11-05 08:48:41 -05:00
LibTooling.rst
MSVCCompatibility.rst
MatrixTypes.rst Fix "the the" typo in documentation and user facing strings 2022-05-05 17:52:08 +02:00
MemorySanitizer.rst [msan] Update Use-after-destruction documentation 2022-04-21 14:02:02 -07:00
MisExpect.rst [misexpect] Re-implement MisExpect Diagnostics 2022-04-19 21:23:48 +00:00
Modules.rst [NFC] Trim trailing whitespace in *.rst 2021-11-15 09:17:08 +08:00
ObjectiveCLiterals.rst
OffloadingDesign.rst [docs][clang] Fixing minor typo 2022-06-08 23:35:11 +00:00
OpenCLSupport.rst Update references to Discourse instead of the mailing lists. 2022-07-08 11:16:47 -07:00
OpenMPSupport.rst [OpenMP][NFC] Claim iterators in 'map' clause and motion clauses 2022-07-21 15:50:22 -05:00
PCHInternals.rst
PCHLayout.graffle
PCHLayout.png
RAVFrontendAction.rst [NFC] Trim trailing whitespace in *.rst 2021-11-15 09:17:08 +08:00
README.txt
RefactoringEngine.rst
ReleaseNotes.rst Missing tautological compare warnings due to unary operators 2022-07-28 07:45:28 -04:00
SYCLSupport.rst [SYCL] Enable `opencl_global_[host,device]` attributes for SYCL 2021-05-18 10:27:35 +03:00
SafeStack.rst [Clang][Doc][SafeStack] Fix deadlink (NFC) 2022-06-11 10:59:51 -04:00
SanitizerCoverage.rst [NFC] Trim trailing whitespace in *.rst 2021-11-15 09:17:08 +08:00
SanitizerSpecialCaseList.rst [sanitizer] Add "mainfile" prefix to sanitizer special case list 2022-07-15 10:39:26 -07:00
SanitizerStats.rst
ShadowCallStack.rst
SourceBasedCodeCoverage.rst Coverage: Document how to collect a profile without a filesystem 2021-04-22 11:29:39 -07:00
ThinLTO.rst [clang] Fix sentence in the usage section of ThinLTO docs. 2021-09-30 07:26:19 +05:30
ThreadSafetyAnalysis.rst [clang][docs] Inclusive language: remove use of sanity check in option description 2021-11-30 15:07:43 -05:00
ThreadSanitizer.rst [tsan] Add support for disable_sanitizer_instrumentation attribute 2021-08-23 12:38:33 +02:00
Toolchain.rst Update all LLVM documentation mentioning runtimes in LLVM_ENABLE_PROJECTS 2022-02-10 15:05:23 -05:00
Tooling.rst
UndefinedBehaviorSanitizer.rst Fix "the the" typo in documentation and user facing strings 2022-05-05 17:52:08 +02:00
UsersManual.rst [clang] Document -femit-compact-unwind option in the User’s Manual 2022-07-14 16:50:36 -04:00
conf.py [docs] Remove hard-coded version numbers from sphinx configs 2022-02-01 23:14:12 -08:00
doxygen-mainpage.dox
doxygen.cfg.in [NFC] Inclusive Language: change master to main for .chm files 2021-11-08 08:23:04 -06:00
index.rst [docs] Add document "Debugging C++ Coroutines" 2022-07-08 11:29:00 +08:00
make.bat

README.txt

See llvm/docs/README.txt