Fixed #354: Attribute which appeared after return type was broken.
Showing 1 of 3 files from the diff.
FunctionDeclHandler.cpp
changed.
Other files ignored by Codecov
tests/Issue354.cpp
is new.
tests/Issue354.expect
is new.
@@ -73,8 +73,13 @@
Loading
73 | 73 | // Find the first attribute with a valid source-location |
|
74 | 74 | for(const auto& attr : funcDecl->attrs()) { |
|
75 | 75 | if(const auto location = attr->getLocation(); location.isValid()) { |
|
76 | - | // the -3 are a guess that seems to work |
|
77 | - | funcRange.setBegin(location.getLocWithOffset(-3)); |
|
76 | + | ||
77 | + | // only use the begin location of the attribute, if it is before the one of the function decl. |
|
78 | + | if(funcRange.getBegin() > location) { |
|
79 | + | // the -3 are a guess that seems to work |
|
80 | + | funcRange.setBegin(location.getLocWithOffset(-3)); |
|
81 | + | } |
|
82 | + | ||
78 | 83 | return funcRange; |
|
79 | 84 | } |
|
80 | 85 | } |
Files | Coverage |
---|---|
ClangCompat.h | 100.00% |
CodeGenerator.cpp | 98.40% |
CodeGenerator.h | 99.04% |
CodeGeneratorTypes.h | 100.00% |
DPrint.cpp | 0.00% |
DPrint.h | 58.06% |
FunctionDeclHandler.cpp | 100.00% |
FunctionDeclHandler.h | 100.00% |
GlobalVariableHandler.cpp | 100.00% |
GlobalVariableHandler.h | 100.00% |
Insights.cpp | 98.99% |
InsightsBase.cpp | 100.00% |
InsightsBase.h | 100.00% |
InsightsHelpers.cpp | 98.43% |
InsightsHelpers.h | 100.00% |
InsightsMatchers.h | 100.00% |
InsightsOnce.h | 100.00% |
InsightsOptions.def | 100.00% |
InsightsStrCat.h | 100.00% |
NumberIterator.h | 100.00% |
OutputFormatHelper.cpp | 100.00% |
OutputFormatHelper.h | 100.00% |
RecordDeclHandler.cpp | 100.00% |
RecordDeclHandler.h | 100.00% |
StackList.h | 100.00% |
StaticAssertHandler.cpp | 100.00% |
StaticAssertHandler.h | 100.00% |
TemplateHandler.cpp | 100.00% |
TemplateHandler.h | 100.00% |
Project Totals (29 files) | 97.66% |
Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file.
The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files.
The size and color of each slice is representing the number of statements and the coverage, respectively.