* Determine if a * following a closing paren is immediately. * after a cast. If so it is a deference and not a multiply. * e.g. "(int*) *ptr" is a deference. */
| 5672 | * e.g. "(int*) *ptr" is a deference. |
| 5673 | */ |
| 5674 | bool ASFormatter::isImmediatelyPostCast() const |
| 5675 | { |
| 5676 | assert(previousNonWSChar == ')' && currentChar == '*'); |
| 5677 | // find preceding closing paren on currentLine or readyFormattedLine |
| 5678 | string line; // currentLine or readyFormattedLine |
| 5679 | size_t paren = currentLine.rfind(")", charNum); |
| 5680 | if (paren != string::npos) |
| 5681 | line = currentLine; |
| 5682 | // if not on currentLine it must be on the previous line |
| 5683 | else |
| 5684 | { |
| 5685 | line = readyFormattedLine; |
| 5686 | paren = line.rfind(")"); |
| 5687 | if (paren == string::npos) |
| 5688 | return false; |
| 5689 | } |
| 5690 | if (paren == 0) |
| 5691 | return false; |
| 5692 | |
| 5693 | // find character preceding the closing paren |
| 5694 | size_t lastChar = line.find_last_not_of(" \t", paren - 1); |
| 5695 | if (lastChar == string::npos) |
| 5696 | return false; |
| 5697 | // check for pointer cast |
| 5698 | if (line[lastChar] == '*') |
| 5699 | return true; |
| 5700 | return false; |
| 5701 | } |
| 5702 | |
| 5703 | /** |
| 5704 | * Determine if a < is a template definition or instantiation. |
nothing calls this directly
no outgoing calls
no test coverage detected