Page MenuHomePhabricator

Please use GitHub pull requests for new patches. Phabricator shutdown timeline

Feed Advanced Search

Yesterday

chaitanyav updated the diff for D147844: [clang][Sema]Print diagnostic warning about precedence when integer expression is used without parentheses in an conditional operator expression.

Rebase with upstream and update code as per comments

Mon, Sep 25, 8:16 PM · Restricted Project, Restricted Project, Restricted Project, Restricted Project

May 26 2023

chaitanyav committed rG785b30b8a33a: [clang-tidy] Check for specific return types on all functions (authored by chaitanyav).
[clang-tidy] Check for specific return types on all functions
May 26 2023, 2:10 PM · Restricted Project, Restricted Project
chaitanyav closed D151383: [clang-tidy] Check for specific return types on all functions.
May 26 2023, 2:10 PM · Restricted Project, Restricted Project
chaitanyav added a comment to D151383: [clang-tidy] Check for specific return types on all functions.

LGTM, you may consider reducing commit message (aka review description by removing example and error from it, and leaving just plain description of a change).

May 26 2023, 1:31 PM · Restricted Project, Restricted Project
chaitanyav updated the diff for D151383: [clang-tidy] Check for specific return types on all functions.

use fully qualified name in code and documentation

May 26 2023, 1:08 PM · Restricted Project, Restricted Project
chaitanyav updated the diff for D151383: [clang-tidy] Check for specific return types on all functions.

Make changes as per comments

May 26 2023, 12:34 PM · Restricted Project, Restricted Project

May 25 2023

chaitanyav updated the diff for D151383: [clang-tidy] Check for specific return types on all functions.

Use single backticks for options

May 25 2023, 8:05 PM · Restricted Project, Restricted Project
chaitanyav added a comment to D151383: [clang-tidy] Check for specific return types on all functions.

please let me know if there is better way to do the matching hasAnyReturnType. We could also sort then do binarysearch instead of looping through the list of ret types.

May 25 2023, 4:08 PM · Restricted Project, Restricted Project
chaitanyav updated the diff for D151383: [clang-tidy] Check for specific return types on all functions.

Add tests, update docs and extend matchcallexpr

May 25 2023, 4:04 PM · Restricted Project, Restricted Project

May 24 2023

chaitanyav updated the diff for D151383: [clang-tidy] Check for specific return types on all functions.

Reuse diag code

May 24 2023, 3:49 PM · Restricted Project, Restricted Project
chaitanyav updated the summary of D151383: [clang-tidy] Check for specific return types on all functions.
May 24 2023, 3:30 PM · Restricted Project, Restricted Project
chaitanyav added a comment to D151383: [clang-tidy] Check for specific return types on all functions.

@royjacobson Please list other types that must be included here. The tests are coming...

May 24 2023, 3:28 PM · Restricted Project, Restricted Project
chaitanyav requested review of D151383: [clang-tidy] Check for specific return types on all functions.
May 24 2023, 3:26 PM · Restricted Project, Restricted Project

May 23 2023

chaitanyav added a comment to D147844: [clang][Sema]Print diagnostic warning about precedence when integer expression is used without parentheses in an conditional operator expression.

I used the patch to compile LLVM, apache/arrow, apache/trafficserver, folly, tensorstore, protobuf. I did not see any cases with pointer arithmetic in these repos. I have uploaded the make logs for the projects with diagnostic warnings.

May 23 2023, 6:28 PM · Restricted Project, Restricted Project, Restricted Project, Restricted Project
chaitanyav added a comment to D147844: [clang][Sema]Print diagnostic warning about precedence when integer expression is used without parentheses in an conditional operator expression.

In general, I think this is incremental progress on the diagnostic behavior. However, it's clear that there is room for interpretation on what is or is not a false positive diagnostic for this,

