forked from qt-creator/qt-creator
		
	C++ Macro Usages: Refactoring
Change-Id: I959e0aeeec3164fdd997c08b6d4ed4e95a39009f Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
This commit is contained in:
		
				
					committed by
					
						
						Erik Verbruggen
					
				
			
			
				
	
			
			
			
						parent
						
							97925eaf54
						
					
				
				
					commit
					0b9ce52904
				
			@@ -573,22 +573,21 @@ _Lrestart:
 | 
			
		||||
            const Macro &useMacro = use.macro();
 | 
			
		||||
 | 
			
		||||
            if (useMacro.fileName() == macro.fileName()) { // Check if this is a match, but possibly against an outdated document.
 | 
			
		||||
                if (macro.fileRevision() > useMacro.fileRevision()) {
 | 
			
		||||
                    // yes, it is outdated, so re-preprocess and start from scratch for this file.
 | 
			
		||||
                    source = getSource(fileName, workingCopy).toLatin1();
 | 
			
		||||
                    doc = snapshot.preprocessedDocument(source, fileName);
 | 
			
		||||
                    goto _Lrestart;
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            if (useMacro.fileName() == macro.fileName() && macro.name() == useMacro.name()) {
 | 
			
		||||
                if (source.isEmpty())
 | 
			
		||||
                    source = getSource(fileName, workingCopy);
 | 
			
		||||
 | 
			
		||||
                unsigned lineStart;
 | 
			
		||||
                const QString &lineSource = matchingLine(use.begin(), source, &lineStart);
 | 
			
		||||
                usages.append(Usage(fileName, lineSource, use.beginLine(),
 | 
			
		||||
                                    use.begin() - lineStart, useMacro.name().length()));
 | 
			
		||||
                if (macro.fileRevision() > useMacro.fileRevision()) {
 | 
			
		||||
                    // yes, it is outdated, so re-preprocess and start from scratch for this file.
 | 
			
		||||
                    doc = snapshot.preprocessedDocument(source, fileName);
 | 
			
		||||
                    goto _Lrestart;
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                if (macro.name() == useMacro.name()) {
 | 
			
		||||
                    unsigned lineStart;
 | 
			
		||||
                    const QString &lineSource = matchingLine(use.begin(), source, &lineStart);
 | 
			
		||||
                    usages.append(Usage(fileName, lineSource, use.beginLine(),
 | 
			
		||||
                                        use.begin() - lineStart, useMacro.name().length()));
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user