Skip to content

Merge from 3C #930

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1,403 commits into from
Dec 4, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
1403 commits
Select commit Hold shift + click to select a range
422414a
Merge pull request #248 from plum-umd/235OutputChanges
mwhicks1 Aug 31, 2020
fdf861b
Bogus warning suppressed
mwhicks1 Sep 1, 2020
7b06e10
Merge branch 'BigRefactor' of github.com:plum-umd/checkedc-clang into…
mwhicks1 Sep 1, 2020
cdaedb5
Fix to work on Mac
mwhicks1 Sep 1, 2020
d70ff84
Update generated tests for whitespace changes
john-h-kastner Sep 1, 2020
47dd9c9
Fix #204
john-h-kastner Aug 19, 2020
671e01b
Fix #205
john-h-kastner Aug 20, 2020
7076c05
Handle defines used as basetypes of checked pointers
john-h-kastner Sep 1, 2020
dd05d3b
Remove text file
john-h-kastner Sep 2, 2020
31ac0c0
syncing with master
sroy4899 Sep 4, 2020
a69114b
Merge pull request #254 from plum-umd/ImproveMacroConversion
mwhicks1 Sep 4, 2020
636f57f
Merge branch 'BigRefactor' of https://github.com/plum-umd/checkedc-cl…
sroy4899 Sep 4, 2020
7571045
Merge pull request #256 from plum-umd/master_test_sync
mwhicks1 Sep 4, 2020
9be15f8
Finishing merge
Machiry Sep 7, 2020
7a47739
Merge pull request #226 from plum-umd/bytecount_reduction
Machiry Sep 7, 2020
822cf1d
Refactoring GatherTool.cpp
Machiry Sep 8, 2020
ffc9b90
Initial logging of root cause diagnostics
john-h-kastner Sep 4, 2020
5585c1e
Add some comments to PVConstraint constructor
john-h-kastner Sep 8, 2020
bb58665
Nicer root cause reported for invalid cast
john-h-kastner Sep 8, 2020
3bd93ad
Correctly differentiate void* and vararg root causes
john-h-kastner Sep 8, 2020
34882b2
Undo modification to PersistentSourceLocation
john-h-kastner Sep 8, 2020
9d22cdc
Remove commented lines
john-h-kastner Sep 8, 2020
33bf75c
Comment tweaks
john-h-kastner Sep 8, 2020
4422d00
Fixing issue 239
Machiry Sep 9, 2020
e3b6fc6
Fix
Sep 9, 2020
4b4602e
Testing repeated runs
Sep 9, 2020
1ce7520
Merge pull request #258 from plum-umd/RootCauseDiag
jackastner Sep 9, 2020
bda375b
Merge pull request #257 from plum-umd/RefactorGatherTool
Machiry Sep 9, 2020
0b058be
Fix regression in lua and ptr_dist
john-h-kastner Sep 9, 2020
c81f1fd
Actually fix lua this time
john-h-kastner Sep 10, 2020
6d37bfe
Merge pull request #260 from plum-umd/issue_239
Machiry Sep 11, 2020
2c6af8f
Initial fix for #255
john-h-kastner Sep 14, 2020
2ab4b23
Add more const qualifiers
john-h-kastner Sep 14, 2020
a6e90db
Move PersistentConstraint methods into ProgramInfo
john-h-kastner Sep 14, 2020
e68792d
Store persistent expression constraints in new map
john-h-kastner Sep 14, 2020
b6bb11f
Variables map now associates declaration with a single constraint
john-h-kastner Sep 15, 2020
52b4693
Return option type for getVariable instead of nullptr
john-h-kastner Sep 15, 2020
87f507d
Remove commented out code that is now truly dead
john-h-kastner Sep 15, 2020
2fcf4d1
Context sensitive array bounds
Machiry Sep 15, 2020
a858a9f
Fix RUN commands in test
john-h-kastner Sep 15, 2020
566640c
Handle edge cases for PSL collision
john-h-kastner Sep 16, 2020
12d816e
Code cleanup and tweaks
john-h-kastner Sep 16, 2020
dad9613
Update comment in PersistentSourceLocation
john-h-kastner Sep 16, 2020
500cfcc
Add a test case for parameter declarations in macro
john-h-kastner Sep 16, 2020
93610ed
Warnings
Sep 16, 2020
5993971
Merge pull request #261 from plum-umd/iss229
mwhicks1 Sep 16, 2020
c975671
Another test case for WILDness of macros
john-h-kastner Sep 16, 2020
654538e
Merge branch 'BigRefactor' into CheckedRegionsWarnings
Sep 16, 2020
598504b
Use my own option type for nicer behavior with abstract base class
john-h-kastner Sep 16, 2020
e0cd5a8
Addressing comments
Machiry Sep 17, 2020
b050262
Adding refs
Machiry Sep 17, 2020
40f2b52
Move BaseType code into a static method
john-h-kastner Sep 17, 2020
107e85d
Merge branch 'BigRefactor' into 255FixMacros
john-h-kastner Sep 17, 2020
564d7a9
Merge pull request #266 from plum-umd/255FixMacros
jackastner Sep 17, 2020
71a1722
Merge branch 'BigRefactor' into iss252
Machiry Sep 17, 2020
49811b0
Split single declaration and multi-decl rewriting into separate methods
john-h-kastner Sep 17, 2020
3c571f4
Merge remote-tracking branch 'upstream/master'
Machiry Sep 18, 2020
d37a4cf
Initial implementation of new mutli-var-decl rewriting
john-h-kastner Sep 18, 2020
e0adb84
Add tests for multi-declarations
john-h-kastner Sep 18, 2020
45b59fd
Update main.yml
Machiry Sep 19, 2020
eea4eaf
Fixing running unit tests (They never ran)
Machiry Sep 19, 2020
4c4eed3
Merge branch 'master' into BigRefactor
Machiry Sep 20, 2020
450d05b
Merge branch 'BigRefactor'
Machiry Sep 20, 2020
d1c726a
Update main.yml
Machiry Sep 21, 2020
b1ed301
Update main.yml
Machiry Sep 21, 2020
1036b6e
Merge pull request #265 from plum-umd/iss252
Machiry Sep 21, 2020
ecd0d9b
Use doDeclRewrite for single declaration rewriting
john-h-kastner Sep 21, 2020
74b81cd
Cleanup unneeded templating
john-h-kastner Sep 21, 2020
081eb19
Comments
john-h-kastner Sep 21, 2020
3b76287
Insert initializer for arrays of pointers
john-h-kastner Sep 21, 2020
6ff7e6d
Merge branch 'master' into CheckedRegionsWarnings
Sep 22, 2020
160bf4e
Merge branch 'master' into 267MultiDecls
john-h-kastner Sep 22, 2020
b9c52f7
Update test for array initializer
john-h-kastner Sep 22, 2020
e686d89
Add EOF check in getNextCommaOrSemicolon
john-h-kastner Sep 22, 2020
a49847c
Remove dead method
john-h-kastner Sep 22, 2020
1de9fb9
Don't treat global vars / struct fields on same line as multi-decl
john-h-kastner Sep 22, 2020
8562f92
Comments and naming
john-h-kastner Sep 22, 2020
91f17d3
Fix bug caused by lack of space between consecutive decls
john-h-kastner Sep 22, 2020
f099459
Merge pull request #270 from plum-umd/267MultiDecls
mwhicks1 Sep 23, 2020
49b1ae1
Merge pull request #275 from plum-umd/BigRefactor
Machiry Sep 25, 2020
6b96bdd
Fixing issue https://github.com/plum-umd/checkedc-clang/issues/276
Machiry Sep 25, 2020
a6f21e1
Merge pull request #277 from plum-umd/iss276
mwhicks1 Sep 25, 2020
e78b575
Minor fixes
Sep 25, 2020
e76b5f0
Changed error message
Sep 25, 2020
d9beff0
Merge branch 'master' into CheckedRegionsWarnings
Sep 25, 2020
eca2979
tidying
Sep 25, 2020
a51eb68
Merge pull request #273 from plum-umd/CheckedRegionsWarnings
mwhicks1 Sep 25, 2020
1f7124c
Fixing user-after-free in ProgramVar
Machiry Sep 26, 2020
e48156a
Adding TODOs
Machiry Sep 26, 2020
31e3abe
Merge pull request #278 from correctcomputation/FixingUAF
Machiry Sep 26, 2020
9881904
Changing branch names from BigRefactor to master
Machiry Sep 26, 2020
254b5e0
Updating the links to correct computation org
Machiry Sep 27, 2020
cca1234
Extract duplicated code into a new method
john-h-kastner Sep 29, 2020
863c402
Major refactoring of array bounds code and some performance improvements
Machiry Oct 3, 2020
72f43c2
More 3C changes prior to 5C itype removal
john-h-kastner Oct 5, 2020
dd73a00
Handling comments
Machiry Oct 5, 2020
a3a6fe9
Add infrastructure to handle separate 5C specific code
john-h-kastner Oct 6, 2020
6304ca4
Add flags for 5C features guarded by ifdef
john-h-kastner Oct 6, 2020
ac82f31
Merge remote-tracking branch 'public/master' into ItypeRefactor_3C
john-h-kastner Oct 7, 2020
c5df819
Merge pull request #285 from correctcomputation/ItypeRefactor_3C
jackastner Oct 7, 2020
4073b4a
Changed artifacts retention days
Machiry Oct 8, 2020
472bc27
Adding ctx sensitive keys
Machiry Oct 9, 2020
3e3fa86
Minor refactoring
Machiry Oct 10, 2020
85fd893
Remove directories that contain nothing but old duplicate 3C tests.
mattmccutchen-cci Oct 14, 2020
119788b
Merge pull request #290 from correctcomputation/old-test-dirs
mattmccutchen-cci Oct 14, 2020
f150aec
Avoid generating extra atom on allocator function calls
john-h-kastner Oct 15, 2020
20d8bd5
constrainToWild only needs to constrain outermost pointer
john-h-kastner Oct 12, 2020
c9b999c
Fix bug in multi-declaration rewriting
john-h-kastner Oct 15, 2020
3892e31
Adding stats
Machiry Sep 27, 2020
c3177a6
Include ExprConstraintVars in pointer source location map
john-h-kastner Oct 15, 2020
8158ed0
Add constraints to wild when PtrType solver fails
john-h-kastner Sep 30, 2020
93a4718
Output diagnostics for constraints not mapped to declaration
john-h-kastner Oct 1, 2020
09e2d50
Add source locations to constraints for better root cause reporting
john-h-kastner Oct 1, 2020
ccd41e0
Improve root cause diagnostic for invalid casts
john-h-kastner Oct 5, 2020
8bf1027
Add test file for root cause of wildness
john-h-kastner Oct 5, 2020
61e077b
More root cause tests
john-h-kastner Oct 8, 2020
e1f3df9
Add reason for unsafe allocator calls
john-h-kastner Oct 8, 2020
a314b6b
Add WILD counts to output
john-h-kastner Oct 9, 2020
8862408
Implement per-pointer statistic output
john-h-kastner Oct 12, 2020
65f69ee
Fix to propagate wildness cause between levels of pointers
john-h-kastner Oct 14, 2020
591df24
Cleanup computeIterimConstraintState
john-h-kastner Oct 14, 2020
ca2a449
Avoid using WILD as an atom inside constraint variables
john-h-kastner Oct 14, 2020
6ec85bc
Merge pull request #291 from correctcomputation/MiscRefactorings
jackastner Oct 15, 2020
9d22250
Fix bug when root cause is on parameter of checked function pointer
john-h-kastner Oct 16, 2020
058bd2b
Comments; renaming.
mwhicks1 Oct 18, 2020
7c7e104
Update warning message
john-h-kastner Oct 19, 2020
329a5a0
Remove unused conflicts set in returns/params
john-h-kastner Oct 19, 2020
3c3098c
Remove some duplicated code pertaining to root cause source locations
john-h-kastner Oct 19, 2020
9001be0
Add method for obtaining constrained VarAtom
john-h-kastner Oct 19, 2020
64d1187
Avoid allocating empty sets in ImpMap
john-h-kastner Oct 19, 2020
5ec2335
Fix root cause reporting when cause is on function pointer parameter
john-h-kastner Oct 19, 2020
bbf87f4
Add comments
john-h-kastner Oct 20, 2020
dc385c2
Rename method to getFreshGEQ
john-h-kastner Oct 22, 2020
d685ab5
Merge remote-tracking branch 'public/master' into RootCauseImprovements
john-h-kastner Oct 22, 2020
0f8d6dc
Merge pull request #292 from correctcomputation/RootCauseImprovements
jackastner Oct 22, 2020
b80ba17
Fix for issue #293
john-h-kastner Oct 22, 2020
11d8db1
Add tests for converting paritaly checked pointers
john-h-kastner Oct 22, 2020
2e577b2
Test for partially checked function pointer
john-h-kastner Oct 22, 2020
56fd248
Merge remote-tracking branch 'public/master' into 293ConvertPartial
john-h-kastner Oct 26, 2020
5d4d5ea
Added comments
Machiry Oct 27, 2020
c554433
Merge pull request #282 from correctcomputation/iss281
Machiry Oct 27, 2020
653c567
Merge remote-tracking branch 'public/master' into 293ConvertPartial
john-h-kastner Oct 27, 2020
c531cb1
FunctionVariableConstraint return and param vars changed to PVConstra…
john-h-kastner Oct 27, 2020
8139e9d
Handle partialy checked extern functions
john-h-kastner Oct 27, 2020
2f74c07
Add tests for partialy checked array pointers
john-h-kastner Oct 27, 2020
e4be53a
Revert "Merge pull request #282 from correctcomputation/iss281"
Machiry Oct 28, 2020
04ccde0
Merge pull request #304 from correctcomputation/293ConvertPartial
jackastner Oct 28, 2020
4097655
Fixing array legth inference performance issue
Machiry Oct 29, 2020
8cce9d9
Merge branch 'master' into arrbndsdebug
Machiry Oct 29, 2020
f86da78
Merge pull request #309 from correctcomputation/arrbndsdebug
Machiry Oct 29, 2020
1f25d74
Revert "Fixing array length inference performance issue"
Machiry Oct 29, 2020
72ab4b0
Merge pull request #310 from correctcomputation/revert-309-arrbndsdebug
Machiry Oct 29, 2020
713c272
Merge pull request #282 from correctcomputation/iss281
Machiry Oct 27, 2020
08b9470
Fixing array legth inference performance issue
Machiry Oct 29, 2020
ac2d7db
Temporarily add the rename scripts for archival.
mattmccutchen-cci Oct 29, 2020
eada450
Fix typos and inconsistencies in old names to let automated replacements
mattmccutchen-cci Oct 28, 2020
63f36ab
git mv 'clang/docs/checkedc/CheckedCConvert.md' 'clang/docs/checkedc/…
mattmccutchen-cci Oct 29, 2020
5708869
git mv 'clang/tools/cconv-standalone' 'clang/tools/3c'
mattmccutchen-cci Oct 29, 2020
a6f98b7
git mv 'clang/tools/3c/utils/cc_conv' 'clang/tools/3c/utils/port_tools'
mattmccutchen-cci Oct 29, 2020
7d9915c
git mv 'clang/include/clang/CConv/CCGlobalOptions.h' 'clang/include/c…
mattmccutchen-cci Oct 29, 2020
0e4ebd4
git mv 'clang/test/CheckedCRewriter' 'clang/test/3C'
mattmccutchen-cci Oct 29, 2020
926791b
repl_basename_pfx 'CConvert' '3C' '^clang'
mattmccutchen-cci Oct 29, 2020
9d63f94
repl_basename_pfx 'CConv' '3C' '^clang'
mattmccutchen-cci Oct 29, 2020
4aeb4dd
repl '\<cconv-standalone\>' '3c'
mattmccutchen-cci Oct 29, 2020
787d23f
repl '\<clang/tools/3c/utils/cc_conv\>' 'clang/tools/3c/utils/port_to…
mattmccutchen-cci Oct 29, 2020
c02c9eb
repl '\<CCGlobalOptions\>' '3CGlobalOptions'
mattmccutchen-cci Oct 29, 2020
7cecb41
repl '\<CheckedCRewriter\>' '3C'
mattmccutchen-cci Oct 29, 2020
d80797e
repl '\<CConv(ert)?' '3C' '/CMakeLists\.txt$'
mattmccutchen-cci Oct 29, 2020
0e5b455
repl '#include "clang/CConv/' '#include "clang/3C/' '\.(h|cpp)$'
mattmccutchen-cci Oct 29, 2020
72a1ae8
repl '(#include.*["/])CConv(ert)?' '\13C' '\.(h|cpp)$'
mattmccutchen-cci Oct 29, 2020
a27704f
repl '//=--CConvert([^-]*-)' '//=--3C\1------'
mattmccutchen-cci Oct 29, 2020
70c18c3
repl '//=--CConv([^-]*-)' '//=--3C\1---'
mattmccutchen-cci Oct 29, 2020
7a4be4c
repl '\<LLVM_CLANG_TOOLS_EXTRA_CLANGD_CCONVERT' 'LLVM_CLANG_TOOLS_EXT…
mattmccutchen-cci Oct 29, 2020
2f3379b
repl '\<_CCGLOBALOPTIONS_H\>' '_3CGLOBALOPTIONS_H' '\.(h|cpp)$'
mattmccutchen-cci Oct 29, 2020
5d9a17c
repl '\<_CCONV([A-Z]*)_H\>' '_3C\1_H' '\.(h|cpp)$'
mattmccutchen-cci Oct 29, 2020
ce510c4
repl '\<cconv(build|scripts)\>' '3c-\1' '^\.github/workflows/main\.yml$'
mattmccutchen-cci Oct 29, 2020
6e04948
repl '\<CCInterface\>' '_3CInterface' '\.(h|cpp)$'
mattmccutchen-cci Oct 29, 2020
e3d89cd
repl '\<cconv(CollectAndBuildInitialConstraints|CloseDocument)\>' '_3…
mattmccutchen-cci Oct 29, 2020
a2e6ec8
repl '\<CConv(Interface|Inter|Main|Sec|DiagInfo|LSPCallBack)\>' '_3C\…
mattmccutchen-cci Oct 29, 2020
c1b3d84
repl '\<CCONVSOURCE\>' '_3CSOURCE' '\.(h|cpp)$'
mattmccutchen-cci Oct 29, 2020
606d4a4
repl '\<(Command|ExecuteCommandParams)::CCONV_' '\1::_3C_' '\.(h|cpp)$'
mattmccutchen-cci Oct 29, 2020
9f4e49e
repl '\<CCONV_' '_3C_' '^clang-tools-extra/clangd/Protocol\.h$'
mattmccutchen-cci Oct 29, 2020
304fe32
repl '\<ConvertCategory\>' '_3CCategory' '\.(h|cpp)$'
mattmccutchen-cci Oct 29, 2020
bce9fe2
repl '\<CConvert(Options|ManualFix|Diagnostics)\>' '_3C\1' '\.(h|cpp)$'
mattmccutchen-cci Oct 29, 2020
21854be
repl '\<ccConvertManualFix\>' '_3CManualFix' '\.(h|cpp)$'
mattmccutchen-cci Oct 29, 2020
bff652c
repl '\<ccConvResultsReady\>' '_3CResultsReady' '\.(h|cpp)$'
mattmccutchen-cci Oct 29, 2020
780de11
repl '\<CheckedCConverter\>' '_3C'
mattmccutchen-cci Oct 29, 2020
deb6934
repl '\<executeCConvCommand\>' 'execute3CCommand' '\.(h|cpp)$'
mattmccutchen-cci Oct 29, 2020
2cce847
repl '\<sendCConvMessage\>' 'send3CMessage' '\.(h|cpp)$'
mattmccutchen-cci Oct 29, 2020
f0892d0
repl '\<IsCConvCommand\>' 'Is3CCommand' '\.(h|cpp)$'
mattmccutchen-cci Oct 29, 2020
4293f81
repl '\<(clear|report)CConvDiagsForAllFiles\>' '\13CDiagsForAllFiles'…
mattmccutchen-cci Oct 29, 2020
bb657ea
repl '\<INTERACTIVECCCONV\>' 'INTERACTIVE3C'
mattmccutchen-cci Oct 29, 2020
deabf3b
repl '"CConv_(RealWild|AffWild)"' '"3C_\1"' '\.(h|cpp)$'
mattmccutchen-cci Oct 29, 2020
04717b9
repl '"cconv\.(onlyThisPtr|applyAllPtr)"' '"3c.\1"' '\.(h|cpp)$'
mattmccutchen-cci Oct 29, 2020
5d14381
repl '\("CConv(:)? ' '("3C\1 ' '\.(h|cpp)$'
mattmccutchen-cci Oct 29, 2020
f1b1188
repl '\<runCheckedCConvert\>' 'run3C'
mattmccutchen-cci Oct 29, 2020
e4c9289
repl '\<icconv\>' 'clangd3c'
mattmccutchen-cci Oct 29, 2020
51fd8cd
repl '\<checked_c_convert_bin\>' '_3c_bin'
mattmccutchen-cci Oct 29, 2020
ade9152
repl '\<checked-c-convert\>' '3c'
mattmccutchen-cci Oct 29, 2020
400586b
repl 'Checked C rewriter tool' '3C' '^clang/test/3C/'
mattmccutchen-cci Oct 29, 2020
a045e49
repl '\<cconvClangDaemon\>' '3cClangDaemon' '/CMakeLists\.txt$'
mattmccutchen-cci Oct 29, 2020
669e728
repl '\<[Cc]?[Cc][Cc]onv\>' '3C' '(^|/)3[Cc]|^clang-tools-extra/clang…
mattmccutchen-cci Oct 29, 2020
0a9c916
repl 'fcheckedc_convert_tool' 'f3c_tool'
mattmccutchen-cci Oct 29, 2020
20afd2e
repl 'fcheckedc-convert-tool' 'f3c-tool'
mattmccutchen-cci Oct 29, 2020
b59378a
Adding more flags
Machiry Oct 29, 2020
f8a3ce5
Text alignment fixes.
mattmccutchen-cci Oct 27, 2020
1ddc138
Remaining edits that aren't worth automating.
mattmccutchen-cci Oct 27, 2020
b941c8c
Delete the rename scripts again.
mattmccutchen-cci Oct 29, 2020
6a05516
Merge pull request #299 from correctcomputation/3c-rename
mattmccutchen-cci Oct 29, 2020
4e0c5fb
Merging fixed array bounds changes
Machiry Oct 30, 2020
38b371a
Removing CheckedCRewriter added due to merging
Machiry Oct 30, 2020
1aa4f52
Delete the actions file from the correctcomputation/checkedc-clang repo.
mattmccutchen-cci Nov 3, 2020
daad3f5
Merge pull request #318 from correctcomputation/delete-actions
mattmccutchen-cci Nov 3, 2020
c1325e6
Merge remote-tracking branch 'microsoft/master' into merge-from-micro…
mattmccutchen-cci Nov 3, 2020
5df32b3
Merge pull request #313 from correctcomputation/merge-from-microsoft
mattmccutchen-cci Nov 3, 2020
60a777e
Disable clangd3c build target, which is unmaintained and broken.
mattmccutchen-cci Nov 4, 2020
6fbffff
Rename the clang/lib/3C target to clang3C, following convention.
mattmccutchen-cci Nov 4, 2020
7f6bf55
Merge pull request #320 from correctcomputation/disable-clangd3c
mattmccutchen-cci Nov 4, 2020
c75b4ca
Merge pull request #321 from correctcomputation/3c-lib-target
mattmccutchen-cci Nov 4, 2020
899777b
Rename two identifiers missed in #299.
mattmccutchen-cci Nov 4, 2020
5fbe4f5
Merge pull request #322 from correctcomputation/missed-renames
mattmccutchen-cci Nov 4, 2020
d6599b5
update-includes.py: Find the default header location relative to
mattmccutchen-cci Nov 5, 2020
e1a594a
Merge pull request #324 from correctcomputation/update-includes-defau…
mattmccutchen-cci Nov 5, 2020
3e5b1b3
Add new 3C readmes and a link from the root readme.
mattmccutchen-cci Nov 5, 2020
f730a23
Merge pull request #323 from correctcomputation/readme
mattmccutchen-cci Nov 5, 2020
3d11ab1
Fix some typos and unintended non-ASCII characters in the new readmes.
mattmccutchen-cci Nov 5, 2020
31dc462
Delete more tests that are obsolete (according to Aravind).
mattmccutchen-cci Nov 11, 2020
b47c236
Merge pull request #332 from correctcomputation/more-old-tests
mattmccutchen-cci Nov 11, 2020
9ff1c8b
New readmes: Replace two spaces at the end of a sentence with one.
mattmccutchen-cci Nov 9, 2020
5c265bc
Wrap 3C Markdown text to 80 characters as requested by Microsoft.
mattmccutchen-cci Nov 9, 2020
6e7082c
Add 3C .clang-format files.
mattmccutchen-cci Nov 11, 2020
01b7dd6
Remove a semicolon after the body of ~FunctionVariableConstraint that
mattmccutchen-cci Nov 11, 2020
873fa72
clang-format all files covered by the new 3C .clang-format files.
mattmccutchen-cci Nov 10, 2020
e9c3740
clang-format 3C files in clangd.
mattmccutchen-cci Nov 11, 2020
552e51c
Format 3C code in non-3C clangd files.
mattmccutchen-cci Nov 11, 2020
f579535
Fix long lines in comments in 3C C++ code.
mattmccutchen-cci Nov 11, 2020
b53fb9c
Add a period at the end of a comment as requested by Microsoft.
mattmccutchen-cci Nov 10, 2020
f184449
Merge pull request #333 from correctcomputation/microsoft-pr-style-1
mattmccutchen-cci Nov 12, 2020
fe0695d
Merge branch 'master' of github.com:microsoft/checkedc-clang
mattmccutchen-cci Nov 18, 2020
efa3c0a
clang/lib/3C/*.cpp: Move the #include of the main module header above
mattmccutchen-cci Nov 18, 2020
44369c2
Fix broken dependency of AVarGraph.h on a declaration of AVarBoundsInfo
mattmccutchen-cci Nov 18, 2020
c781cd9
Merge pull request #338 from correctcomputation/header-dependencies
mattmccutchen-cci Nov 19, 2020
8878fe5
Add missing final newlines to all 3C files.
mattmccutchen-cci Nov 19, 2020
8787e3a
Fix nits in 3C .clang-format files.
mattmccutchen-cci Nov 20, 2020
e2ef1e1
Add 3C .clang-tidy files and documentation.
mattmccutchen-cci Nov 11, 2020
0042db4
Add all readability-identifier-naming suppressions for the _3C prefix.
mattmccutchen-cci Nov 19, 2020
1173e9f
Finish applying clang-tidy to 3C (for now).
mattmccutchen-cci Nov 22, 2020
8b0aff7
Remove unused local variables and private fields.
mattmccutchen-cci Nov 23, 2020
c83733f
3C CONTRIBUTING.md: Add link to more information about 5C.
mattmccutchen-cci Dec 4, 2020
9494e6a
Merge branch 'master' of github.com:microsoft/checkedc-clang
mattmccutchen-cci Dec 4, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,14 @@ manual is
For more information on Checked C and pointers to example code, see our
[Wiki](https://github.com/Microsoft/checkedc/wiki).

## 3C: Semi-automated conversion of C code to Checked C

This repository includes a tool called 3C that partially automates the
conversion of C code to Checked C. Here is [general information about the 3C
software](clang/docs/checkedc/3C/README.md), including development status and
how to contribute. Here are the [usage instructions for the `3c` command-line
tool](clang/tools/3c/README.md).

## More information

For more information on the Checked C clang compiler, see the [Checked C clang
Expand All @@ -66,6 +74,7 @@ wiki](https://github.com/Microsoft/checkedc-clang/wiki).
|Debug X86 Windows| Checked C and clang regression tests|![Debug X86 Windows status](https://msresearch.visualstudio.com/_apis/public/build/definitions/f6454e27-a46c-49d9-8453-29d89d53d2f9/211/badge)|
|Debug X64 Windows| Checked C and clang regression tests| ![Debug X64 Windows status](https://msresearch.visualstudio.com/_apis/public/build/definitions/f6454e27-a46c-49d9-8453-29d89d53d2f9/205/badge)|
|Debug X64 Linux | Checked C and clang regression tests| ![Debug X64 Linux status](https://msresearch.visualstudio.com/_apis/public/build/definitions/f6454e27-a46c-49d9-8453-29d89d53d2f9/217/badge)|
|Debug X64 Linux | 3C (Checked-C-Convert tool) nightly tests| ![Nightly Sanity Tests](https://github.com/correctcomputation/checkedc-clang/workflows/Nightly%20Sanity%20Tests/badge.svg?branch=master)|
|Release X64 Linux| Checked C, clang, and LLVM nightly tests|![Release X64 Linux status](https://msresearch.visualstudio.com/_apis/public/build/definitions/f6454e27-a46c-49d9-8453-29d89d53d2f9/238/badge)|

## Contributing
Expand Down
72 changes: 72 additions & 0 deletions clang-tools-extra/clangd/3CCommands.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
//=--3CCommands.cpp-----------------------------------------------*- C++-*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
// Implementation of 3C command helper methods.
//===----------------------------------------------------------------------===//

#ifdef INTERACTIVE3C
#include "3CCommands.h"

namespace clang {
namespace clangd {

#define _3CSOURCE "3C_RealWild"

static bool getPtrIdFromDiagMessage(const Diagnostic &DiagMsg,
unsigned long &PtrId) {
if (DiagMsg.source.rfind(_3CSOURCE, 0) == 0) {
PtrId = atoi(DiagMsg.code.c_str());
return true;
}
return false;
}

void as3CCommands(const Diagnostic &D, std::vector<Command> &OutCommands) {
unsigned long PtrId;
if (getPtrIdFromDiagMessage(D, PtrId)) {
Command AllPtrsCmd;
_3CManualFix PtrFix;
PtrFix.PtrId = PtrId;
AllPtrsCmd.The3CManualFix = PtrFix;
Command SinglePtrCmd = AllPtrsCmd;

AllPtrsCmd.command = Command::_3C_APPLY_FOR_ALL;
AllPtrsCmd.title = "Make this pointer non-WILD and apply the "
"same observation to all the pointers.";

OutCommands.push_back(AllPtrsCmd);

SinglePtrCmd.command = Command::_3C_APPLY_ONLY_FOR_THIS;
SinglePtrCmd.title = "Make ONLY this pointer non-WILD.";

OutCommands.push_back(SinglePtrCmd);
}
}

bool is3CCommand(const ExecuteCommandParams &Params) {
return (Params.command.rfind(Command::_3C_APPLY_ONLY_FOR_THIS, 0) == 0) ||
(Params.command.rfind(Command::_3C_APPLY_FOR_ALL, 0) == 0);
}

bool execute3CCommand(const ExecuteCommandParams &Params,
std::string &ReplyMessage, _3CInterface &CcInterface) {
ReplyMessage = "Checked C Pointer Modified.";
if (Params.command.rfind(Command::_3C_APPLY_ONLY_FOR_THIS, 0) == 0) {
int PtrId = Params.The3CManualFix->PtrId;
CcInterface.makeSinglePtrNonWild(PtrId);
return true;
}
if (Params.command.rfind(Command::_3C_APPLY_FOR_ALL, 0) == 0) {
int PtrId = Params.The3CManualFix->PtrId;
CcInterface.invalidateWildReasonGlobally(PtrId);
return true;
}
return false;
}
} // namespace clangd
} // namespace clang
#endif
32 changes: 32 additions & 0 deletions clang-tools-extra/clangd/3CCommands.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
//=--3CCommands.h-------------------------------------------------*- C++-*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
// Helper methods used to handle 3C commands.
//===----------------------------------------------------------------------===//

#ifdef INTERACTIVE3C
#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANGD_3CCOMMANDS_H
#define LLVM_CLANG_TOOLS_EXTRA_CLANGD_3CCOMMANDS_H

#include "Protocol.h"
#include "clang/3C/3C.h"

namespace clang {
namespace clangd {
// Convert the provided Diagnostic into Commands.
void as3CCommands(const Diagnostic &D, std::vector<Command> &OutCommands);
// Check if the execute command request from the client is a 3C command.
bool is3CCommand(const ExecuteCommandParams &Params);

// Interpret the provided execute command request as 3C command
// and execute them.
bool execute3CCommand(const ExecuteCommandParams &Params,
std::string &ReplyMessage, _3CInterface &CcInterface);
} // namespace clangd
} // namespace clang
#endif // LLVM_CLANG_TOOLS_EXTRA_CLANGD_3CCOMMANDS_H
#endif
Original file line number Diff line number Diff line change
@@ -1,75 +1,75 @@
//=--CConvertDiagnostics.cpp--------------------------------------*- C++-*-===//
//=--3CDiagnostics.cpp--------------------------------------------*- C++-*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
// Implementation of CConvertDiagnostics methods
// Implementation of _3CDiagnostics methods
//===----------------------------------------------------------------------===//

#ifdef INTERACTIVECCCONV
#include "CConvertDiagnostics.h"
#ifdef INTERACTIVE3C
#include "3CDiagnostics.h"

namespace clang {
namespace clangd {

#define DEFAULT_PTRSIZE 4

void CConvertDiagnostics::ClearAllDiags() {
void _3CDiagnostics::clearAllDiags() {
std::lock_guard<std::mutex> Lock(DiagMutex);
AllFileDiagnostics.clear();
}

static bool IsValidSourceFile(ConstraintsInfo &CCRes, std::string &FilePath) {
static bool isValidSourceFile(ConstraintsInfo &CCRes, std::string &FilePath) {
return CCRes.ValidSourceFiles.find(FilePath) != CCRes.ValidSourceFiles.end();
}


bool CConvertDiagnostics::PopulateDiagsFromConstraintsInfo(ConstraintsInfo &Line) {
bool _3CDiagnostics::populateDiagsFromConstraintsInfo(ConstraintsInfo &Line) {
std::lock_guard<std::mutex> Lock(DiagMutex);
std::set<ConstraintKey> ProcessedCKeys;
ProcessedCKeys.clear();
auto GetLocRange = [](uint32_t Line, uint32_t ColNoS, uint32_t ColNoE) -> Range {
Range nRange;
auto GetLocRange = [](uint32_t Line, uint32_t ColNoS,
uint32_t ColNoE) -> Range {
Range NRange;
Line--;
nRange.start.line = Line;
nRange.end.line = Line;
nRange.start.character = ColNoS;
NRange.start.line = Line;
NRange.end.line = Line;
NRange.start.character = ColNoS;
if (ColNoE > 0) {
nRange.end.character = ColNoE;
NRange.end.character = ColNoE;
} else {
nRange.end.character = ColNoS + DEFAULT_PTRSIZE;
NRange.end.character = ColNoS + DEFAULT_PTRSIZE;
}
return nRange;
return NRange;
};

for (auto &WReason : Line.RealWildPtrsWithReasons) {
if (Line.PtrSourceMap.find(WReason.first) != Line.PtrSourceMap.end()) {
auto *PsInfo = Line.PtrSourceMap[WReason.first];
for (auto &WReason : Line.RootWildAtomsWithReason) {
if (Line.AtomSourceMap.find(WReason.first) != Line.AtomSourceMap.end()) {
auto *PsInfo = Line.AtomSourceMap[WReason.first];
std::string FilePath = PsInfo->getFileName();
// If this is not a file in a project? Then ignore.
if (!IsValidSourceFile(Line, FilePath))
if (!isValidSourceFile(Line, FilePath))
continue;

ProcessedCKeys.insert(WReason.first);

Diag NewDiag;
NewDiag.Range = GetLocRange(PsInfo->getLineNo(), PsInfo->getColSNo(),
PsInfo->getColENo());
NewDiag.Source = Diag::CConvMain;
NewDiag.Source = Diag::_3CMain;
NewDiag.Severity = DiagnosticsEngine::Level::Error;
NewDiag.code = std::to_string(WReason.first);
NewDiag.Message = "Pointer is wild because of:" +
WReason.second.WildPtrReason;
NewDiag.Code = std::to_string(WReason.first);
NewDiag.Message =
"Pointer is wild because of:" + WReason.second.getWildPtrReason();

// Create notes for the information about root cause.
if (WReason.second.IsValid) {
PersistentSourceLoc SL = WReason.second.getLocation();
if (SL.valid()) {
Note DiagNote;
DiagNote.AbsFile = WReason.second.SourceFileName;
DiagNote.AbsFile = SL.getFileName();
DiagNote.Range =
GetLocRange(WReason.second.LineNo, WReason.second.ColStartS,
WReason.second.ColStartE);
GetLocRange(SL.getLineNo(), SL.getColSNo(), SL.getColENo());
DiagNote.Message = "Go here to know the root cause for this.";
NewDiag.Notes.push_back(DiagNote);
}
Expand All @@ -78,43 +78,48 @@ bool CConvertDiagnostics::PopulateDiagsFromConstraintsInfo(ConstraintsInfo &Line
}

// For non-direct wild pointers..update the reason and diag information.
for (auto NonWildCk : Line.TotalNonDirectWildPointers) {
for (auto NonWildCk : Line.TotalNonDirectWildAtoms) {
if (ProcessedCKeys.find(NonWildCk) == ProcessedCKeys.end()) {
ProcessedCKeys.insert(NonWildCk);
if (Line.PtrSourceMap.find(NonWildCk) != Line.PtrSourceMap.end()) {
auto *PsInfo = Line.PtrSourceMap[NonWildCk];
if (Line.AtomSourceMap.find(NonWildCk) != Line.AtomSourceMap.end()) {
auto *PsInfo = Line.AtomSourceMap[NonWildCk];
std::string FilePath = PsInfo->getFileName();
// If this is not a file in a project? Then ignore.
if (!IsValidSourceFile(Line, FilePath))
if (!isValidSourceFile(Line, FilePath))
continue;

ProcessedCKeys.insert(NonWildCk);
Diag NewDiag;
NewDiag.Range = GetLocRange(PsInfo->getLineNo(), PsInfo->getColSNo(),
PsInfo->getColENo());

NewDiag.code = std::to_string(NonWildCk);
NewDiag.Source = Diag::CConvSec;
NewDiag.Code = std::to_string(NonWildCk);
NewDiag.Source = Diag::_3CSec;
NewDiag.Severity = DiagnosticsEngine::Level::Warning;
NewDiag.Message = "Pointer is wild because it transitively "
"depends on other pointer(s)";

// find the pointer group
CVars &DirectWildPtrs = Line.GetRCVars(NonWildCk);
CVars &DirectWildPtrs = Line.getRCVars(NonWildCk);

unsigned MaxPtrReasons = 4;
for (auto tC : DirectWildPtrs) {
for (auto TC : DirectWildPtrs) {
Note DiagNote;

if (Line.PtrSourceMap.find(tC) != Line.PtrSourceMap.end()) {
PsInfo = Line.PtrSourceMap[tC];
if (Line.AtomSourceMap.find(TC) != Line.AtomSourceMap.end()) {
PsInfo = Line.AtomSourceMap[TC];
FilePath = PsInfo->getFileName();
DiagNote.AbsFile = FilePath;
DiagNote.Range =
GetLocRange(PsInfo->getLineNo(), PsInfo->getColSNo(),
PsInfo->getColENo());
DiagNote.Range = GetLocRange(
PsInfo->getLineNo(), PsInfo->getColSNo(), PsInfo->getColENo());
MaxPtrReasons--;
DiagNote.Message = Line.RealWildPtrsWithReasons[tC].WildPtrReason;
// NOTE: Matt changed [] to `at` to fix a compile error after the
// default constructor of WildPointerInferenceInfo was removed in
// 3c3098c8724889a12eba383dec9088094bced99c. Right now, we don't
// care because we're not running clangd3c at all, but if and when
// we revive it, we should consider whether this assumption is safe.
DiagNote.Message =
Line.RootWildAtomsWithReason.at(TC).getWildPtrReason();
if (MaxPtrReasons <= 1)
DiagNote.Message += " (others)";
NewDiag.Notes.push_back(DiagNote);
Expand All @@ -127,10 +132,9 @@ bool CConvertDiagnostics::PopulateDiagsFromConstraintsInfo(ConstraintsInfo &Line
}
}


return true;
}

}
}
#endif
} // namespace clangd
} // namespace clang
#endif
Original file line number Diff line number Diff line change
@@ -1,45 +1,47 @@
//=--CConvertDiagnostics.h----------------------------------------*- C++-*-===//
//=--3CDiagnostics.h----------------------------------------------*- C++-*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
// Class that handles CConv Diagnostic messages.
// Class that handles 3C Diagnostic messages.
//===----------------------------------------------------------------------===//

#ifdef INTERACTIVECCCONV
#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANGD_CCONVERTDIAGNOSTICS_H
#define LLVM_CLANG_TOOLS_EXTRA_CLANGD_CCONVERTDIAGNOSTICS_H
#ifdef INTERACTIVE3C
#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANGD_3CDIAGNOSTICS_H
#define LLVM_CLANG_TOOLS_EXTRA_CLANGD_3CDIAGNOSTICS_H

#include <set>
#include "Diagnostics.h"
#include "clang/CConv/CConv.h"
#include "clang/3C/3C.h"
#include <set>

namespace clang {
namespace clangd {

// Class that represents diagnostics messages specific to CConv.
class CConvertDiagnostics {
// Class that represents diagnostics messages specific to 3C.
//
// See clang/docs/checkedc/3C/clang-tidy.md#_3c-name-prefix
// NOLINTNEXTLINE(readability-identifier-naming)
class _3CDiagnostics {
public:
std::mutex DiagMutex;

// GUARDED by DiagMutex
// Populate diagnostics from the given disjoint set.
bool PopulateDiagsFromConstraintsInfo(ConstraintsInfo &Line);
bool populateDiagsFromConstraintsInfo(ConstraintsInfo &Line);
// GUARDED by DiagMutex
// Clear diagnostics of all files.
void ClearAllDiags();
std::map<std::string, std::vector<Diag>> &GetAllFilesDiagnostics() {
void clearAllDiags();
std::map<std::string, std::vector<Diag>> &getAllFilesDiagnostics() {
return AllFileDiagnostics;
}

private:
// Diagnostics of all files.
std::map<std::string, std::vector<Diag>> AllFileDiagnostics;


};
}
}
#endif //LLVM_CLANG_TOOLS_EXTRA_CLANGD_
} // namespace clangd
} // namespace clang
#endif // LLVM_CLANG_TOOLS_EXTRA_CLANGD_
#endif
Loading