I hope we can agree on what a false positive is here - when the warning fires but the code is what the developer intended (ie: the existing code with the existing language semantics produce the desired result, the "fix" is to add parentheses that explicitly encode the language's existing rules/behavior anyway).

I agree with that definition -- that's a useful way to approach this, thank you!

Not that we don't have warnings that do this - that encourage parens to reinforce what the language already does to be more explicit/intentional about it, and in some cases it's not that uncommon that the user will be adding parens that reinforce the precedence rules anyway.

Yup, which is largely what this patch is about.

Like, I think all the fixes in libc++, llvm, etc, are false positives? (none of them found bugs/unintended behavior)

Yes, they all are false positives by the above definition.

Are there any examples of bugs being found by this warning in a codebase? (& how many false positives in such a codebase did it also flag?)

This would be good to know, but a bit of a heavy lift to require of @chaitanyav because they were working on this issue (https://github.com/llvm/llvm-project/issues/61943) with a "good first issue" label that is starting to look a bit like it was misleading (sorry about that!). However, if you're able to try compiling some larger projects with your patch applied to see if it spots any bugs in real world code, that would be very helpful!

May 23 2023, 5:34 AM · Restricted Project, Restricted Project, Restricted Project, Restricted Project

May 22 2023

chaitanyav updated the diff for D147844: [clang][Sema]Print diagnostic warning about precedence when integer expression is used without parentheses in an conditional operator expression.

Rebase with upstream

May 22 2023, 10:16 AM · Restricted Project, Restricted Project, Restricted Project, Restricted Project
chaitanyav updated the diff for D147844: [clang][Sema]Print diagnostic warning about precedence when integer expression is used without parentheses in an conditional operator expression.

Rebase with upstream

May 22 2023, 8:12 AM · Restricted Project, Restricted Project, Restricted Project, Restricted Project

May 20 2023

chaitanyav updated the diff for D147844: [clang][Sema]Print diagnostic warning about precedence when integer expression is used without parentheses in an conditional operator expression.

Rebase with upstream

May 20 2023, 6:14 PM · Restricted Project, Restricted Project, Restricted Project, Restricted Project

May 11 2023

chaitanyav updated the diff for D147844: [clang][Sema]Print diagnostic warning about precedence when integer expression is used without parentheses in an conditional operator expression.

Rebase with upstream

May 11 2023, 8:45 AM · Restricted Project, Restricted Project, Restricted Project, Restricted Project

May 10 2023

chaitanyav updated the diff for D147844: [clang][Sema]Print diagnostic warning about precedence when integer expression is used without parentheses in an conditional operator expression.

Remove extra parens

May 10 2023, 8:37 PM · Restricted Project, Restricted Project, Restricted Project, Restricted Project

May 9 2023

chaitanyav updated the diff for D147844: [clang][Sema]Print diagnostic warning about precedence when integer expression is used without parentheses in an conditional operator expression.

Rebase with upstream and remove duplicate line from ReleaseNotes

May 9 2023, 9:19 AM · Restricted Project, Restricted Project, Restricted Project, Restricted Project

May 8 2023

chaitanyav updated the diff for D147844: [clang][Sema]Print diagnostic warning about precedence when integer expression is used without parentheses in an conditional operator expression.

Rebase with upstream

May 8 2023, 3:32 PM · Restricted Project, Restricted Project, Restricted Project, Restricted Project

May 4 2023

chaitanyav committed rG14805dcb0d8a: [clang][ExtractAPI] Add semicolon to function declaration fragments (authored by chaitanyav).
[clang][ExtractAPI] Add semicolon to function declaration fragments
May 4 2023, 11:48 AM · Restricted Project, Restricted Project
chaitanyav closed D149737: [clang][ExtractAPI] Add semicolon to function declaration fragments.
May 4 2023, 11:48 AM · Restricted Project, Restricted Project
chaitanyav added a comment to D146090: [Clang] Updating handling of defaulted comparison operators to reflect changes from P2448R2.

@shafik @aaron.ballman I see some errors

[2/2503] Building DiagnosticCrossTUKinds.inc...
FAILED: tools/clang/include/clang/Basic/DiagnosticCrossTUKinds.inc /home/nvellanki/scratch/llvm-project/tools/clang/include/clang/Basic/DiagnosticCrossTUKinds.inc 
cd /home/nvellanki/scratch/llvm-project && /home/nvellanki/scratch/llvm-project/bin/clang-tblgen -gen-clang-diags-defs -clang-component=CrossTU -I /home/nvellanki/scratch/llvm-project/clang/include/clang/Basic -I/home/nvellanki/scratch/llvm-project/clang/include -I/home/nvellanki/scratch/llvm-project/tools/clang/include -I/home/nvellanki/scratch/llvm-project/include -I/home/nvellanki/scratch/llvm-project/llvm/include /home/nvellanki/scratch/llvm-project/clang/include/clang/Basic/Diagnostic.td --write-if-changed -o tools/clang/include/clang/Basic/DiagnosticCrossTUKinds.inc -d tools/clang/include/clang/Basic/DiagnosticCrossTUKinds.inc.d
Included from /home/nvellanki/scratch/llvm-project/clang/include/clang/Basic/Diagnostic.td:168:
/home/nvellanki/scratch/llvm-project/clang/include/clang/Basic/DiagnosticSemaKinds.td:9443:11: error: Variable not defined: 'CXXPre2bCompat'
  InGroup<CXXPre2bCompat>, DefaultIgnore;
          ^
[3/2503] Building DiagnosticASTKinds.inc...
FAILED: tools/clang/include/clang/Basic/DiagnosticASTKinds.inc /home/nvellanki/scratch/llvm-project/tools/clang/include/clang/Basic/DiagnosticASTKinds.inc 
cd /home/nvellanki/scratch/llvm-project && /home/nvellanki/scratch/llvm-project/bin/clang-tblgen -gen-clang-diags-defs -clang-component=AST -I /home/nvellanki/scratch/llvm-project/clang/include/clang/Basic -I/home/nvellanki/scratch/llvm-project/clang/include -I/home/nvellanki/scratch/llvm-project/tools/clang/include -I/home/nvellanki/scratch/llvm-project/include -I/home/nvellanki/scratch/llvm-project/llvm/include /home/nvellanki/scratch/llvm-project/clang/include/clang/Basic/Diagnostic.td --write-if-changed -o tools/clang/include/clang/Basic/DiagnosticASTKinds.inc -d tools/clang/include/clang/Basic/DiagnosticASTKinds.inc.d
Included from /home/nvellanki/scratch/llvm-project/clang/include/clang/Basic/Diagnostic.td:168:
/home/nvellanki/scratch/llvm-project/clang/include/clang/Basic/DiagnosticSemaKinds.td:9443:11: error: Variable not defined: 'CXXPre2bCompat'
  InGroup<CXXPre2bCompat>, DefaultIgnore;
          ^
[4/2503] Building DiagnosticFrontendKinds.inc...
FAILED: tools/clang/include/clang/Basic/DiagnosticFrontendKinds.inc /home/nvellanki/scratch/llvm-project/tools/clang/include/clang/Basic/DiagnosticFrontendKinds.inc 
cd /home/nvellanki/scratch/llvm-project && /home/nvellanki/scratch/llvm-project/bin/clang-tblgen -gen-clang-diags-defs -clang-component=Frontend -I /home/nvellanki/scratch/llvm-project/clang/include/clang/Basic -I/home/nvellanki/scratch/llvm-project/clang/include -I/home/nvellanki/scratch/llvm-project/tools/clang/include -I/home/nvellanki/scratch/llvm-project/include -I/home/nvellanki/scratch/llvm-project/llvm/include /home/nvellanki/scratch/llvm-project/clang/include/clang/Basic/Diagnostic.td --write-if-changed -o tools/clang/include/clang/Basic/DiagnosticFrontendKinds.inc -d tools/clang/include/clang/Basic/DiagnosticFrontendKinds.inc.d
Included from /home/nvellanki/scratch/llvm-project/clang/include/clang/Basic/Diagnostic.td:168:
/home/nvellanki/scratch/llvm-project/clang/include/clang/Basic/DiagnosticSemaKinds.td:9443:11: error: Variable not defined: 'CXXPre2bCompat'
  InGroup<CXXPre2bCompat>, DefaultIgnore;
          ^
[5/2503] Building DiagnosticAnalysisKinds.inc...
FAILED: tools/clang/include/clang/Basic/DiagnosticAnalysisKinds.inc /home/nvellanki/scratch/llvm-project/tools/clang/include/clang/Basic/DiagnosticAnalysisKinds.inc 
cd /home/nvellanki/scratch/llvm-project && /home/nvellanki/scratch/llvm-project/bin/clang-tblgen -gen-clang-diags-defs -clang-component=Analysis -I /home/nvellanki/scratch/llvm-project/clang/include/clang/Basic -I/home/nvellanki/scratch/llvm-project/clang/include -I/home/nvellanki/scratch/llvm-project/tools/clang/include -I/home/nvellanki/scratch/llvm-project/include -I/home/nvellanki/scratch/llvm-project/llvm/include /home/nvellanki/scratch/llvm-project/clang/include/clang/Basic/Diagnostic.td --write-if-changed -o tools/clang/include/clang/Basic/DiagnosticAnalysisKinds.inc -d tools/clang/include/clang/Basic/DiagnosticAnalysisKinds.inc.d
Included from /home/nvellanki/scratch/llvm-project/clang/include/clang/Basic/Diagnostic.td:168:
/home/nvellanki/scratch/llvm-project/clang/include/clang/Basic/DiagnosticSemaKinds.td:9443:11: error: Variable not defined: 'CXXPre2bCompat'
  InGroup<CXXPre2bCompat>, DefaultIgnore;
          ^
[6/2503] Building DiagnosticDriverKinds.inc...
FAILED: tools/clang/include/clang/Basic/DiagnosticDriverKinds.inc /home/nvellanki/scratch/llvm-project/tools/clang/include/clang/Basic/DiagnosticDriverKinds.inc 
cd /home/nvellanki/scratch/llvm-project && /home/nvellanki/scratch/llvm-project/bin/clang-tblgen -gen-clang-diags-defs -clang-component=Driver -I /home/nvellanki/scratch/llvm-project/clang/include/clang/Basic -I/home/nvellanki/scratch/llvm-project/clang/include -I/home/nvellanki/scratch/llvm-project/tools/clang/include -I/home/nvellanki/scratch/llvm-project/include -I/home/nvellanki/scratch/llvm-project/llvm/include /home/nvellanki/scratch/llvm-project/clang/include/clang/Basic/Diagnostic.td --write-if-changed -o tools/clang/include/clang/Basic/DiagnosticDriverKinds.inc -d tools/clang/include/clang/Basic/DiagnosticDriverKinds.inc.d
Included from /home/nvellanki/scratch/llvm-project/clang/include/clang/Basic/Diagnostic.td:168:
/home/nvellanki/scratch/llvm-project/clang/include/clang/Basic/DiagnosticSemaKinds.td:9443:11: error: Variable not defined: 'CXXPre2bCompat'
  InGroup<CXXPre2bCompat>, DefaultIgnore;
          ^
[7/2503] Building DiagnosticCommentKinds.inc...
FAILED: tools/clang/include/clang/Basic/DiagnosticCommentKinds.inc /home/nvellanki/scratch/llvm-project/tools/clang/include/clang/Basic/DiagnosticCommentKinds.inc 
cd /home/nvellanki/scratch/llvm-project && /home/nvellanki/scratch/llvm-project/bin/clang-tblgen -gen-clang-diags-defs -clang-component=Comment -I /home/nvellanki/scratch/llvm-project/clang/include/clang/Basic -I/home/nvellanki/scratch/llvm-project/clang/include -I/home/nvellanki/scratch/llvm-project/tools/clang/include -I/home/nvellanki/scratch/llvm-project/include -I/home/nvellanki/scratch/llvm-project/llvm/include /home/nvellanki/scratch/llvm-project/clang/include/clang/Basic/Diagnostic.td --write-if-changed -o tools/clang/include/clang/Basic/DiagnosticCommentKinds.inc -d tools/clang/include/clang/Basic/DiagnosticCommentKinds.inc.d
Included from /home/nvellanki/scratch/llvm-project/clang/include/clang/Basic/Diagnostic.td:168:
/home/nvellanki/scratch/llvm-project/clang/include/clang/Basic/DiagnosticSemaKinds.td:9443:11: error: Variable not defined: 'CXXPre2bCompat'
  InGroup<CXXPre2bCompat>, DefaultIgnore;
          ^
[8/2503] Building DiagnosticCommonKinds.inc...
FAILED: tools/clang/include/clang/Basic/DiagnosticCommonKinds.inc /home/nvellanki/scratch/llvm-project/tools/clang/include/clang/Basic/DiagnosticCommonKinds.inc 
cd /home/nvellanki/scratch/llvm-project && /home/nvellanki/scratch/llvm-project/bin/clang-tblgen -gen-clang-diags-defs -clang-component=Common -I /home/nvellanki/scratch/llvm-project/clang/include/clang/Basic -I/home/nvellanki/scratch/llvm-project/clang/include -I/home/nvellanki/scratch/llvm-project/tools/clang/include -I/home/nvellanki/scratch/llvm-project/include -I/home/nvellanki/scratch/llvm-project/llvm/include /home/nvellanki/scratch/llvm-project/clang/include/clang/Basic/Diagnostic.td --write-if-changed -o tools/clang/include/clang/Basic/DiagnosticCommonKinds.inc -d tools/clang/include/clang/Basic/DiagnosticCommonKinds.inc.d
Included from /home/nvellanki/scratch/llvm-project/clang/include/clang/Basic/Diagnostic.td:168:
/home/nvellanki/scratch/llvm-project/clang/include/clang/Basic/DiagnosticSemaKinds.td:9443:11: error: Variable not defined: 'CXXPre2bCompat'
  InGroup<CXXPre2bCompat>, DefaultIgnore;
          ^
[9/2503] Building CXX object lib/LTO/CMakeFiles/LLVMLTO.dir/LTO.cpp.o
ninja: build stopped: subcommand failed.
May 4 2023, 11:14 AM · Restricted Project, Restricted Project
chaitanyav added a comment to D148565: [mlir][sparse] group tensor id and levels into pairs in loop emitter.

@Peiming can you please check, the build is failing. Pasting the link to premerge-check https://buildkite.com/llvm-project/premerge-checks/builds/150384#0187e78d-a047-440e-9018-0eecabff91c8

In file included from /home/scratch/llvm-project/mlir/lib/Dialect/SparseTensor/Transforms/CodegenEnv.h:17,
                 from /home/scratch/llvm-project/mlir/lib/Dialect/SparseTensor/Transforms/Sparsification.cpp:13:
/home/scratch/llvm-project/mlir/lib/Dialect/SparseTensor/Transforms/LoopEmitter.h: In member function ‘constexpr mlir::sparse_tensor::TensorLevel mlir::sparse_tensor::LoopEmitter::makeTensorLevel(mlir::sparse_tensor::TensorId, mlir::sparse_tensor::Level) const’:
/home/scratch/llvm-project/mlir/lib/Dialect/SparseTensor/Transforms/LoopEmitter.h:199:29: error: call to non-‘constexpr’ function ‘unsigned int mlir::sparse_tensor::LoopEmitter::getNumTensors() const’
  199 |     return l * getNumTensors() + t;
      |                ~~~~~~~~~~~~~^~
/home/scratch/llvm-project/mlir/lib/Dialect/SparseTensor/Transforms/LoopEmitter.h:195:12: note: ‘unsigned int mlir::sparse_tensor::LoopEmitter::getNumTensors() const’ declared here
  195 |   unsigned getNumTensors() const { return tensors.size(); }
      |            ^~~~~~~~~~~~~
In file included from /usr/include/c++/11/cassert:44,
                 from /home/scratch/llvm-project/llvm/include/llvm/Support/CommandLine.h:34,
                 from /home/scratch/llvm-project/mlir/include/mlir/Pass/PassOptions.h:21,
                 from /home/scratch/llvm-project/mlir/include/mlir/Pass/PassRegistry.h:17,
                 from /home/scratch/llvm-project/mlir/include/mlir/Pass/Pass.h:13,
                 from /home/scratch/llvm-project/mlir/include/mlir/Dialect/SparseTensor/Transforms/Passes.h:21,
                 from /home/scratch/llvm-project/mlir/lib/Dialect/SparseTensor/Transforms/CodegenEnv.h:21,
                 from /home/scratch/llvm-project/mlir/lib/Dialect/SparseTensor/Transforms/Sparsification.cpp:13:
/home/scratch/llvm-project/mlir/lib/Dialect/SparseTensor/Transforms/CodegenEnv.h: In member function ‘constexpr mlir::sparse_tensor::TensorLevel mlir::sparse_tensor::CodegenEnv::makeTensorLevel(mlir::sparse_tensor::TensorId, mlir::sparse_tensor::Level) const’:
/home/scratch/llvm-project/mlir/lib/Dialect/SparseTensor/Transforms/CodegenEnv.h:95:37: error: call to non-‘constexpr’ function ‘unsigned int mlir::sparse_tensor::LoopEmitter::getNumTensors() const’
   95 |     assert(loopEmitter.getNumTensors() == linalgOp->getNumOperands() &&
      |            ~~~~~~~~~~~~~~~~~~~~~~~~~^~
In file included from /home/scratch/llvm-project/mlir/lib/Dialect/SparseTensor/Transforms/CodegenEnv.h:17
May 4 2023, 10:13 AM · Restricted Project, Restricted Project

May 3 2023

chaitanyav updated the diff for D147844: [clang][Sema]Print diagnostic warning about precedence when integer expression is used without parentheses in an conditional operator expression.

Rebase with upstream

May 3 2023, 2:44 PM · Restricted Project, Restricted Project, Restricted Project, Restricted Project
chaitanyav added a comment to D149737: [clang][ExtractAPI] Add semicolon to function declaration fragments.

@dang @ributzka I missed adding semicolons to function declaration fragments in this commit https://github.com/llvm/llvm-project/commit/afce10c5b60fada1db369d3770f4389da7ef30ef . Please review this.

May 3 2023, 8:47 AM · Restricted Project, Restricted Project
chaitanyav requested review of D149737: [clang][ExtractAPI] Add semicolon to function declaration fragments.
May 3 2023, 4:25 AM · Restricted Project, Restricted Project

Apr 28 2023

chaitanyav updated the diff for D147844: [clang][Sema]Print diagnostic warning about precedence when integer expression is used without parentheses in an conditional operator expression.

Rebase with upstream

Apr 28 2023, 7:15 PM · Restricted Project, Restricted Project, Restricted Project, Restricted Project

Apr 26 2023

chaitanyav updated the diff for D147844: [clang][Sema]Print diagnostic warning about precedence when integer expression is used without parentheses in an conditional operator expression.

Revert libcxx libcxxabi files unrelated to the issue

Apr 26 2023, 6:54 PM · Restricted Project, Restricted Project, Restricted Project, Restricted Project
chaitanyav updated the diff for D147844: [clang][Sema]Print diagnostic warning about precedence when integer expression is used without parentheses in an conditional operator expression.

Add parentheses around integer expressions in libcxx tests

Apr 26 2023, 4:05 PM · Restricted Project, Restricted Project, Restricted Project, Restricted Project
chaitanyav updated the diff for D147844: [clang][Sema]Print diagnostic warning about precedence when integer expression is used without parentheses in an conditional operator expression.

Revert to earliest patch

Apr 26 2023, 1:39 PM · Restricted Project, Restricted Project, Restricted Project, Restricted Project
chaitanyav added a comment to D147844: [clang][Sema]Print diagnostic warning about precedence when integer expression is used without parentheses in an conditional operator expression.

Disable precedence conditional warning by default; Revert changes to test files

I'm sorry, I think there was a miscommunication. We were saying that we don't typically want off-by-default diagnostics at all, not asking to turn this one off by default. We've found that when a diagnostic is off by default, it very rarely gets enabled by enough projects to be worth having the diagnostic. So we instead expect diagnostics to have a very low false positive rate so that they can be on by default without worrying that a lot of users will have to disable it due to chattiness.

So instead of making this diagnostic be DefaultIgnore, I think you should back out most of the recent changes so we're back to only the small number of additional diagnostics in the earlier patches.

Apr 26 2023, 1:30 PM · Restricted Project, Restricted Project, Restricted Project, Restricted Project
chaitanyav updated the diff for D147844: [clang][Sema]Print diagnostic warning about precedence when integer expression is used without parentheses in an conditional operator expression.

Disable precedence conditional warning by default; Revert changes to test files

Apr 26 2023, 12:30 PM · Restricted Project, Restricted Project, Restricted Project, Restricted Project
chaitanyav added a comment to D147844: [clang][Sema]Print diagnostic warning about precedence when integer expression is used without parentheses in an conditional operator expression.

@aaron.ballman just for learning, can you point me to the code where a warning is selectively enabled/disabled based on a flag. For e.g. -Wunused-comparison

Apr 26 2023, 10:07 AM · Restricted Project, Restricted Project, Restricted Project, Restricted Project

Apr 25 2023

chaitanyav updated the diff for D147844: [clang][Sema]Print diagnostic warning about precedence when integer expression is used without parentheses in an conditional operator expression.

Fix more failing tests due to missing parentheses in conditional operator expression

Apr 25 2023, 11:26 PM · Restricted Project, Restricted Project, Restricted Project, Restricted Project
chaitanyav added a comment to D147844: [clang][Sema]Print diagnostic warning about precedence when integer expression is used without parentheses in an conditional operator expression.

Added parentheses to lots of files to fix the precedence warning. Still a lot to change in OpenMP.

Apr 25 2023, 9:31 PM · Restricted Project, Restricted Project, Restricted Project, Restricted Project
chaitanyav updated the diff for D147844: [clang][Sema]Print diagnostic warning about precedence when integer expression is used without parentheses in an conditional operator expression.

Fix tests/code by adding parentheses around the conditional operator expression

Apr 25 2023, 9:29 PM · Restricted Project, Restricted Project, Restricted Project, Restricted Project
chaitanyav added a comment to D147844: [clang][Sema]Print diagnostic warning about precedence when integer expression is used without parentheses in an conditional operator expression.

I think this is a good diagnostic to add: it improves readability and eliminates ambiguities. My only request is that if there isn't already a FixIt hint, one be added, please.

@cjb quick question, should we restrict to

Apr 25 2023, 5:29 PM · Restricted Project, Restricted Project, Restricted Project, Restricted Project

Apr 22 2023

chaitanyav updated the summary of D147844: [clang][Sema]Print diagnostic warning about precedence when integer expression is used without parentheses in an conditional operator expression.
Apr 22 2023, 8:46 AM · Restricted Project, Restricted Project, Restricted Project, Restricted Project

Apr 21 2023

chaitanyav retitled D147844: [clang][Sema]Print diagnostic warning about precedence when integer expression is used without parentheses in an conditional operator expression from [clang][Sema]Print diagnostic warning when implicit cast from int to bool happens in an conditional operator expression to [clang][Sema]Print diagnostic warning about precedence when integer expression is used without parentheses in an conditional operator expression.
Apr 21 2023, 7:39 PM · Restricted Project, Restricted Project, Restricted Project, Restricted Project
chaitanyav updated the diff for D147844: [clang][Sema]Print diagnostic warning about precedence when integer expression is used without parentheses in an conditional operator expression.

Revise commit message

Apr 21 2023, 7:38 PM · Restricted Project, Restricted Project, Restricted Project, Restricted Project
chaitanyav retitled D147844: [clang][Sema]Print diagnostic warning about precedence when integer expression is used without parentheses in an conditional operator expression from Emit warning when implicit cast from int to bool happens in an conditional operator expression to [clang][Sema]Print diagnostic warning when implicit cast from int to bool happens in an conditional operator expression.
Apr 21 2023, 6:40 PM · Restricted Project, Restricted Project, Restricted Project, Restricted Project
chaitanyav updated the diff for D147844: [clang][Sema]Print diagnostic warning about precedence when integer expression is used without parentheses in an conditional operator expression.

Modify the commit message

Apr 21 2023, 6:40 PM · Restricted Project, Restricted Project, Restricted Project, Restricted Project
chaitanyav updated the summary of D147844: [clang][Sema]Print diagnostic warning about precedence when integer expression is used without parentheses in an conditional operator expression.
Apr 21 2023, 1:31 PM · Restricted Project, Restricted Project, Restricted Project, Restricted Project
chaitanyav updated the diff for D147844: [clang][Sema]Print diagnostic warning about precedence when integer expression is used without parentheses in an conditional operator expression.

Fix indentation

Apr 21 2023, 5:14 AM · Restricted Project, Restricted Project, Restricted Project, Restricted Project
chaitanyav added a comment to D147844: [clang][Sema]Print diagnostic warning about precedence when integer expression is used without parentheses in an conditional operator expression.

@aaron.ballman please take a look.

Apr 21 2023, 1:12 AM · Restricted Project, Restricted Project, Restricted Project, Restricted Project

Apr 20 2023

chaitanyav updated the diff for D147844: [clang][Sema]Print diagnostic warning about precedence when integer expression is used without parentheses in an conditional operator expression.

Place parentheses around conditional expression to prevent precedence warnings since -Werror is enabled on build

Apr 20 2023, 10:25 PM · Restricted Project, Restricted Project, Restricted Project, Restricted Project
chaitanyav updated the diff for D147844: [clang][Sema]Print diagnostic warning about precedence when integer expression is used without parentheses in an conditional operator expression.

clang-format the changes to the file

Apr 20 2023, 3:38 PM · Restricted Project, Restricted Project, Restricted Project, Restricted Project
chaitanyav updated the diff for D147844: [clang][Sema]Print diagnostic warning about precedence when integer expression is used without parentheses in an conditional operator expression.

Place parentheses around conditional expression to prevent precedence warnings since -Werror is enabled on build

Apr 20 2023, 2:41 PM · Restricted Project, Restricted Project, Restricted Project, Restricted Project
chaitanyav retitled D147844: [clang][Sema]Print diagnostic warning about precedence when integer expression is used without parentheses in an conditional operator expression from Emit warning when implicit cast to bool happens in an conditional operator expression when used inside an overloaded shift operator expression to Emit warning when implicit cast from int to bool happens in an conditional operator expression.
Apr 20 2023, 1:02 PM · Restricted Project, Restricted Project, Restricted Project, Restricted Project
chaitanyav updated the diff for D147844: [clang][Sema]Print diagnostic warning about precedence when integer expression is used without parentheses in an conditional operator expression.

Place parentheses around & expression since -Werror is enabled for build

Apr 20 2023, 12:57 PM · Restricted Project, Restricted Project, Restricted Project, Restricted Project
chaitanyav updated the diff for D147844: [clang][Sema]Print diagnostic warning about precedence when integer expression is used without parentheses in an conditional operator expression.

Update test to use parentheses around conditional operator

Apr 20 2023, 10:54 AM · Restricted Project, Restricted Project, Restricted Project, Restricted Project
chaitanyav updated the diff for D147844: [clang][Sema]Print diagnostic warning about precedence when integer expression is used without parentheses in an conditional operator expression.

Update SemaCXX tests to use parentheses around conditional operator

Apr 20 2023, 9:50 AM · Restricted Project, Restricted Project, Restricted Project, Restricted Project

Apr 19 2023

chaitanyav added a comment to D147844: [clang][Sema]Print diagnostic warning about precedence when integer expression is used without parentheses in an conditional operator expression.

@aaron.ballman I have made more changes so that the warning is emitted on other integer expressions where the opertors has higher precedence than conditional operator.

Apr 19 2023, 4:41 PM · Restricted Project, Restricted Project, Restricted Project, Restricted Project
chaitanyav updated the diff for D147844: [clang][Sema]Print diagnostic warning about precedence when integer expression is used without parentheses in an conditional operator expression.

Emit warning when implicit cast from int to bool in an conditional operator expression

Apr 19 2023, 4:34 PM · Restricted Project, Restricted Project, Restricted Project, Restricted Project
chaitanyav added a comment to D147844: [clang][Sema]Print diagnostic warning about precedence when integer expression is used without parentheses in an conditional operator expression.

@aaron.ballman am looking into this. If i change it back to
operation int();
and add
Stream& operator<<(bool)
i get
`
error: 'warning' diagnostics expected but not seen:

File /usr/home/nvellanki/explore/llvm-project/clang/test/Sema/parentheses.cpp Line 68: operator '?:' has lower precedence than '<<'

error: 'note' diagnostics expected but not seen:

File /usr/home/nvellanki/explore/llvm-project/clang/test/Sema/parentheses.cpp Line 68: place parentheses around the '<<' expression to silence this warning
File /usr/home/nvellanki/explore/llvm-project/clang/test/Sema/parentheses.cpp Line 68: place parentheses around the '?:' expression to evaluate it first

3 errors generated.
`
But it works correctly with std::cout

`
test.cpp:7:30: warning: operator '?:' has lower precedence than '<<'; '<<' will be evaluated first [-Wparentheses]

std::cout << "Test" << a ? 1 : 0;
~~~~~~~~~~~~~~~~~~~~~~~~ ^

test.cpp:7:30: note: place parentheses around the '<<' expression to silence this warning

std::cout << "Test" << a ? 1 : 0;
                         ^
(                       )

test.cpp:7:30: note: place parentheses around the '?:' expression to evaluate it first

std::cout << "Test" << a ? 1 : 0;
                         ^
                       (        )

I would expect to get the same diagnostic with either operator int() or operator bool() as the precedence is the same either way. I think what might be happening here is that ExprLooksBoolean is getting tricked into thinking the expression isn't boolean when it actually is (I think this might be the FIXME comment in that function needing to be addressed).

Apr 19 2023, 1:28 PM · Restricted Project, Restricted Project, Restricted Project, Restricted Project

Apr 18 2023

chaitanyav added a comment to D147844: [clang][Sema]Print diagnostic warning about precedence when integer expression is used without parentheses in an conditional operator expression.

@aaron.ballman am looking into this. If i change it back to
operation int();
and add
Stream& operator<<(bool)
i get
`
error: 'warning' diagnostics expected but not seen:

File /usr/home/nvellanki/explore/llvm-project/clang/test/Sema/parentheses.cpp Line 68: operator '?:' has lower precedence than '<<'

error: 'note' diagnostics expected but not seen:

File /usr/home/nvellanki/explore/llvm-project/clang/test/Sema/parentheses.cpp Line 68: place parentheses around the '<<' expression to silence this warning
File /usr/home/nvellanki/explore/llvm-project/clang/test/Sema/parentheses.cpp Line 68: place parentheses around the '?:' expression to evaluate it first

3 errors generated.
`
But it works correctly with std::cout

Apr 18 2023, 12:45 PM · Restricted Project, Restricted Project, Restricted Project, Restricted Project
chaitanyav updated the diff for D147844: [clang][Sema]Print diagnostic warning about precedence when integer expression is used without parentheses in an conditional operator expression.

Update release notes about the fix

Apr 18 2023, 11:30 AM · Restricted Project, Restricted Project, Restricted Project, Restricted Project

Apr 17 2023

chaitanyav reclaimed D147844: [clang][Sema]Print diagnostic warning about precedence when integer expression is used without parentheses in an conditional operator expression.

re-opening the revision to make further updates as per comments on the github issue.

Apr 17 2023, 7:18 AM · Restricted Project, Restricted Project, Restricted Project, Restricted Project

Apr 14 2023

chaitanyav abandoned D147844: [clang][Sema]Print diagnostic warning about precedence when integer expression is used without parentheses in an conditional operator expression.
Apr 14 2023, 2:25 PM · Restricted Project, Restricted Project, Restricted Project, Restricted Project

Apr 10 2023

chaitanyav added a comment to D147844: [clang][Sema]Print diagnostic warning about precedence when integer expression is used without parentheses in an conditional operator expression.

@aaron.ballman Please review this.

Apr 10 2023, 8:48 PM · Restricted Project, Restricted Project, Restricted Project, Restricted Project

Apr 8 2023

chaitanyav added a comment to D147844: [clang][Sema]Print diagnostic warning about precedence when integer expression is used without parentheses in an conditional operator expression.

output for testcases mentioned in https://github.com/llvm/llvm-project/issues/61943

test.cpp:6:30: warning: overloaded operator << has higher precedence than comparison operator [-Woverloaded-shift-op-parentheses]
    std::cout << "Test" << a == 5 ? 1 : 0;
    ~~~~~~~~~~~~~~~~~~~~~~~~ ^  ~
test.cpp:6:25: note: place parentheses around the '<<' expression to silence this warning
    std::cout << "Test" << a == 5 ? 1 : 0;
                        ^
    (                       )
test.cpp:6:30: note: place parentheses around comparison expression to evaluate it first
    std::cout << "Test" << a == 5 ? 1 : 0;
                             ^
                           (     )
test.cpp:6:30: error: invalid operands to binary expression ('ostream' and 'int')
    std::cout << "Test" << a == 5 ? 1 : 0;
    ~~~~~~~~~~~~~~~~~~~~~~~~ ^  ~
test.cpp:7:30: warning: operator '?:' has lower precedence than '<<'; '<<' will be evaluated first [-Wparentheses]
    std::cout << "Test" << a ? 1 : 0;
    ~~~~~~~~~~~~~~~~~~~~~~~~ ^
test.cpp:7:30: note: place parentheses around the '<<' expression to silence this warning
    std::cout << "Test" << a ? 1 : 0;
                             ^
    (                       )
test.cpp:7:30: note: place parentheses around the '?:' expression to evaluate it first
    std::cout << "Test" << a ? 1 : 0;
                             ^
                           (        )
test.cpp:8:49: warning: operator '?:' has lower precedence than '<<'; '<<' will be evaluated first [-Wparentheses]
    std::cout << "Test" << static_cast<bool>(a) ? 1 : 0;
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
test.cpp:8:49: note: place parentheses around the '<<' expression to silence this warning
    std::cout << "Test" << static_cast<bool>(a) ? 1 : 0;
                                                ^
    (                                          )
test.cpp:8:49: note: place parentheses around the '?:' expression to evaluate it first
    std::cout << "Test" << static_cast<bool>(a) ? 1 : 0;
                                                ^
Apr 8 2023, 1:57 AM · Restricted Project, Restricted Project, Restricted Project, Restricted Project
chaitanyav added a reviewer for D147844: [clang][Sema]Print diagnostic warning about precedence when integer expression is used without parentheses in an conditional operator expression: aaron.ballman.
Apr 8 2023, 1:51 AM · Restricted Project, Restricted Project, Restricted Project, Restricted Project
chaitanyav requested review of D147844: [clang][Sema]Print diagnostic warning about precedence when integer expression is used without parentheses in an conditional operator expression.
Apr 8 2023, 1:50 AM · Restricted Project, Restricted Project, Restricted Project, Restricted Project

Mar 30 2023

chaitanyav committed rGa590d8634308: [clang][ExtractAPI] Remove extra pointer indirection from declaration fragments… (authored by chaitanyav).
[clang][ExtractAPI] Remove extra pointer indirection from declaration fragments…
Mar 30 2023, 11:37 AM · Restricted Project, Restricted Project
chaitanyav closed D146866: [clang][ExtractAPI] Remove extra pointer indirection from declaration fragments for Obj-C lightweight generics on id.
Mar 30 2023, 11:36 AM · Restricted Project, Restricted Project

Mar 29 2023

chaitanyav added a comment to D146866: [clang][ExtractAPI] Remove extra pointer indirection from declaration fragments for Obj-C lightweight generics on id.

@dang Please review.

Mar 29 2023, 1:43 PM · Restricted Project, Restricted Project
chaitanyav updated the diff for D146866: [clang][ExtractAPI] Remove extra pointer indirection from declaration fragments for Obj-C lightweight generics on id.

Add comment to indicate that id<protocol>* is not an qualified id type

Mar 29 2023, 11:26 AM · Restricted Project, Restricted Project

Mar 27 2023

chaitanyav added a comment to D146866: [clang][ExtractAPI] Remove extra pointer indirection from declaration fragments for Obj-C lightweight generics on id.

looks like its waiting on libcxx build(https://buildkite.com/llvm-project/premerge-checks/builds/143382#job-01872209-2788-44ef-930c-11e741ff906e) and it is actively being debugged as per comments on other differential.

Mar 27 2023, 2:09 PM · Restricted Project, Restricted Project
chaitanyav added a comment to D146866: [clang][ExtractAPI] Remove extra pointer indirection from declaration fragments for Obj-C lightweight generics on id.

@dang @ributzka Please review.

Mar 27 2023, 12:43 AM · Restricted Project, Restricted Project

Mar 25 2023

chaitanyav requested review of D146866: [clang][ExtractAPI] Remove extra pointer indirection from declaration fragments for Obj-C lightweight generics on id.
Mar 25 2023, 12:12 AM · Restricted Project, Restricted Project

Mar 23 2023

chaitanyav committed rGc13ccf1fbabe: [clang][ExtractAPI]Fix Declaration fragments for instancetype in the type… (authored by chaitanyav).
[clang][ExtractAPI]Fix Declaration fragments for instancetype in the type…
Mar 23 2023, 3:11 PM · Restricted Project, Restricted Project
chaitanyav closed D146671: [clang][ExtractAPI]Fix Declaration fragments for instancetype in the type position degrade to id.
Mar 23 2023, 3:11 PM · Restricted Project, Restricted Project
chaitanyav committed rG1c9173365a93: Fix highlighting issue with _complex and initialization list with more than 2… (authored by chaitanyav).
Fix highlighting issue with _complex and initialization list with more than 2…
Mar 23 2023, 2:23 PM · Restricted Project, Restricted Project
chaitanyav closed D146503: Fix highlighting issue with _complex and initialization list with more than 2 items.
Mar 23 2023, 2:22 PM · Restricted Project, Restricted Project
chaitanyav added a comment to D146503: Fix highlighting issue with _complex and initialization list with more than 2 items.

Thank you, I will commit myself. Should i wait for the build to finish?. this will be my first direct commit to repo.

Mar 23 2023, 12:48 PM · Restricted Project, Restricted Project
chaitanyav updated the diff for D146503: Fix highlighting issue with _complex and initialization list with more than 2 items.

one diagnostic per line when there are multiple diagnostics expected

Mar 23 2023, 8:27 AM · Restricted Project, Restricted Project
chaitanyav added a comment to D146671: [clang][ExtractAPI]Fix Declaration fragments for instancetype in the type position degrade to id.

@dang Please review the test/output.

Mar 23 2023, 8:10 AM · Restricted Project, Restricted Project
chaitanyav updated the diff for D146671: [clang][ExtractAPI]Fix Declaration fragments for instancetype in the type position degrade to id.

update test to check for id type

Mar 23 2023, 6:41 AM · Restricted Project, Restricted Project
chaitanyav added a comment to D146671: [clang][ExtractAPI]Fix Declaration fragments for instancetype in the type position degrade to id.

Will update the test to also include a Id instance method.

Mar 23 2023, 5:24 AM · Restricted Project, Restricted Project

Mar 22 2023

chaitanyav added a comment to D146503: Fix highlighting issue with _complex and initialization list with more than 2 items.

I reported the flang failures https://github.com/llvm/llvm-project/issues/61634 and it was reverted. How can i trigger a new build with TOT?

Mar 22 2023, 9:09 PM · Restricted Project, Restricted Project
chaitanyav retitled D146671: [clang][ExtractAPI]Fix Declaration fragments for instancetype in the type position degrade to id from Fix Declaration fragments for instancetype in the type position degrade to id to [clang][ExtractAPI]Fix Declaration fragments for instancetype in the type position degrade to id.
Mar 22 2023, 4:57 PM · Restricted Project, Restricted Project
chaitanyav requested review of D146671: [clang][ExtractAPI]Fix Declaration fragments for instancetype in the type position degrade to id.
Mar 22 2023, 4:41 PM · Restricted Project, Restricted Project
chaitanyav added a comment to D146503: Fix highlighting issue with _complex and initialization list with more than 2 items.

@aaron.ballman Please review.

Mar 22 2023, 3:17 PM · Restricted Project, Restricted Project
chaitanyav updated the diff for D146503: Fix highlighting issue with _complex and initialization list with more than 2 items.

Added tests to check for the right diagnostic messages and highlighting at correct place
Update the release docs about the fix

Mar 22 2023, 12:54 PM · Restricted Project, Restricted Project

Mar 21 2023

chaitanyav added a comment to D146503: Fix highlighting issue with _complex and initialization list with more than 2 items.

Please review this.

Mar 21 2023, 10:07 PM · Restricted Project, Restricted Project
chaitanyav added a comment to D146503: Fix highlighting issue with _complex and initialization list with more than 2 items.

test outputs for C, C++

Mar 21 2023, 12:48 PM · Restricted Project, Restricted Project
chaitanyav updated the diff for D146503: Fix highlighting issue with _complex and initialization list with more than 2 items.

Only proceed with scalar initialization if number of elements is less than 2

Mar 21 2023, 12:46 PM · Restricted Project, Restricted Project
chaitanyav added a comment to D146503: Fix highlighting issue with _complex and initialization list with more than 2 items.

It will fall through to scalar type to do field wise initialization

Mar 21 2023, 9:24 AM · Restricted Project, Restricted Project
chaitanyav added a comment to D146503: Fix highlighting issue with _complex and initialization list with more than 2 items.
test.cpp:2:34: error: excess elements in scalar initializer
_Complex double dd = {1.0, 2.0 , 3.0};
                                 ^~~
test.cpp:3:32: error: excess elements in scalar initializer
_Complex float fd = {1.0, 2.0, 3.0, 4.0, 5.0};
                               ^~~
test.cpp:4:42: error: excess elements in scalar initializer
constexpr _Complex double d = {1.0, 2.0, 3.0, 45};
                                         ^~~
test.cpp:11:23: error: no viable conversion from 'foo' to '_Complex double'
_Complex double ds = {f, 1.0, b};
                      ^
test.cpp:13:28: error: no viable conversion from 'foo' to 'double'
_Complex double fg = {1.0, f};
                           ^
test.cpp:15:33: error: excess elements in scalar initializer
_Complex double gg = {1.0, 2.0, f};
                                ^
6 errors generated.
Mar 21 2023, 1:21 AM · Restricted Project, Restricted Project
chaitanyav requested review of D146503: Fix highlighting issue with _complex and initialization list with more than 2 items.
Mar 21 2023, 1:18 AM · Restricted Project, Restricted Project

Mar 20 2023

chaitanyav added a comment to D146354: [clang][ExtractAPI] Add semicolons for enum, typedef, struct declaration fragments.

Name: NagaChaitanya Vellanki
email: pnagato@protonmail.com

Mar 20 2023, 8:28 AM · Restricted Project, Restricted Project
chaitanyav added a comment to D146354: [clang][ExtractAPI] Add semicolons for enum, typedef, struct declaration fragments.

Thank you, Please go ahead and Commit the change. I don't have commit access, Will follow the instructions on the page to get access.

Mar 20 2023, 8:26 AM · Restricted Project, Restricted Project

Mar 19 2023

chaitanyav added a comment to D146354: [clang][ExtractAPI] Add semicolons for enum, typedef, struct declaration fragments.

The debian build is failing because of this https://github.com/google/llvm-premerge-checks/issues/436

Mar 19 2023, 9:29 PM · Restricted Project, Restricted Project

Mar 18 2023

chaitanyav updated the diff for D146354: [clang][ExtractAPI] Add semicolons for enum, typedef, struct declaration fragments.
  • Update reference output in underscored.c
  • combine return and append semicolon fragment
Mar 18 2023, 11:13 AM · Restricted Project, Restricted Project
chaitanyav updated the diff for D146354: [clang][ExtractAPI] Add semicolons for enum, typedef, struct declaration fragments.
  • Update reference output in underscored.c
  • combine return and append semicolon fragment
Mar 18 2023, 11:09 AM · Restricted Project, Restricted Project
chaitanyav abandoned D146363: Update reference output in underscored.c.
Mar 18 2023, 10:58 AM · Restricted Project, Restricted Project
chaitanyav requested review of D146363: Update reference output in underscored.c.
Mar 18 2023, 10:51 AM · Restricted Project, Restricted Project