File tree 1 file changed +16
-2
lines changed
1 file changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -160,10 +160,20 @@ class INOPreprocessorMatcherCallback : public MatchFinder::MatchCallback {
160
160
}
161
161
162
162
void detectInsertionPoint (SourceManager &sm, FullSourceLoc &begin, FullSourceLoc &end) {
163
- if (insertionPointFound)return ;
163
+ if (insertionPointFound) {
164
+ return ;
165
+ }
164
166
165
- FullSourceLoc first = undeclaredIdentifiers.front ()->location ;
167
+ if (undeclaredIdentifiers.empty ()) {
168
+ // insertionPoint = begin;
169
+ // insertionPointFound = true;
170
+ // if (debugOutput) {
171
+ // outs() << " !! Insertion point found (using the first available position)\n";
172
+ // }
173
+ return ;
174
+ }
166
175
176
+ FullSourceLoc first = undeclaredIdentifiers.back ()->location ;
167
177
if (first.isBeforeInTranslationUnitThan (begin)) {
168
178
if (debugOutput) {
169
179
outs () << " !! Insertion point found!\n " ;
@@ -172,6 +182,10 @@ class INOPreprocessorMatcherCallback : public MatchFinder::MatchCallback {
172
182
return ;
173
183
}
174
184
185
+ if (end.isInvalid ()) {
186
+ return ;
187
+ }
188
+
175
189
insertionPoint = begin;
176
190
presumedInsertionPoint = sm.getPresumedLoc (begin, true );
177
191
if (debugOutput) {
You can’t perform that action at this time.
0 commit comments