forked from checkedc/checkedc-clang
-
Notifications
You must be signed in to change notification settings - Fork 5
Fix for issue #373 #408
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
Fix for issue #373 #408
Changes from 13 commits
Commits
Show all changes
35 commits
Select commit
Hold shift + click to select a range
710ac7c
Fixed part 1 of #373
d917148
Actual fix
b24a251
Added test
efc9514
1st draft of single-var typedef handling
7a39353
Fixed first constraint issue
e56a07c
Merge branch 'main' into typedefs
6946d67
Merge branch 'main' into typedefs
a544451
Merge branch 'typedefs' of github.com:correctcomputation/checkedc-cla…
0481898
Moved definedType test to count
22a6eae
Fixing issue #373
57fe480
Merge branch 'main' into typedefs
70dc288
Fixed writing issue
156bf6c
Merge branch 'main' into typedefs
2e597e3
Fixed consistency issue w/ unwritable structs
34896cb
Fixed macro problem
185a7d5
Removed outdated TODO
20e4773
Added a descriptive reason for wildness root causes
7fe28e9
Fixed comment & style
7c7d95d
Style fixes
83a748d
Improved qualifier handling around typedefs
6676c06
Working on fixing the basedir tests
b6c5274
Merge branch 'main' into typedefs
0c3c72e
Update clang/test/3C/canwrite_constraints.h
7ab2c9e
Update clang/test/3C/root_cause.c
e6e1ae8
Updating canwrite tests
bea6efc
Updating canwrite tests
5627645
Merge branch 'main' into typedefs
956bcd1
Merge branch 'main' into typedefs
238e580
Fix for typedef'd arrays
34440e8
Fixed handling of function typedefs
7957e95
Merge branch 'main' into typedefs
79f8886
Style cleanup
67ecac9
Merge branch 'main' into typedefs
523a5a2
Fixed typo in test
260242a
Merge branch 'main' into typedefs
john-h-kastner File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -580,6 +580,7 @@ void PointerVariableConstraint::getQualString(uint32_t TypeIdx, | |
|
||
void PointerVariableConstraint::insertQualType(uint32_t TypeIdx, | ||
QualType &QTy) { | ||
if (QTy.isConstQualified()) | ||
aaronjeline marked this conversation as resolved.
Show resolved
Hide resolved
|
||
if (QTy.isConstQualified()) | ||
QualMap[TypeIdx].insert(ConstQualification); | ||
if (QTy.isVolatileQualified()) | ||
|
@@ -653,11 +654,23 @@ void PointerVariableConstraint::setTypedef(TypedefNameDecl* T, std::string s) { | |
// variables and potentially nested function pointer declaration. Produces a | ||
// string that can be replaced in the source code. | ||
|
||
std::string PointerVariableConstraint::gatherQualStrings(void) const { | ||
aaronjeline marked this conversation as resolved.
Show resolved
Hide resolved
|
||
std::ostringstream S; | ||
uint32_t Idx = 0; | ||
|
||
for (auto It = Vars.begin(); It != Vars.end(); It++, Idx++) { | ||
getQualString(Idx, S); | ||
} | ||
|
||
return S.str(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It looks like this could generate i.e. "const const" if you have |
||
} | ||
|
||
std::string PointerVariableConstraint::mkString(const EnvironmentMap &E, | ||
bool EmitName, bool ForItype, | ||
bool EmitPointee, bool UnmaskTypedef) const { | ||
if (IsTypedef && !UnmaskTypedef) { | ||
return typedefString + (EmitName && getName() != RETVAR ? (" " + getName()) : " "); | ||
return gatherQualStrings() + typedefString + | ||
(EmitName && getName() != RETVAR ? (" " + getName()) : " "); | ||
} | ||
|
||
std::ostringstream Ss; | ||
|
@@ -809,14 +822,16 @@ std::string PointerVariableConstraint::mkString(const EnvironmentMap &E, | |
EndStrs.push_front(" " + getName()); | ||
} | ||
|
||
if (EmittedBase == false) { | ||
if (!EmittedBase) { | ||
// If we have a FV pointer, then our "base" type is a function pointer. | ||
// type. | ||
if (FV) { | ||
Ss << FV->mkString(E); | ||
} else if (typedeflevelinfo.hasTypedef) { | ||
auto name = typedeflevelinfo.typedefName; | ||
Ss << name; | ||
std::ostringstream Buf; | ||
getQualString(typedeflevelinfo.typedefLevel, Buf); | ||
auto Name = typedeflevelinfo.typedefName; | ||
Ss << Buf.str() << Name; | ||
} else { | ||
Ss << BaseType; | ||
} | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.