diff --git a/doc/images/qtcreator-language-client-options.png b/doc/images/qtcreator-language-client-options.png new file mode 100644 index 00000000000..fef98897485 Binary files /dev/null and b/doc/images/qtcreator-language-client-options.png differ diff --git a/doc/src/editors/creator-only/creator-language-server.qdoc b/doc/src/editors/creator-only/creator-language-server.qdoc index 38045bc99eb..7bf030f1b0f 100644 --- a/doc/src/editors/creator-only/creator-language-server.qdoc +++ b/doc/src/editors/creator-only/creator-language-server.qdoc @@ -40,14 +40,17 @@ By providing a client for the language server protocol, \QC can support the above features for several other programming languages besides C++. - However, the experimental client does support language servers that + However, the experimental client does not support language servers that require special handling. \QC uses the \l{https://www.iana.org/assignments/media-types/media-types.xhtml} - {MIME type} of the file to determine which language server to start when you - open a file for editing. Add new MIME types as filters for language servers. - For more information about how \QC uses MIME types, see - \l {Editing MIME Types}. + {MIME type} of the file to determine which language server to request + information from when you open a file for editing. Add new MIME types or + file patterns to match language servers. If you do not set at least one MIME + type or file pattern, no files will be sent to the language server. This is + done to avoid unnecessary traffic and inaccurate information, as files are + only sent to the languge server if they are known to be handled by it. For + more information about how \QC uses MIME types, see \l {Editing MIME Types}. The experimental language service client has been mostly tested with Python. If problems arise when you try some other language, please select @@ -58,7 +61,6 @@ To use a language server: \list 1 - \li Enable the language server client by selecting \uicontrol Help > \uicontrol {About Plugins} > \uicontrol {Other Languages} > \uicontrol {Language Client} (or \uicontrol {Qt Creator} > @@ -66,18 +68,23 @@ \uicontrol {Language Client} on \macos). \li Restart \QC to load the language client plugin. \li Select \uicontrol Tools > \uicontrol Options > - \uicontrol {Language Client} > \uicontrol Add (or - \uicontrol {Qt Creator} > \uicontrol {Language Client} > - \uicontrol Add on \macos) to add language servers. + \uicontrol {Language Client} (or \uicontrol {Qt Creator} > + \uicontrol Preferences > \uicontrol {Language Client} > on + \macos) to view a list of language servers. + \image qtcreator-language-client-options.png "Language client options page" + \li Select the check box next to the language server name to enable the + language server. + \li Select \uicontrol Add to add language servers. \li In the \uicontrol Name field, enter a name for the language server. - \li Select the \uicontrol Enabled check box. - \li In the \uicontrol {MIME Type} field, enter the filter for files that - the lanaguage server will handle. When you start typing the filter - name, a list of predefined filters appears where you can select a - filter. + \li In the \uicontrol {Language} field, select + \uicontrol {Set MIME Types} to select the MIME types of the files to + send to the language server. In the field below, you can enter file + patterns to extend the MIME types, separated by semicolons. \li In the \uicontrol Executable field, enter the path to the language server executable. \li In the \uicontrol Arguments field, enter any required command line arguments. \endlist + + To remove language servers from the list, select \uicontrol Delete. */ diff --git a/doc/src/qtquick/qtquick-properties.qdoc b/doc/src/qtquick/qtquick-properties.qdoc index 4c78f25cfe4..c9d134d15c7 100644 --- a/doc/src/qtquick/qtquick-properties.qdoc +++ b/doc/src/qtquick/qtquick-properties.qdoc @@ -188,7 +188,7 @@ Then create the dataModel.qml file that contains the dummy data: \qml - import QtQuick 1.0 + import QtQuick 2.0 ListModel { ListElement { @@ -222,7 +222,7 @@ you can fake a parent context: \qml - import QtQuick 1.0 + import QtQuick 2.0 import QmlDesigner 1.0 DummyContextObject { diff --git a/share/qtcreator/debugger/dumper.py b/share/qtcreator/debugger/dumper.py index b48cf0b5916..8ad0e52a9ee 100644 --- a/share/qtcreator/debugger/dumper.py +++ b/share/qtcreator/debugger/dumper.py @@ -2786,7 +2786,10 @@ class DumperBase: if typeobj.code == TypeCodeReference: #warn('REFERENCE VALUE: %s' % value) val = value.dereference() - self.putItem(val) + if val.laddress != 0: + self.putItem(val) + else: + self.putSpecialValue('nullreference') self.putBetterType(typeName) return diff --git a/share/qtcreator/debugger/lldbbridge.py b/share/qtcreator/debugger/lldbbridge.py index a6d844a2b4d..3701a4c1ff0 100644 --- a/share/qtcreator/debugger/lldbbridge.py +++ b/share/qtcreator/debugger/lldbbridge.py @@ -252,8 +252,9 @@ class Dumper(DumperBase): # Correction for some bitfields. Size 0 can occur for # types without debug information. if bitsize > 0: + pass #bitpos = bitpos % bitsize - bitpos = bitpos % 8 # Reported type is always wrapping type! + #bitpos = bitpos % 8 # Reported type is always wrapping type! fieldBits[f.name] = (bitsize, bitpos, f.IsBitfield()) # Normal members and non-empty base classes. @@ -269,7 +270,7 @@ class Dumper(DumperBase): (fieldBitsize, fieldBitpos, isBitfield) = fieldBits[fieldName] else: fieldBitsize = nativeFieldType.GetByteSize() * 8 - fieldBitpost = None + fieldBitpos = None isBitfield = False if isBitfield: # Bit fields @@ -830,8 +831,7 @@ class Dumper(DumperBase): self.startMode_ = args.get('startmode', 1) self.breakOnMain_ = args.get('breakonmain', 0) self.useTerminal_ = args.get('useterminal', 0) - self.processArgs_ = args.get('processargs', []) - self.processArgs_ = list(map(lambda x: self.hexdecode(x), self.processArgs_)) + self.processArgs_ = self.hexdecode(args.get('processargs')) self.environment_ = args.get('environment', []) self.environment_ = list(map(lambda x: self.hexdecode(x), self.environment_)) self.attachPid_ = args.get('attachpid', 0) @@ -928,7 +928,19 @@ class Dumper(DumperBase): else: self.reportState('enginerunfailed') else: - launchInfo = lldb.SBLaunchInfo(self.processArgs_) + # This does not seem to work on Linux nor macOS? + #launchInfo = lldb.SBLaunchInfo([self.processArgs_]) + #launchInfo.SetShellExpandArguments(True) + args = [] + try: + import subprocess + cmd = 'for x in {} ; do printf "%s\n" "$x" ; done' \ + .format(self.processArgs_) + args = subprocess.check_output(cmd, shell=True, cwd=self.workingDirectory_).split() + except: + # Wrong, but... + args = self.processArgs_ + launchInfo = lldb.SBLaunchInfo(args) launchInfo.SetWorkingDirectory(self.workingDirectory_) launchInfo.SetEnvironmentEntries(self.environment_, False) if self.breakOnMain_: diff --git a/share/qtcreator/debugger/qttypes.py b/share/qtcreator/debugger/qttypes.py index dd339042bf0..2aa107429ef 100644 --- a/share/qtcreator/debugger/qttypes.py +++ b/share/qtcreator/debugger/qttypes.py @@ -24,6 +24,7 @@ ############################################################################ import platform +import re from dumper import * @@ -485,6 +486,116 @@ def qdump__QDir(d, value): d.putFields(value) +def qdump__QEvent(d, value): + d.putNumChild(1) + if d.isExpanded(): + with Children(d): + # Add a sub-item with the event type. + with SubItem(d, '[type]'): + (vtable, privateD, t) = value.split("pp{ushort}") + event_type_name = "QEvent::Type" + type_value = t.cast(event_type_name) + d.putValue(type_value.displayEnum('0x%04x')) + d.putType(event_type_name) + d.putNumChild(0) + + # Show the rest of the class fields as usual. + d.putFields(value, dumpBase=True) + +def qdump__QKeyEvent(d, value): + # QEvent fields + # virtual table pointer + # QEventPrivate *d; + # ushort t; + # ushort posted : 1; + # ushort spont : 1; + # ushort m_accept : 1; + # ushort reserved : 13; + # QInputEvent fields + # Qt::KeyboardModifiers modState; + # ulong ts; + # QKeyEvent fields + # QString txt; + # int k; + # quint32 nScanCode; + # quint32 nVirtualKey; + # quint32 nModifiers; <- nativeModifiers + # ushort c; + # ushort autor:1; + # ushort reserved:15; + (vtable, privateD, t, flags, modState, ts, txt, k, scanCode, + virtualKey, modifiers, + c, autor) = value.split("ppHHiQ{QString}{int}IIIHH") + + #d.putStringValue(txt) + #data = d.encodeString(txt) + key_txt_utf8 = d.encodeStringUtf8(txt) + + k_type_name = "Qt::Key" + k_casted_to_enum_value = k.cast(k_type_name) + k_name = k_casted_to_enum_value.displayEnum() + matches = re.search(r'Key_(\w+)', k_name) + if matches: + k_name = matches.group(1) + + if t == 6: + key_event_type = "Pressed" + elif t == 7: + key_event_type = "Released" + else: + key_event_type = "" + + data = "" + + if key_event_type: + data += "{} ".format(key_event_type) + + # Try to use the name of the enum value, otherwise the value + # of txt in QKeyEvent. + if k_name: + data += "'{}'".format(k_name) + elif key_txt_utf8: + data += "'{}'".format(key_txt_utf8) + else: + data += "" + + k_int = k.integer() + data += " (key:{} vKey:{}".format(k_int, virtualKey) + + modifier_list = [] + modifier_list.append(("Shift", 0x02000000)) + modifier_list.append(("Control", 0x04000000)) + modifier_list.append(("Alt", 0x08000000)) + modifier_list.append(("Meta", 0x10000000)) + # modifier_map.append(("KeyPad", 0x20000000)) Is this useful? + modifier_list.append(("Grp", 0x40000000)) + + modifiers = [] + for modifier_name, mask in modifier_list: + if modState & mask: + modifiers.append(modifier_name) + + if modifiers: + data += " mods:" + "+".join(modifiers) + + data += ")" + + d.putValue(d.hexencode(data), 'utf8') + + d.putNumChild(1) + if d.isExpanded(): + with Children(d): + # Add a sub-item with the enum name and value. + with SubItem(d, '[{}]'.format(k_type_name)): + k_casted_to_enum_value = k.cast(k_type_name) + d.putValue(k_casted_to_enum_value.displayEnum('0x%04x')) + d.putType(k_type_name) + d.putNumChild(0) + + # Show the rest of the class fields as usual. + d.putFields(value, dumpBase=True) + + def qdump__QFile(d, value): # 9fc0965 and a373ffcd change the layout of the private structure qtVersion = d.qtVersion() diff --git a/share/qtcreator/translations/qtcreator_de.ts b/share/qtcreator/translations/qtcreator_de.ts index 149dffac7f9..43ae2372c98 100644 --- a/share/qtcreator/translations/qtcreator_de.ts +++ b/share/qtcreator/translations/qtcreator_de.ts @@ -527,22 +527,6 @@ Revert Repository... Änderungen im gesamten Repository rückgängig machen... - - Commit - Commit - - - Diff &Selected Files - Diff für &Auswahl - - - &Undo - &Rückgängig - - - &Redo - &Wiederholen - Closing CVS Editor CVS-Editor schließen @@ -1718,10 +1702,6 @@ Weiterführende Informationen befinden sich in /etc/sysctl.d/10-ptrace.conf Marker Line: Marker-Zeile: - - Breakpoint Number: - Nummer des Haltepunkts: - Breakpoint Address: Adresse des Haltepunkts: @@ -1738,6 +1718,18 @@ Weiterführende Informationen befinden sich in /etc/sysctl.d/10-ptrace.conf State: Status: + + Breakpoint + Haltepunkt + + + Internal ID: + Interne ID: + + + pending + ausstehend + Requested Angefordert @@ -1746,10 +1738,6 @@ Weiterführende Informationen befinden sich in /etc/sysctl.d/10-ptrace.conf Obtained Erhalten - - Internal Number: - Interne Nummer: - File Name: Dateiname: @@ -2041,28 +2029,12 @@ Weiterführende Informationen befinden sich in /etc/sysctl.d/10-ptrace.conf Haltepunkte in Datei löschen - Synchronize Breakpoints - Haltepunkte synchronisieren + Stopped at breakpoint %1 in thread %2. + An Haltepunkt %1 im Thread %2 angehalten. - Remove All Breakpoints - Alle Haltepunkte löschen - - - Are you sure you want to remove all breakpoints from all files in the current session? - Möchten Sie wirklich alle Haltepunkte aus allen Dateien der aktuellen Sitzung löschen? - - - Add Breakpoint - Haltepunkt setzen - - - Breakpoint Condition - Bedingung für Haltepunkt - - - Debugger Command - Debuggerkommando + Unclaimed Breakpoint + Nicht zugeordneter Haltepunkt Enabled @@ -2072,34 +2044,22 @@ Weiterführende Informationen befinden sich in /etc/sysctl.d/10-ptrace.conf Disabled Deaktiviert - - , pending - , ausstehend - - - Engine: - Engine: - Hit Count: Anzahl der Auslösungen: + + Display Name: + Anzuzeigender Name: + Line Number: Zeilennummer: - - Corrected Line Number: - Korrigierte Zeilennummer: - Module: Modul: - - Multiple Addresses: - Mehrere Adressen: - Command: Kommando: @@ -2120,46 +2080,22 @@ Weiterführende Informationen befinden sich in /etc/sysctl.d/10-ptrace.conf Thread Specification: Thread: - - Data breakpoint %1 (%2) at %3 triggered. - Datenhaltepunkt %1 (%2) bei %3 ausgelöst. - Internal data breakpoint %1 at %2 triggered. Interner Datenhaltepunkt %1 bei %2 ausgelöst. - - Data breakpoint %1 (%2) at %3 in thread %4 triggered. - Datenhaltepunkt %1 (%2) bei %3 im Thread %4 ausgelöst. - Internal data breakpoint %1 at %2 in thread %3 triggered. Interner Datenhaltepunkt %1 bei (%2) im Thread %3 ausgelöst. - - Data breakpoint %1 (%2) at 0x%3 triggered. - Datenhaltepunkt %1 (%2) bei 0x%3 ausgelöst. - Internal data breakpoint %1 at 0x%2 triggered. Interner Datenhaltepunkt %1 bei 0x%2 ausgelöst. - - Data breakpoint %1 (%2) at 0x%3 in thread %4 triggered. - Datenhaltepunkt %1 (%2) bei 0x%3 im Thread %4 ausgelöst. - Internal data breakpoint %1 at 0x%2 in thread %3 triggered. Interner Datenhaltepunkt %1 bei 0x%2 im Thread %3 ausgelöst. - - Stopped at breakpoint %1 (%2) in thread %3. - An Haltepunkt %1 (%2) im Thread %3 angehalten. - - - Stopped at internal breakpoint %1 in thread %2. - Am internen Haltepunkt %1 im Thread %2 angehalten. - Number Zahl @@ -2276,6 +2212,18 @@ Weiterführende Informationen befinden sich in /etc/sysctl.d/10-ptrace.conf <html><head/><body><p>Uses CDB's native console for console applications. This overrides the setting in Environment > System. The native console does not prompt on application exit. It is suitable for diagnosing cases in which the application does not start up properly in the configured console and the subsequent attach fails.</p></body></html> <html><head/><body><p>Bewirkt, dass die native CDB-Konsole für Konsolenanwendungen verwendet wird. Dies hebt die Einstellung in Umgebung > System auf. Die native CDB-Konsole schließt sich nach dem Beenden der Anwendung ohne Nachfrage. Sie kann zur Diagnose von Anwendungen verwendet werden, die in der konfigurierten Konsole nicht starten und bei denen das darauffolgende Anhängen des Debuggers fehlschlägt.</p></body></html> + + First chance exceptions + "First chance"-Ausnahmen + + + Second chance exceptions + "Second chance"-Ausnahmen + + + Add Exceptions to Issues View + Ausnahmen zur Ansicht "Probleme" hinzufügen + Debugger::Internal::CdbSymbolPathListEditor @@ -2326,14 +2274,6 @@ Weiterführende Informationen befinden sich in /etc/sysctl.d/10-ptrace.conf Log Time Stamps Zeitstempel loggen - - Operate by Instruction - Auf Anweisungsebene arbeiten - - - <p>This switches the debugger to instruction-wise operation mode. In this mode, stepping operates on single instructions and the source location view also shows the disassembled instructions. - <p>Weist den Debugger an, auf Anweisungsebene zu arbeiten. In diesem Modus arbeitet die Einzelschritt-Funktion auf Maschinenanweisungen und die Quelltextanzeige zeigt die disassemblierten Anweisungen an. - Dereference Pointers Automatically Zeiger automatisch dereferenzieren @@ -2615,6 +2555,10 @@ Sie haben die Wahl zu warten oder das Debuggen abzubrechen. Application exited after receiving signal %1 Die Anwendung wurde nach Empfang des Signals %1 beendet + + Retrieving data for stack view thread %1... + Daten der Stack-Anzeige für Thread %1 werden empfangen... + Application started. Anwendung gestartet. @@ -2667,10 +2611,6 @@ Sie haben die Wahl zu warten oder das Debuggen abzubrechen. Interrupting not possible. Das Unterbrechen ist nicht möglich. - - Reading debug information failed: - Das Lesen der Debug-Informationen schlug fehl: - Symbols found. Symbole wurden gefunden. @@ -2781,10 +2721,6 @@ Versuchen Sie: %2 Step requested... Einzelschritt angefordert... - - Step by instruction requested... - Einzelschritt über Anweisung angefordert... - Finish function requested... Ausführung bis Funktionsende angefordert... @@ -2793,10 +2729,6 @@ Versuchen Sie: %2 Step next requested... Einzelschritt angefordert... - - Step next instruction requested... - Einzelschritt über Anweisung angefordert... - Run to line %1 requested... Ausführung bis Zeile %1 angefordert... @@ -2809,10 +2741,6 @@ Versuchen Sie: %2 Immediate return from function requested... Herausspringen aus innerer Funktion... - - Retrieving data for stack view thread 0x%1... - Daten der Stack-Anzeige für Thread 0x%1 werden empfangen... - Snapshot Creation Error Fehler bei der Erzeugung eines Snapshots @@ -3025,7 +2953,7 @@ markers in the source code editor. <html><head/><body><p>Attempts to identify missing debug info packages and lists them in the Issues output pane.</p><p><b>Note:</b> This feature needs special support from the Linux distribution and GDB build and is not available everywhere.</p></body></html> - <html><head/><body><p>Durch Aktivieren dieser Option wird versucht, die fehlenden Debuginformationspakete zu bestimmen und sie in der Ansicht Build-Probleme aufzulisten.</p><p><b>Hinweis:</b> Diese Funktionalität benötigt spezielle Unterstützung von der Linux-Distribution und von GDB und ist nicht überall vorhanden.</p></body></html> + <html><head/><body><p>Durch Aktivieren dieser Option wird versucht, die fehlenden Debuginformationspakete zu bestimmen und sie in der Ansicht "Probleme" aufzulisten.</p><p><b>Hinweis:</b> Diese Funktionalität benötigt spezielle Unterstützung von der Linux-Distribution und von GDB und ist nicht überall vorhanden.</p></body></html> <html><head/><body><p>GDB commands entered here will be executed after GDB has been started, but before the debugged program is started or attached, and before the debugging helpers are initialized.</p>%1</body></html> @@ -3716,6 +3644,10 @@ markers in the source code editor. Open Memory View at Pointer's Address Speicheranzeige an Adresse des Zeigers öffnen + + Open Memory View Showing Stack Layout + Speicheranzeige an Adresse des Stack-Frames öffnen + Open Memory Editor at Object's Address (0x%1) Speichereditor an Adresse des Objekts (0x%1) öffnen @@ -4337,18 +4269,6 @@ Grund: %3 Generische Verwaltung - - GenericProjectManager::Internal::GenericMakeStepConfigWidget - - Make - GenericMakestep display name. - Make - - - Override %1: - Überschreibe %1: - - GenericProjectManager::Internal::GenericProjectWizard @@ -4383,92 +4303,6 @@ Grund: %3 Dateiauswahl - - Git::Internal::BranchDialog - - Include branches and tags that have not been active for %n days. - - Branches und Tags einschließen, die seit einem Tag nicht benutzt wurden. - Branches und Tags einschließen, die seit %n Tagen nicht benutzt wurden. - - - - Fast-Forward - Fast-Forward - - - No Fast-Forward - Kein Fast-Forward - - - Branches - Branches - - - Re&fresh - &Aktualisieren - - - &Add... - &Hinzufügen... - - - &Remove - &Entfernen - - - &Diff - &Diff - - - &Log - &Log - - - &Merge - &Merge - - - Re&base - Re&base - - - Re&name - Umbe&nennen - - - &Track - &Folgen - - - Cherry pick top commit from selected branch. - Cherry-Pick des obersten Commits des ausgewählten Branches. - - - Set current branch to track the selected one. - Richtet den aktuellen Branch so ein, dass er dem ausgewählten Branch folgt. - - - &Include old entries - &Alte Einträge einschließen - - - Include ta&gs - Ta&gs anzeigen - - - C&heckout - C&heckout - - - Re&set - Zurück&setzen - - - Cherry &Pick - Cherry-&Pick - - Git::Internal::ChangeSelectionDialog @@ -4748,6 +4582,10 @@ Jetzt Commit ausführen? + + Only graphical merge tools are supported. Please configure merge.tool. + Nur grafische Merge-Tools werden unterstützt. Bitte konfigurieren Sie ein Merge-Tool. + Discard (reset) local changes and execute %1. Verwerfen (reset) der lokalen Änderungen und %1 ausführen. @@ -5097,10 +4935,6 @@ Jetzt Commit ausführen? Log Log - - Diff &Selected Files - Diff für &Auswahl - Closing Git Editor Git-Editor schließen @@ -5349,18 +5183,6 @@ Jetzt Commit ausführen? Actions on Commits... Aktionen mit Commits... - - Commit - Commit - - - &Undo - &Rückgängig - - - &Redo - &Wiederholen - Undo Changes to %1 Änderungen in %1 rückgängig machen @@ -5779,10 +5601,6 @@ Add, modify, and remove document filters, which determine the documentation set Bookmarks Lesezeichen - - Technical Support - Technischer Support - Open Pages Offene Seiten @@ -5799,6 +5617,10 @@ Add, modify, and remove document filters, which determine the documentation set Context Help Kontexthilfe + + Technical Support... + Technischer Support... + Report Bug... Fehler melden... @@ -6198,14 +6020,6 @@ Add, modify, and remove document filters, which determine the documentation set Submit Submit - - &Undo - &Rückgängig - - - &Redo - &Wiederholen - p4 revert Rückgängig machen @@ -6258,11 +6072,6 @@ Add, modify, and remove document filters, which determine the documentation set The process terminated with exit code %1. Der Prozess wurde beendet, Rückgabewert %1. - - submit - "commit" action for perforce - Submit - The commit message check failed. Do you want to submit this change list? Die Überprüfung der Beschreibung schlug fehl. Möchten Sie den Submit-Vorgang trotzdem ausführen? @@ -6293,10 +6102,6 @@ Add, modify, and remove document filters, which determine the documentation set The process terminated abnormally. Der Prozess wurde unnormal beendet. - - Diff &Selected Files - Diff für &Auswahl - Unable to write input data to process %1: %2 Es konnten keine Eingabedaten an den Prozess %1 übergeben werden: %2 @@ -6546,7 +6351,7 @@ Add, modify, and remove document filters, which determine the documentation set ProjectExplorer::AbstractProcessStep Configuration is faulty. Check the Issues view for details. - Die Konfiguration ist fehlerhaft. Details befinden sich in der Ansicht "Build-Probleme". + Die Konfiguration ist fehlerhaft. Details befinden sich in der Ansicht "Probleme". Could not create directory "%1" @@ -6554,7 +6359,7 @@ Add, modify, and remove document filters, which determine the documentation set Starting: "%1" %2 - Starte "%1" %2 + Starte: "%1" %2 The process "%1" exited normally. @@ -6720,6 +6525,14 @@ Add, modify, and remove document filters, which determine the documentation set &Batch Edit... Als &Text bearbeiten... + + Open &Terminal + &Terminalfenster öffnen + + + Open a terminal with this environment set up. + Ein Terminalfenster mit dieser Umgebung öffnen. + Unset <a href="%1"><b>%1</b></a> <a href="%1"><b>%1</b></a> zurücksetzen @@ -7039,10 +6852,6 @@ Außer: %2 Merge stderr and stdout Fehlerausgabe und Standardausgabe mischen - - lines - Zeilen - Reset Zurücksetzen @@ -7103,6 +6912,18 @@ Außer: %2 Add linker library search paths to run environment Linker-Bibliothekspfade zur Ausführungsumgebung hinzufügen + + characters + Zeichen + + + Creates suitable run configurations automatically when setting up a new kit. + Erzeugt automatisch geeignete Ausführungskonfigurationen, wenn ein neues Kit hinzugefügt wird. + + + Create suitable run configurations automatically + Automatisch Ausführungskonfigurationen erzeugen + ProjectExplorer::Internal::ProjectFileWizardExtension @@ -7144,6 +6965,10 @@ konnte dem Projekt "%2" nicht hinzugefügt werden. Alt+Shift+L Alt+Shift+L + + Meta+Shift+L + Meta+Shift+L + Hide Empty Directories Leere Verzeichnisse ausblenden @@ -7611,10 +7436,6 @@ konnte dem Projekt "%2" nicht hinzugefügt werden. Failed opening project "%1": No plugin can open project type "%2". Das Projekt "%1" konnte nicht geöffnet werden: Der Projekttyp "%2" kann von keinem Plugin geöffnet werden. - - Failed opening project "%1": Unknown project type. - Das Projekt "%1" konnte nicht geöffnet werden: Unbekannter Projekttyp. - Unknown error Unbekannter Fehler @@ -7685,6 +7506,18 @@ Möchten Sie sie ignorieren? Open... Öffnen... + + System Environment + Systemumgebung + + + Build Environment + Build-Umgebung + + + Run Environment + Ausführungsumgebung + S&essions Sitzung&en @@ -8470,18 +8303,6 @@ Rename %2 to %3 anyway? Update Repository Repository auf den aktuellen Stand bringen - - Commit - Commit - - - &Undo - &Rückgängig - - - &Redo - &Wiederholen - Closing Subversion Editor Subversion-Editor schließen @@ -8554,10 +8375,6 @@ Rename %2 to %3 anyway? Revert Repository... Änderungen im gesamten Repository rückgängig machen... - - Diff &Selected Files - Diff für &Auswahl - Revert repository Alle Änderungen rückgängig machen @@ -8887,14 +8704,6 @@ Rename %2 to %3 anyway? &Topics &Themen - - &Display - &Anzeigen - - - &Close - &Schließen - Utils::CheckableMessageBox @@ -9892,14 +9701,6 @@ Sie können die Änderungen in einem Stash ablegen oder zurücksetzen.Das Projekt erstellt das dieser Ausführungskonfiguration zugeordnete Ziel nicht mehr. - - CMakeProjectManager::Internal::CMakeTarget - - Desktop - CMake Default target display name - Desktop - - Core @@ -10093,36 +9894,6 @@ Sie können die Änderungen in einem Stash ablegen oder zurücksetzen.CDB - - Debugger::Internal::SnapshotHandler - - Name - Name - - - File - Datei - - - - GenericProjectManager::Internal::GenericMakeStep - - Make - Make - - - Override %1: - Überschreibe %1: - - - Make arguments: - Kommandozeilenargumente für make: - - - Targets: - Ziele: - - Help @@ -10337,22 +10108,6 @@ Sie können die Änderungen in einem Stash ablegen oder zurücksetzen.Incoming Source Quelle - - Commit - Commit - - - Diff &Selected Files - Diff für &Auswahl - - - &Undo - &Rückgängig - - - &Redo - &Wiederholen - There are no changes to commit. Es sind keine ausstehenden Änderungen vorhanden. @@ -10629,22 +10384,6 @@ Sie können die Änderungen in einem Stash ablegen oder zurücksetzen.Kits - - GenericProjectManager::GenericTarget - - Desktop - Generic desktop target display name - Desktop - - - - QmlProjectManager::QmlTarget - - QML Viewer - QML Viewer target display name - QML-Betrachter - - QmlDesigner::NavigatorTreeModel @@ -10895,6 +10634,42 @@ Dies ist unabhängig vom Wert der Eigenschaft "visible" in QML.Text Editor Texteditor + + Cannot create temporary file "%1": %2. + Die temporäre Datei "%1" konnte nicht erstellt werden: %2. + + + Failed to format: %1. + Konnte nicht formatieren: %1. + + + Cannot read file "%1": %2. + Die Datei "%1" kann nicht gelesen werden: %2. + + + Cannot call %1 or some other error occurred. + %1 konnte nicht aufgerufen werden oder es trat ein anderer Fehler auf. + + + Cannot call %1 or some other error occurred. Timeout reached while formatting file %2. + %1 konnte nicht aufgerufen werden oder es trat ein anderer Fehler auf. Zeitüberschreitung während die Datei %2 formatiert wurde. + + + Error in text formatting: %1 + Fehlerhafte Formatierung: %1 + + + Could not format file %1. + Die Datei %1 konnte nicht formatiert werden. + + + File %1 was closed. + Datei %1 wurde geschlossen. + + + File was modified. + Datei geändert. + VcsBase::VcsBasePlugin @@ -10910,11 +10685,6 @@ Dies ist unabhängig vom Wert der Eigenschaft "visible" in QML.The file "%1" could not be deleted. Die Datei "%1" konnte nicht gelöscht werden. - - commit - name of "commit" action of the VCS. - commit - Save before %1? Vor dem %1 speichern? @@ -10939,6 +10709,11 @@ Dies ist unabhängig vom Wert der Eigenschaft "visible" in QML.A version control repository has been created in %1. Ein Repository für Versionskontrolle wurde im Ordner %1 erstellt. + + Commit + name of "commit" action of the VCS. + Commit + A version control repository could not be created in %1. Im Ordner %1 konnte kein Repository für die Versionskontrolle erstellt werden. @@ -11016,6 +10791,14 @@ Dies ist unabhängig vom Wert der Eigenschaft "visible" in QML. QmlProjectManager::QmlProjectRunConfiguration + + Main QML file: + QML-Hauptdatei: + + + QML Viewer: + QML-Betrachter: + QML Scene QMLRunConfiguration display name. @@ -11319,7 +11102,7 @@ zu deaktivieren, deaktiviert auch die folgenden Plugins: Clean Environment - Umgebung löschen + Saubere Umgebung @@ -11728,23 +11511,6 @@ with a password, which you can enter below. Geben Sie den Namen der Sitzung an: - - QmlJSEditor::Internal::QmlJSPreviewRunner - - No file specified. - Keine Datei angegeben. - - - Failed to preview Qt Quick file - Die Qt Quick-Datei konnte nicht angezeigt werden - - - Could not preview Qt Quick (QML) file. Reason: -%1 - Die Qt Quick-Datei (QML) konnte nicht angezeigt werden: -%1 - - TextEditor::Internal::TextEditorPlugin @@ -11960,20 +11726,24 @@ IDs müssen außerdem mit einem Kleinbuchstaben beginnen. Convert to String Literal - In Zeichenkettenliteral wandeln + In Zeichenkettenliteral umwandeln Convert to Character Literal and Enclose in QLatin1Char(...) - In Zeichenliteral wandeln und in QLatin1Char(...) einschließen + In Zeichenliteral umwandeln und in QLatin1Char(...) einschließen Convert to Character Literal - In Zeichenliteral wandeln + In Zeichenliteral umwandeln Mark as Translatable Zur Übersetzung vorsehen + + Convert to Binary + In Binärdarstellung umwandeln + Escape String Literal as UTF-8 Zeichenkette als UTF-8-Escape-Sequenzen darstellen @@ -11992,7 +11762,7 @@ IDs müssen außerdem mit einem Kleinbuchstaben beginnen. Convert to Camel Case - In Camel-Case wandeln + In Camel-Case umwandeln Add #include %1 @@ -12028,11 +11798,7 @@ IDs müssen außerdem mit einem Kleinbuchstaben beginnen. Convert to Objective-C String Literal - In Objective-C-Zeichenkettenliteral wandeln - - - Enclose in %1(...) (Qt %2) - In %1(...) einschließen (Qt %2) + In Objective-C-Zeichenkettenliteral umwandeln Enclose in %1(...) @@ -12040,15 +11806,15 @@ IDs müssen außerdem mit einem Kleinbuchstaben beginnen. Convert to Hexadecimal - In Hexadezimal wandeln + In Hexadezimaldarstellung umwandeln Convert to Octal - In Oktal wandeln + In Oktaldarstellung umwandeln Convert to Decimal - In Dezimal wandeln + In Dezimaldarstellung umwandeln Complete Switch Statement @@ -12511,14 +12277,6 @@ Flags: %3 Interrupting is not possible in remote sessions. Das Unterbrechen ist bei entferntem Debuggen nicht möglich. - - Trace point %1 (%2) in thread %3 triggered. - Haltepunkt %1 (%2) bei im Thread %3 ausgelöst. - - - Conditional breakpoint %1 (%2) in thread %3 triggered, examining expression "%4". - Bedingter Haltepunkt %1 (%2) im Thread %3 ausgelöst, werte Ausdruck "%4" aus. - Debugger encountered an exception: %1 Der Debugger stellte einen Ausnahmefehler fest: %1 @@ -12527,10 +12285,6 @@ Flags: %3 Module loaded: %1 Modul geladen: %1 - - "Select Widget to Watch": Not supported in state "%1". - "Widget zur Überwachung auswählen": Nicht unterstützt im Status "%1". - Malformed stop response received. Es wurde eine ungültige Stop-Antwort erhalten. @@ -12543,6 +12297,14 @@ If you build %2 from sources and want to use a CDB executable with another bitne Wenn Sie %2 mit dem Maintenance Tool aktualisiert haben, müssen Sie dieses vielleicht erneut ausführen, "Komponenten hinzufügen oder entfernen" auswählen und die Komponente Qt > Tools > Qt Creator CDB Debugger Support auswählen. Wenn Sie %2 aus den Quelltexten erstellen und eine ausführbare CDB-Datei mit einer anderen Architektur (32 Bit, 64 Bit) verwenden wollen als %2, müssen Sie eine separate CDB-Erweiterung mit der gleichen Architektur wie diese CDB-Datei erstellen. + + Trace point %1 in thread %2 triggered. + Haltepunkt %1 im Thread %2 ausgelöst. + + + Conditional breakpoint %1 in thread %2 triggered, examining expression "%3". + Bedingter Haltepunkt %1 im Thread %2 ausgelöst, werte Ausdruck "%3" aus. + Switching to main thread... Wechsel zu Haupt-Thread... @@ -12555,10 +12317,6 @@ Wenn Sie %2 aus den Quelltexten erstellen und eine ausführbare CDB-Datei mit ei Value 0 obtained from evaluating the condition of breakpoint %1, continuing. Wert 0 von Bedingung des bedingten Haltepunkts %1 erhalten, setze fort. - - "Select Widget to Watch": Please stop the application first. - "Widget zur Überwachung auswählen": Bitte unterbrechen Sie zuerst die Anwendung. - Debugger::Internal::CacheDirectoryDialog @@ -12797,7 +12555,7 @@ wenn es außerhalb von git bash aufgerufen wird. ProjectExplorer::Internal::TaskWindow Issues - Build-Probleme + Probleme Show Warnings @@ -12808,17 +12566,6 @@ wenn es außerhalb von git bash aufgerufen wird. Nach Kategorie filtern - - ProjectExplorer::UserFileHandler - - No deployment - Kein Deployment - - - Deploy to Maemo device - Deployment auf Maemo-Gerät - - ProjectExplorer::Internal::VcsAnnotateTaskHandler @@ -13517,14 +13264,6 @@ konnte nicht unter Versionsverwaltung (%2) gestellt werden Debugger::Internal::DebuggerPluginPrivate - - No function selected. - Keine Funktion ausgewählt. - - - Running to function "%1". - Ausführung bis zu Funktion '%1'. - Process %1 Prozess %1 @@ -13565,10 +13304,26 @@ konnte nicht unter Versionsverwaltung (%2) gestellt werden Attaching to crashed process %1 Anhängen an abgestürzten Prozess %1 + + Start debugging of "%1" + Starte Debuggen von "%1" + Cannot attach to process with PID 0 Anhängen an Prozess-ID 0 nicht möglich + + Remove Breakpoint + Haltepunkt entfernen + + + Disable Breakpoint + Haltepunkt deaktivieren + + + Enable Breakpoint + Haltepunkt aktivieren + Set Breakpoint at Line %1 Haltepunkt bei Zeile %1 setzen @@ -13581,10 +13336,6 @@ konnte nicht unter Versionsverwaltung (%2) gestellt werden Disassemble Function "%1" Funktion "%1" disassemblieren - - Debugger finished. - Debuggen beendet. - Add Expression Evaluator Ausdruck auswerten @@ -13637,22 +13388,6 @@ konnte nicht unter Versionsverwaltung (%2) gestellt werden It is only possible to attach to a locally running process. Der Debugger kann sich lediglich an lokal laufende Prozesse anhängen. - - Remove Breakpoint %1 - Haltepunkt %1 löschen - - - Disable Breakpoint %1 - Haltepunkt %1 deaktivieren - - - Enable Breakpoint %1 - Haltepunkt %1 aktivieren - - - Edit Breakpoint %1... - Haltepunkt %1 bearbeiten... - Set Breakpoint at 0x%1 Haltepunkt bei 0x%1 setzen @@ -13665,42 +13400,14 @@ konnte nicht unter Versionsverwaltung (%2) gestellt werden Save Debugger Log Debugger Log speichern - - Starting debugger "%1" for ABI "%2"... - Starte Debugger "%1" für ABI "%2"... - Ctrl+Y Ctrl+Y - - Select a valid expression to evaluate. - Wählen Sie einen gültigen Ausdruck zur Auswertung aus. - F5 F5 - - &Breakpoints - &Haltepunkte - - - &Modules - &Module - - - Reg&isters - Reg&ister - - - &Stack - &Stack - - - &Threads - &Threads - Continue Fortsetzen @@ -13709,18 +13416,10 @@ konnte nicht unter Versionsverwaltung (%2) gestellt werden Interrupt Anhalten - - Debugger is Busy - Debugger arbeitet - Abort Debugging Debuggen abbrechen - - Aborts debugging and resets the debugger to the initial state. - Bricht das Debuggen ab und setzt den Debugger in den Ausgangszustand. - Step Over Einzelschritt über @@ -13753,10 +13452,6 @@ konnte nicht unter Versionsverwaltung (%2) gestellt werden Toggle Breakpoint Haltepunkt umschalten - - Reverse Direction - Umgekehrte Richtung - Move to Called Frame Gehe zum aufgerufenen Stackframe @@ -13813,10 +13508,6 @@ konnte nicht unter Versionsverwaltung (%2) gestellt werden Not a Desktop Device Type Kein "Desktop"-Gerätetyp - - Start "%1" and break at function "main()" - Starte "%1" und halte bei Erreichen der Funktion "main()" an - &Analyze &Analyse @@ -13825,22 +13516,6 @@ konnte nicht unter Versionsverwaltung (%2) gestellt werden Memory... Speicher... - - Source Files - Quelldateien - - - Locals - Lokale Variablen - - - &Expressions - &Ausdrücke - - - Snapshots - Snapshots - Restart Debugging Debuggen neu starten @@ -13861,6 +13536,26 @@ konnte nicht unter Versionsverwaltung (%2) gestellt werden Attach to Unstarted Application... Debugge noch nicht gestartete Anwendung... + + Start and Break on Main + Starten und bei "main" anhalten + + + Breakpoint Preset + voreingestellte Haltepunkte + + + Running Debuggers + Laufende Debugger + + + Debugger Perspectives + Debugger-Perspektiven + + + Start Debugging or Continue + Debuggen starten oder fortsetzen + Attach to Running Application Debugge externe, lokal laufende Anwendung @@ -13918,8 +13613,8 @@ konnte nicht unter Versionsverwaltung (%2) gestellt werden Ctrl+F6 - F12 - F12 + Edit Breakpoint... + Haltepunkt bearbeiten... F8 @@ -13933,10 +13628,6 @@ konnte nicht unter Versionsverwaltung (%2) gestellt werden Show Application on Top Anwendung im Vordergrund zeigen - - Threads: - Threads: - Debugger::Internal::MemoryAgent @@ -14050,6 +13741,22 @@ Soll es noch einmal versucht werden? Ignore whitespace only changes. Änderungen der Leerzeichen nicht berücksichtigen. + + No Move Detection + Keine verschobenen Daten erkennen + + + Detect Moves Within File + Innerhalb der Datei verschobene Daten erkennen + + + Detect Moves Between Files + Zwischen Dateien verschobene Daten erkennen + + + Detect Moves and Copies Between Files + Zwischen Dateien verschobene oder kopierte Daten erkennen + Reload Neu laden @@ -14233,17 +13940,6 @@ Soll es noch einmal versucht werden? QML-Funktionen - - QmlProjectManager::Internal::QmlProjectRunConfigurationWidget - - Arguments: - Argumente: - - - Main QML file: - QML-Hauptdatei: - - TextEditor::Internal::SnippetsTableModel @@ -14785,22 +14481,6 @@ Lokale Pull-Operationen werden nicht auf den Master-Branch angewandt.Update Aktualisieren - - Commit - Commit - - - Diff &Selected Files - Diff für &Auswahl - - - &Undo - &Rückgängig - - - &Redo - &Wiederholen - There are no changes to commit. Es sind keine ausstehenden Änderungen vorhanden. @@ -15181,10 +14861,6 @@ Lokale Pull-Operationen werden nicht auf den Master-Branch angewandt.Handler Editor - - Undefined - Nicht definiert - Core::Internal::MimeTypeSettings @@ -16906,13 +16582,6 @@ Wollen Sie die Daten vorher speichern? Der Snippet-Ordner des Nutzers konnte nicht erstellt werden: %1 - - Valgrind::Internal::Visualisation - - All functions with an inclusive cost ratio higher than %1 (%2 are hidden) - Alle Funktionen mit einem einschließlichen Kostenverhältnis größer als %1 (%2 nicht gezeigt) - - Valgrind::Internal @@ -17831,7 +17500,7 @@ Zusätzlich wird die Verbindung zum Gerät getestet. - RemoteLinux::Internal::ConfigWidget + RemoteLinux::GenericDirectUploadStep Incremental deployment Inkrementelles Deployment @@ -17840,13 +17509,6 @@ Zusätzlich wird die Verbindung zum Gerät getestet. Ignore missing files Fehlende Dateien ignorieren - - Command line: - Kommandozeile: - - - - RemoteLinux::GenericDirectUploadStep Upload files via SFTP Dateien mittels SFTP hochladen @@ -18181,13 +17843,6 @@ Außer: %3 Nach Aktualisierungen suchen - - RemoteLinux::GenericRemoteLinuxCustomCommandDeploymentStep - - Run custom remote command - Benutzerdefinertes entferntes Kommando ausführen - - RemoteLinux::RemoteLinuxCustomCommandDeployService @@ -18259,10 +17914,6 @@ Außer: %3 Reset all to default. Alle auf Vorgabewert zurücksetzen. - - Reset All - Alle zurücksetzen - Details Details @@ -18299,6 +17950,14 @@ Außer: %3 Filter Filter + + Reset MIME Types + MIME-Typen zurücksetzen + + + Reset Handlers + Handler zurücksetzen + CodePaster::Internal::FileShareProtocolSettingsWidget @@ -18689,18 +18348,6 @@ Diese Präfixe werden zusätzlich zum Dateinamen beim Wechseln zwischen Header- Dauer - - QmakeProjectManager::MakeStep - - Make - Qt MakeStep display name. - Make - - - Cannot find Makefile. Check your build settings. - Die Makefile-Datei konnte nicht gefunden werden. Bitte überprüfen Sie die Einstellungen zur Erstellung. - - QmakeProjectManager::QMakeStep @@ -19132,7 +18779,7 @@ Gibt an, wie sich die Rücktaste bezüglich Einrückung verhält. Ignored file patterns: - Ausgeschlossen Datei-Suchmuster: + Ausgeschlossene Datei-Suchmuster: @@ -19363,15 +19010,12 @@ should a repository require SSH-authentication (see documentation on SSH and the - AutotoolsProjectManager::Internal::AutogenStepFactory + AutotoolsProjectManager::Internal::AutogenStep Autogen Display name for AutotoolsProjectManager::AutogenStep id. Autogen - - - AutotoolsProjectManager::Internal::AutogenStep Autogen Autogen @@ -19394,15 +19038,12 @@ should a repository require SSH-authentication (see documentation on SSH and the - AutotoolsProjectManager::Internal::AutoreconfStepFactory + AutotoolsProjectManager::Internal::AutoreconfStep Autoreconf Display name for AutotoolsProjectManager::AutoreconfStep id. Autoreconf - - - AutotoolsProjectManager::Internal::AutoreconfStep Autoreconf Autoreconf @@ -19470,15 +19111,12 @@ should a repository require SSH-authentication (see documentation on SSH and the - AutotoolsProjectManager::Internal::ConfigureStepFactory + AutotoolsProjectManager::Internal::ConfigureStep Configure Display name for AutotoolsProjectManager::ConfigureStep id. Konfigurieren - - - AutotoolsProjectManager::Internal::ConfigureStep Configure Konfigurieren @@ -19511,33 +19149,6 @@ should a repository require SSH-authentication (see documentation on SSH and the Werte Verzeichnis %1 aus - - AutotoolsProjectManager::Internal::MakeStepFactory - - Make - Display name for AutotoolsProjectManager::MakeStep id. - Make - - - - AutotoolsProjectManager::Internal::MakeStep - - Make - Make - - - - AutotoolsProjectManager::Internal::MakeStepConfigWidget - - Arguments: - Argumente: - - - Make - AutotoolsProjectManager::MakeStepConfigWidget display name. - Make - - CMakeProjectManager::Internal::CMakeLocatorFilter @@ -20969,21 +20580,6 @@ Um die Qt-Versionen hinzuzufügen, benutzen Sie Einstellungen > Erstellung un Eigenschaften - - Debugger::Internal::SnapshotTreeView - - Snapshots - Snapshots - - - Create Snapshot - Snapshot erzeugen - - - Remove Snapshot - Snapshot löschen - - Debugger::Internal::StackTreeView @@ -22143,18 +21739,6 @@ hinzufügen, um dem QML-Editor den wahrscheinlichen URI mitzuteilen.Check In Einchecken - - Diff Selected Files - Diff für Auswahl - - - &Undo - &Rückgängig - - - &Redo - &Wiederholen - Closing ClearCase Editor ClearCase-Editor schließen @@ -22167,11 +21751,6 @@ hinzufügen, um dem QML-Editor den wahrscheinlichen URI mitzuteilen.The comment check failed. Do you want to check in the files? Die Überprüfung der Beschreibung schlug fehl. Möchten Sie die Dateien trotzdem einchecken? - - check in - "commit" action for ClearCase. - check in - Updating ClearCase Index Aktualisiere ClearCase Index @@ -23227,6 +22806,18 @@ Entfernt: %4 Continue merging other unresolved paths? Mergen anderer nicht aufgelöster Pfade fortsetzen? + + Merge Tool + Merge-Tool + + + Merge tool is not configured. + Es ist kein Merge-Tool konfiguriert. + + + Run git config --global merge.tool &lt;tool&gt; to configure it, then try again. + Führen Sie git config --global merge.tool &lt;tool&gt; aus, um es zu konfigurieren, und versuchen Sie es erneut. + Merge tool process finished successfully. Mergetool-Prozess wurde erfolgreich beendet. @@ -24245,13 +23836,6 @@ Weitere Informationen finden Sie auf der Dokumentationsseite "Checking Code Qbs Build - - QbsProjectManager::Internal::QbsBuildStepFactory - - Qbs Build - Qbs Build - - QbsProjectManager::Internal::QbsCleanStep @@ -24259,13 +23843,6 @@ Weitere Informationen finden Sie auf der Dokumentationsseite "Checking Code Qbs Clean - - QbsProjectManager::Internal::QbsCleanStepFactory - - Qbs Clean - Qbs Clean - - QbsProjectManager::Internal::QbsProject @@ -25088,7 +24665,7 @@ Teilnamen können verwendet werden, sofern sie eindeutig sind. Clean Environment - Umgebung löschen + Saubere Umgebung @@ -25125,14 +24702,14 @@ Teilnamen können verwendet werden, sofern sie eindeutig sind. Clean Environment - Umgebung löschen + Saubere Umgebung RemoteLinux::RemoteLinuxEnvironmentAspect Clean Environment - Umgebung löschen + Saubere Umgebung System Environment @@ -25318,13 +24895,6 @@ Teilnamen können verwendet werden, sofern sie eindeutig sind. Qbs-Installation - - QbsProjectManager::Internal::QbsInstallStepFactory - - Qbs Install - Qbs-Installation - - Git::Internal::LogChangeWidget @@ -25895,7 +25465,7 @@ Teilnamen können verwendet werden, sofern sie eindeutig sind. ProjectExplorer::OsParser - The process can not access the file because it is being used by another process. + The process cannot access the file because it is being used by another process. Please close all running instances of your application before starting a build. Der Prozess kann nicht auf die Datei zugreifen, da sie von einem anderen Prozess benutzt wird. Bitte schließen Sie alle laufenden Instanzen Ihrer Anwendung vor dem Erstellen. @@ -26339,13 +25909,6 @@ benötigt wird, was meist die Geschwindigkeit erhöht. Stil-Farbe - - Android::Internal::AndroidDeployQtStepFactory - - Deploy to Android device or emulator - Deployment auf Android-Gerät oder Emulator - - Android::Internal::AndroidDeployQtStep @@ -26353,18 +25916,22 @@ benötigt wird, was meist die Geschwindigkeit erhöht. AndroidDeployQtStep default display name Deployment auf Android-Gerät - - Found old folder "android" in source directory. Qt 5.2 does not use that folder by default. - Es wurde ein alter Ordner "android" im Quellverzeichnis gefunden. Qt 5.2 verwendet diesen Ordner nicht mehr. - No Android arch set by the .pro file. Die .pro-Datei setzt keine Android-Architektur. + + initializing deployment to Android device/simulator + Initialisiere Deployment zu Android-Gerät oder -Simulator + Cannot find the android build step. Kann den Android-Erstellungsschritt nicht finden. + + Deploying to %1 + Deployment auf %1 + Cannot find the androiddeployqt tool. Kann das androiddeployqt-Werkzeug nicht finden. @@ -26409,6 +25976,10 @@ benötigt wird, was meist die Geschwindigkeit erhöht. Install failed Installation gescheitert + + Deploy to Android device or emulator + Deployment auf Android-Gerät oder Emulator + Deployment failed with the following errors: @@ -26559,9 +26130,6 @@ Möchten Sie das vorhandene Paket deinstallieren? The provisioning profile "%1" (%2) used to sign the application does not cover the device %3 (%4). Deployment to it will fail. Das zum Signieren der Anwendung verwendete Provisioning-Profil "%1" (%2) deckt das Gerät %3 (%4) nicht ab. Deployment auf dieses wird scheitern. - - - Ios::Internal::IosDeployStepFactory Deploy to iOS device or emulator Deployment auf iOS-Gerät oder Emulator @@ -26676,10 +26244,6 @@ Möchten Sie das vorhandene Paket deinstallieren? Device type: Gerätetyp: - - Executable: - Ausführbare Datei: - Ios::Internal::IosSettingsPage @@ -27321,16 +26885,9 @@ Möchten Sie das vorhandene Paket deinstallieren? Remove "d" suffix for release version Suffix "d" für Release-Version entfernen - - - QmakeProjectManager::Internal::MakeStep - Make arguments: - Kommandozeilenargumente für make: - - - Override %1: - Überschreibe %1: + Library type: + Art der Bibliothek: @@ -27433,24 +26990,6 @@ Möchten Sie das vorhandene Paket deinstallieren? Geben Sie hier den Pfad zur ausführbaren Datei des <a href="%1">Windows Console Debuggers</a> (%2) an. - - QmakeProjectManager::Internal::Qt4Target - - Desktop - Qt4 Desktop target display name - Desktop - - - Maemo Emulator - Qt4 Maemo Emulator target display name - Maemo-Emulator - - - Maemo Device - Qt4 Maemo Device target display name - Maemo-Gerät - - QmakeProjectManager::Internal::AddLibraryWizard @@ -27650,36 +27189,6 @@ Weder der Pfad zur Bibliothek noch der Pfad zu den Headerdateien wird zur .pro-D %1 Bibliothek - - QmakeProjectManager::MakeStepConfigWidget - - Override %1: - Überschreibe %1: - - - Make: - Make: - - - <b>Make:</b> %1 - <b>Make:</b> %1 - - - <b>Make:</b> No Qt build configuration. - <b>Make:</b> Dies ist keine Qt-Build-Konfiguration. - - - <b>Make:</b> %1 not found in the environment. - <b>Make-Schritt:</b> %1 konnte in der Umgebung nicht gefunden werden. - - - - QmakeProjectManager::Internal::MakeStepFactory - - Make - Make - - QmakeProjectManager::Internal::QmakeKitConfigWidget @@ -27760,13 +27269,6 @@ Weder der Pfad zur Bibliothek noch der Pfad zu den Headerdateien wird zur .pro-D Deaktiviert QML-Debuggen. QML-Profiling funktioniert weiterhin. - - QmakeProjectManager::Internal::QMakeStepFactory - - qmake - qmake - - QmakeProjectManager::Internal::FilesPage @@ -28792,38 +28294,6 @@ Bitte erstellen Sie die Anwendung qmldump auf der Einstellungsseite der Qt-Versi Beautifier::Internal::BeautifierPlugin - - Cannot create temporary file "%1": %2. - Die temporäre Datei "%1" konnte nicht erstellt werden: %2. - - - Failed to format: %1. - Konnte nicht formatieren: %1. - - - Cannot read file "%1": %2. - Die Datei "%1" kann nicht gelesen werden: %2. - - - Cannot call %1 or some other error occurred. - %1 konnte nicht aufgerufen werden, oder es trat ein anderer Fehler auf. - - - Cannot call %1 or some other error occurred. Timeout reached while formatting file %2. - %1 konnte nicht aufgerufen werden, oder es trat ein anderer Fehler auf. Zeitüberschreitung während die Datei %2 formatiert wurde. - - - File was modified. - Datei geändert. - - - Could not format file %1. - Die Datei %1 konnte nicht formatiert werden. - - - File %1 was closed. - Datei %1 wurde geschlossen. - Error in Beautifier: %1 Fehler im Beautifier: %1 @@ -29263,6 +28733,10 @@ Möchten Sie es beenden? Executable: Ausführbare Datei: + + Stop Watching + Nicht mehr beobachten + Select valid executable. Bitte wählen Sie eine gültige ausführbare Datei. @@ -29414,6 +28888,10 @@ Möchten Sie es beenden? No executable to deploy found in %1. Keine ausführbare Datei für Deployment gefunden in %1. + + Cannot find windeployqt.exe in "%1". + windeployqt.exe wurde nicht in "%1" gefunden. + Cannot parse manifest file %1. Kann Manifest-Datei nicht auswerten: %1. @@ -29445,12 +28923,16 @@ Möchten Sie es beenden? Deinstalliere Paket nach der Ausführung - Run App Package - App-Paket ausführen + Enable localhost communication for clients + Localhost-Kommunikation für Clients aktivieren - Launch App - App starten + Enable localhost communication for servers (requires elevated rights) + Localhost-Kommunikation für Server aktivieren (benötigt erweiterte Berechtigungen) + + + Run App Package + App-Paket ausführen @@ -30360,8 +29842,8 @@ Bitte installieren Sie ein Android-SDK der API-Version %1 oder neuer.Nicht unterstützte zusammengefasste Einstellungsdatei - "%1" is not supported by %1. Do you want to try loading it anyway? - "%1 wird von %2 nicht unterstützt. Wollen Sie trotzdem versuchen sie zu laden? + "%1" is not supported by %2. Do you want to try loading it anyway? + "%1" wird von %2 nicht unterstützt. Wollen Sie trotzdem versuchen sie zu laden? @@ -30747,53 +30229,6 @@ Bitte installieren Sie ein Android-SDK der API-Version %1 oder neuer.Debug-Server hinzufügen - - QmakeAndroidSupport::Internal::QmakeAndroidBuildApkWidget - - Android - Android - - - Create Templates - Vorlagen erstellen - - - Additional Libraries - Zusätzliche Bibliotheken - - - List of extra libraries to include in Android package and load on startup. - Liste aller zusätzlichen Bibliotheken, die in das Paket aufgenommen und beim Start geladen werden. - - - Select library to include in package. - Wählen Sie eine Bibliothek zur Aufnahme in das Paket aus. - - - Add... - Hinzufügen... - - - Remove currently selected library from list. - Ausgewählte Bibliothek aus Liste entfernen. - - - Remove - Entfernen - - - Select additional libraries - Zusätzliche Bibliotheken auswählen - - - Libraries (*.so) - Bibliotheken (*.so) - - - <b>Build Android APK</b> - <b>Android-APK erstellen</b> - - QtSupport::Internal::CodeGenSettingsPageWidget @@ -30893,6 +30328,10 @@ The minimum API level required by the kit is %1. Der für das APK gewählte APK-Level ist nieriger als das vom Kit benötigte Minimum. Der vom Kit mindestens benötigte API-Level ist %1. + + Android build SDK not defined. Check Android settings. + Android-Build-SDK nicht festgelegt. Bitte überprüfen Sie die Einstellungen für Android. + Cannot sign the package. Invalid keystore path (%1). Das Paket kann nicht signiert werden. Der Keystore-Pfad ist ungültig (%1). @@ -30901,6 +30340,14 @@ Der vom Kit mindestens benötigte API-Level ist %1. Cannot sign the package. Certificate alias %1 does not exist. Das Paket kann nicht signiert werden. Der Zertifikatsalias %1 existiert nicht. + + No application .pro file found, not building an APK. + Keine .pro-Datei der Anwendung gefunden, APK wird nicht erstellt. + + + Starting: "%1" %2 + Starte: "%1" %2 + Error Fehler @@ -30910,21 +30357,6 @@ Der vom Kit mindestens benötigte API-Level ist %1. keytool konnte nicht ausgeführt werden. - - Android::AndroidBuildApkWidget - - Keystore files (*.keystore *.jks) - Keystore-Dateien (*.keystore *.jks) - - - Select Keystore File - Keystore-Datei auswählen - - - <b>Build Android APK</b> - <b>Android-APK erstellen</b> - - Android::AndroidConfigurations @@ -31046,6 +30478,14 @@ Der vom Kit mindestens benötigte API-Level ist %1. Is %1 running on any unix-based platform? Läuft %1 auf einer UNIX-basierten Plattform? + + The path list separator for the platform. + Das plattformspezifische Trennzeichen für Pfadlisten. + + + The platform executable suffix. + Die plattformspezifische Dateinamenserweiterung für ausführbare Dateien. + The directory where %1 finds its pre-installed resources. Das Verzeichnis, in dem %1 seine vorinstallierten Ressourcen findet. @@ -31066,6 +30506,10 @@ Der vom Kit mindestens benötigte API-Level ist %1. A comment. Ein Kommentar. + + Create Folder + Verzeichnis erzeugen + Core::PromptOverwriteDialog @@ -32069,6 +31513,10 @@ Dies betrifft die Haltepunkte %1 JS File JS-Datei + + Qt 5.12 + Qt 5.12 + Model name: Modellname: @@ -32262,10 +31710,6 @@ Wählt eine für Desktop-Entwicklung geeignete Qt-Version aus, sofern sie verfü Empty qmake Project Leeres qmake-Projekt - - Create a three.js based application. - Anwendung auf three.js aufbauen. - Define Project Details Projektdetails festlegen @@ -32411,14 +31855,6 @@ Benutzen Sie dies nur für Prototypen. Sie können damit keine vollständige Anw Scratch Model Modellentwurf - - Creates a Qt Canvas 3D QML project, optionally including three.js. - Erzeugt ein Qt Canvas 3D QML-Projekt. Dieses kann three.js verwenden. - - - Qt Quick Application - Canvas 3D - Qt Quick-Anwendung - Canvas 3D - Creates a Qt Quick application that contains an empty window. Erstellt eine Qt Quick-Anwendung, die ein leeres Fenster enthält. @@ -33430,120 +32866,6 @@ konnte dem Projekt "%2" nicht hinzugefügt werden. Quellverzeichnis - - QmakeAndroidSupport::Internal::NoApplicationProFilePage - - No application .pro file found in this project. - Die .pro-Datei der Anwendung konnte in diesem Projekt nicht gefunden werden. - - - No Application .pro File - Keine .pro-Datei der Anwendung - - - - QmakeAndroidSupport::Internal::ChooseProFilePage - - Select the .pro file for which you want to create the Android template files. - Wählen Sie die .pro-Datei, für die Sie die Android-Vorlagendateien erstellen wollen. - - - .pro file: - .pro Datei: - - - Select a .pro File - .pro-Datei wählen - - - - QmakeAndroidSupport::Internal::ChooseDirectoryPage - - The Android package source directory cannot be the same as the project directory. - Das Android-Paket-Quellverzeichnis muss sich vom Projektverzeichnis unterscheiden. - - - Android package source directory: - Quellverzeichnis des Android-Pakets: - - - It is highly recommended if you are planning to extend the Java part of your Qt application. - Dies ist sehr zu empfehlen, wenn sie den Java-Teil Ihrer Qt-Anwendung erweitern wollen. - - - Select the Android package source directory. - -The files in the Android package source directory are copied to the build directory's Android directory and the default files are overwritten. - Wählen Sie das Quellverzeichnis des Android-Pakets aus. - -Die Dateien aus dem Quellverzeichnis des Android-Pakets werden in das Verzeichnis "Android" im Build-Verzeichnis kopiert und die Vorgabedateien überschrieben. - - - The Android template files will be created in the ANDROID_PACKAGE_SOURCE_DIR set in the .pro file. - Die Android-Vorlagendateien werden im in der .pro-Datei angegebenen ANDROID_PACKAGE_SOURCE_DIR angelegt. - - - Copy the Gradle files to Android directory - Gradle-Dateien ins Android-Verzeichnis kopieren - - - - QmakeAndroidSupport::Internal::CreateAndroidManifestWizard - - Create Android Template Files Wizard - Assistent zum Erzeugen von Android-Vorlagendateien - - - Overwrite %1 file - Überschreibe Datei %1 - - - Overwrite existing "%1"? - Soll "%1" überschrieben werden? - - - File Creation Error - Fehler beim Erstellen der Datei - - - Could not copy file "%1" to "%2". - Die Datei "%1" konnte nicht nach "%2" kopiert werden. - - - Project File not Updated - Projekt-Datei nicht aktualisiert - - - Could not update the .pro file %1. - Die Projekt-Datei %1 konnte nicht aktualisiert werden. - - - - QmakeAndroidSupport::Internal::QmakeAndroidBuildApkStepFactory - - Build Android APK - Android APK erstellen - - - - QmakeAndroidSupport::Internal::QmakeAndroidBuildApkStep - - Found old folder "android" in source directory. Qt 5.2 does not use that folder by default. - Es wurde ein alter Ordner "android" im Quellverzeichnis gefunden. Qt 5.2 verwendet diesen Ordner nicht mehr. - - - Android build SDK not defined. Check Android settings. - Android-Build-SDK nicht festgelegt. Bitte überprüfen Sie die Einstellungen für Android. - - - No application .pro file found, not building an APK. - Keine .pro-Datei der Anwendung gefunden, APK wird nicht erstellt. - - - Starting: "%1" %2 - Starte "%1" %2 - - QmlJSEditor::Internal::QmlJSEditorWidget @@ -33772,6 +33094,10 @@ Die Dateien aus dem Quellverzeichnis des Android-Pakets werden in das Verzeichni File system case sensitivity: Unterscheidung zwischen Groß- und Kleinschreibung: + + Command line arguments used for "%1". + Kommandozeilenargumente für "%1". + Command used for reverting diff chunks. Kommando zum Zurücksetzen von einzelnen Änderungen in Diff-Anzeige. @@ -33820,6 +33146,10 @@ Die Dateien aus dem Quellverzeichnis des Android-Pakets werden in das Verzeichni Minimum number of open documents that should be kept in memory. Increasing this number will lead to greater resource usage when not manually closing documents. Mindestanzahl offener Dokumente, die im Speicher vorgehalten werden sollen. Diese Zahl zu erhöhen führt zu größerem Ressourcenverbrauch, wenn Dateien nicht manuell geschlossen werden. + + Command line arguments used for "Run in terminal". + Kommandozeilenargumente für "Im Terminal ausführen". + QbsProjectManager::Internal::CustomQbsPropertiesDialog @@ -34278,10 +33608,6 @@ Senden selbst auch Zeit benötigt. Unknown Unbekannt - - Custom Executable) - Benutzerdefinierte ausführbare Datei - The remote executable must be set in order to run a custom remote run configuration. Die entfernte ausführbare Datei muss eingestellt sein um eine benutzerdefinierte enternte Ausführungskonfiguration zu verwenden. @@ -34675,6 +34001,10 @@ Senden selbst auch Zeit benötigt. System CMake at %1 System-CMake in %1 + + CMake + CMake + Core::BaseFileWizard @@ -34818,8 +34148,152 @@ Senden selbst auch Zeit benötigt. Debugger::Internal::DebuggerEnginePrivate - Debugging has finished - Debuggen beendet + Debugger finished. + Debuggen beendet. + + + Continue + Fortsetzen + + + Stop Debugger + Debugger anhalten + + + Interrupt + Anhalten + + + Abort Debugging + Debuggen abbrechen + + + Step Into + Einzelschritt herein + + + Step Out + Einzelschritt heraus + + + Run to Line + Ausführen bis Zeile + + + Run to Selected Function + Bis zu ausgewählter Funktion ausführen + + + Jump to Line + Zeile anspringen + + + Immediately Return From Inner Function + Sofortiges Herausspringen aus innerer Funktion + + + Step Over + Einzelschritt über + + + Add Expression Evaluator + Ausdruck auswerten + + + Toggle Breakpoint + Haltepunkt umschalten + + + Restart Debugging + Debuggen neu starten + + + Operate by Instruction + Auf Anweisungsebene arbeiten + + + Record Information to Allow Reversal of Direction + Daten aufzeichnen, um Richtungsumkehr zu ermöglichen + + + Switches the debugger to instruction-wise operation mode. In this mode, stepping operates on single instructions and the source location view also shows the disassembled instructions. + Weist den Debugger an, auf Anweisungsebene zu arbeiten. In diesem Modus arbeitet die Einzelschritt-Funktion auf Maschinenanweisungen und die Quelltextanzeige zeigt die disassemblierten Anweisungen an. + + + Restarts the debugging session. + Startet die Debugging-Sitzung neu. + + + Record information to enable stepping backwards. + Daten aufzeichnen, um Einzelschritte rückwärts ausführen zu können. + + + Note: + Hinweis: + + + This feature is very slow and unstable on the GDB side. It exhibits unpredictable behavior when going backwards over system calls and is very likely to destroy your debugging session. + Diese Funktionalität ist sehr langsam und instabil auf Seiten von GDB. Es kann unvorhergesehenes Verhalten auftreten, wenn man rückwärts über einen Systemaufruf springt, und die Debugger-Sitzung kann leicht unbenutzbar werden. + + + Reverse Direction + Richtung umkehren + + + Continue %1 + %1 fortsetzen + + + Interrupt %1 + %1 anhalten + + + Take Snapshot of Process State + Aktuellen Prozessstatus aufzeichnen + + + Launching Debugger + Starte Debugger + + + &Modules + &Module + + + Reg&isters + Reg&ister + + + &Stack + &Stack + + + Source Files + Quelldateien + + + &Threads + &Threads + + + Locals + Lokale Variablen + + + &Expressions + &Ausdrücke + + + &Breakpoints + &Haltepunkte + + + Aborts debugging and resets the debugger to the initial state. + Bricht das Debuggen ab und versetzt den Debugger in den Ausgangszustand. + + + Threads: + Threads: @@ -34832,14 +34306,6 @@ Senden selbst auch Zeit benötigt. The memory contents cannot be shown as no viewer plugin for binary data has been loaded. Der Speicherinhalt kann nicht angezeigt werden, da kein Plugin zur Anzeige binärer Daten geladen ist. - - Launching Debugger - Starte Debugger - - - Debugging has failed - Debuggen schlug fehl - Loading finished. Laden beendet. @@ -34876,6 +34342,10 @@ Senden selbst auch Zeit benötigt. Taking notice of pid %1 PID %1 gemeldet + + Reverse-execution history exhausted. Going forward again. + Keine weiteren rückwärts ausführbaren Schritte vorhanden. Führe sie wieder vorwärts aus. + Attempting to interrupt. Unterbreche. @@ -34884,6 +34354,11 @@ Senden selbst auch Zeit benötigt. Could not find a widget. Es konnte kein Widget gefunden werden. + + %1 for "%2" + e.g. LLDB for "myproject", shows up i + %1 für "%2" + This debugger cannot handle user input. Dieser Debugger kann keine Nutzereingaben verarbeiten. @@ -34930,6 +34405,22 @@ Senden selbst auch Zeit benötigt. Exception Triggered Ausnahme ausgelöst + + Finished retrieving data. + Alle Daten erhalten. + + + No function selected. + Keine Funktion ausgewählt. + + + Running to function "%1". + Ausführung bis zu Funktion "%1". + + + Select a valid expression to evaluate. + Wählen Sie einen gültigen Ausdruck zur Auswertung aus. + The inferior is in the Portable Executable format. Selecting %1 as debugger would improve the debugging experience for this binary format. @@ -34950,6 +34441,26 @@ Selecting GDB or LLDB as debugger would improve the debugging experience for thi Der zu debuggende Prozess hat das ELF-Format. Für dieses Binärformat wären GDB oder LLDB besser als Debugger geeignet. + + Debugger + Debugger + + + Current debugger location of %1 + Aktueller Pfad zum Debugger von %1 + + + Debugging has failed. + Debuggen schlug fehl. + + + Operate in Reverse Direction + In umgekehrter Richtung arbeiten + + + Reverse-execution recording failed. + Aufzeichnung für Rückwärtsausführung gescheitert. + Found. Gefunden. @@ -34972,10 +34483,6 @@ Setting breakpoints by file name and line number may fail. Es liegt offenbar kein "Debug"-Build vor. Das Setzen von Haltepunkten anhand von Dateinamen und Zeilennummern könnte fehlschlagen. - - Finished retrieving data - Alle Daten erhalten - Run to Address 0x%1 Ausführung bis Adresse 0x%1 @@ -35046,10 +34553,6 @@ Das Setzen von Haltepunkten anhand von Dateinamen und Zeilennummern könnte fehl Debugger::Internal::RunConfigWidget - - Debugger Settings - Debuggereinstellungen - Enable C++ C++ aktivieren @@ -36495,10 +35998,6 @@ Das Setzen von Haltepunkten anhand von Dateinamen und Zeilennummern könnte fehl Omit internal messages Interne Meldungen auslassen - - Hides warnings related to a guessed run configuration. - Versteckt Warnungen, die zu einer vermuteten Laufzeitkonfiguration gehören. - Omit run configuration warnings Laufzeitkonfigurationsmeldungen auslassen @@ -36585,6 +36084,18 @@ Warnung: Dies ist eine experimentelle Funktion und könnte dazu führen, dass di Enables grouping of test cases. Erlaubt das Gruppieren von Tests. + + Hides warnings related to a deduced run configuration. + Versteckt Warnungen, die zu einer hergeleiteten Laufzeitkonfiguration gehören. + + + Clear all cached choices of run configurations for tests where the executable could not be deduced. + Alle gespeicherten Entscheidungen über Ausführungskonfigurationen für Tests löschen, bei denen die ausführbare Datei nicht hergeleitet werden konnte. + + + Reset Cached Choices + Gespeicherte Auswahlen zurücksetzen + ClangCodeModel::Internal::ClangProjectSettingsWidget @@ -36689,6 +36200,10 @@ Allerdings führt die Anwendung der weniger strikten und erweiterten Regeln dazu InfoText InfoText + + Diagnostic Configurations + Diagnosekonfigurationen + AddSignalHandlerDialog @@ -37160,6 +36675,10 @@ Allerdings führt die Anwendung der weniger strikten und erweiterten Regeln dazu Alt+Shift+T,Alt+A Alt+Shift+T,Alt+A + + Ctrl+Meta+T, Ctrl+Meta+A + Ctrl+Meta+T, Ctrl+Meta+A + &Run Selected Tests Sta&rte ausgewählte Tests @@ -37172,6 +36691,10 @@ Allerdings führt die Anwendung der weniger strikten und erweiterten Regeln dazu Alt+Shift+T,Alt+R Alt+Shift+T,Alt+R + + Ctrl+Meta+T, Ctrl+Meta+R + Ctrl+Meta+T, Ctrl+Meta+R + Run Tests for Current &File Tests für aktuelle &Datei ausführen @@ -37184,6 +36707,10 @@ Allerdings führt die Anwendung der weniger strikten und erweiterten Regeln dazu Alt+Shift+T,Alt+F Alt+Shift+T,Alt+F + + Ctrl+Meta+T, Ctrl+Meta+F + Ctrl+Meta+T, Ctrl+Meta+F + Re&scan Tests Tests neu durch&suchen @@ -37192,6 +36719,10 @@ Allerdings führt die Anwendung der weniger strikten und erweiterten Regeln dazu Alt+Shift+T,Alt+S Alt+Shift+T,Alt+S + + Ctrl+Meta+T, Ctrl+Meta+S + Ctrl+Meta+T, Ctrl+Meta+S + &Run Test Under Cursor Test unter Cursor &ausführen @@ -37512,26 +37043,10 @@ Ausführbare Datei: %2 Test run canceled by user. Testlauf durch den Benutzer abgebrochen. - - Run configuration: - Ausführungskonfiguration: - - - guessed from - Annahme basiert auf - Omitted the following arguments specified on the run configuration page for "%1": Die folgenden in der Ausführungskonfiguration "%1" angegebenen Argumente wurden ausgelassen: - - Project's run configuration was guessed for "%1". -This might cause trouble during execution. -(guessed from "%2") - Die Ausführungskonfiguration des Projekts wurde für "%1" geschätzt. -Dies könnte Probleme während der Ausführung verursachen. -(Annahme basiert auf "%2") - Project is null for "%1". Removing from test run. Check the test environment. @@ -37542,6 +37057,18 @@ Check the test environment. Executable path is empty. (%1) Der Pfad zur ausführbaren Datei ist leer. (%1) + + +Run configuration: deduced from "%1" + +Ausführungskonfiguration: hergeleitet von "%1" + + + +Run configuration: "%1" + +Ausführungskonfiguration: "%1" + Failed to start test for project "%1". Der Test für das Projekt "%1" konnte nicht gestartet werden. @@ -37572,6 +37099,10 @@ Gegebenenfalls sollten Sie das Zeitlimit erhöhen. No tests selected. Canceling test run. Keine Tests ausgewählt. Testlauf wird abgebrochen. + + Omitted the following environment variables for "%1": + Ausgelassene Umgebungsvariablen für "%1": + Current kit has changed. Canceling test run. Aktuelles Kit wurde geändert. Testlauf wird abgebrochen. @@ -37586,6 +37117,14 @@ Nur Desktopkits sind erlaubt. Stellen Sie sicher, dass das aktive Kit ein Deskto Project is not configured. Canceling test run. Projekt ist nicht konfiguriert. Testlauf wird abgebrochen. + + Project's run configuration was deduced for "%1". +This might cause trouble during execution. +(deduced from "%2") + Die Ausführungskonfiguration des Projekts wurde für "%1" hergeleitet. +Dies könnte Probleme während der Ausführung verursachen. +(hergeleitet von "%2") + Startup project has changed. Canceling test run. Startprojekt wurde geändert. Testlauf wird abgebrochen. @@ -37687,6 +37226,11 @@ Nur Desktopkits sind erlaubt. Stellen Sie sicher, dass das aktive Kit ein Deskto Project did not parse successfully, cannot build. Das Projekt konnte nicht erfolgreich ausgewertet werden. Es kann nicht erstellt werden. + + Build + Display name for CMakeProjectManager::CMakeBuildStep id. + Erstellen + CMakeProjectManager::CMakeBuildStep @@ -37715,14 +37259,6 @@ Nur Desktopkits sind erlaubt. Stellen Sie sicher, dass das aktive Kit ein Deskto <b>Für dieses Kit konnte keine Build-Konfiguration gefunden werden.</b> - - CMakeProjectManager::Internal::CMakeBuildStepFactory - - Build - Display name for CMakeProjectManager::CMakeBuildStep id. - Build - - CMakeProjectManager::Internal::CMakeGeneratorKitConfigWidget @@ -38033,6 +37569,14 @@ Nur Desktopkits sind erlaubt. Stellen Sie sicher, dass das aktive Kit ein Deskto Utils::DebuggerMainWindow + + Start + Starten + + + Stop + Anhalten + &Views &Ansichten @@ -38049,14 +37593,6 @@ Nur Desktopkits sind erlaubt. Stellen Sie sicher, dass das aktive Kit ein Deskto Editor Editor - - Start - Starten - - - Stop - Anhalten - Debugger::Internal::WatchItem @@ -38104,10 +37640,6 @@ Leer lassen, um das Dateisystem zu durchsuchen. No model loaded. Cannot save. Kein Modell geladen, daher ist sichern nicht möglich. - - Cannot reload model file. - Das Modell kann nicht neu geladen werden. - Could not open "%1" for reading: %2. "%1" konnte nicht gelesen werden: %2. @@ -38169,8 +37701,8 @@ Leer lassen, um das Dateisystem zu durchsuchen. ProjectExplorer::Internal::ClangClToolChainConfigWidget - LLVM: - LLVM: + &Compiler path: + &Compiler-Pfad: @@ -38511,6 +38043,26 @@ Sie werden erhalten. Same Size Gleiche Größe + + Layout Objects + Objekte anordnen + + + Equal Horizontal Distance + Gleicher horizontaler Abstand + + + Equal Vertical Distance + Gleicher vertikaler Abstand + + + Equal Horizontal Space + Gleicher horizontaler Zwischenraum + + + Equal Vertical Space + Gleicher vertikaler Zwischenraum + Add Related Elements Zugehörige Elemente hinzufügen @@ -38553,7 +38105,7 @@ Möchten Sie sie überschreiben? Bild exportieren - Export a Series of Images from %1 (%2x%3 + Export a Series of Images from %1 (%2x%3) Eine Bilderserie aus %1 exportieren (%2x%3) @@ -38917,7 +38469,7 @@ Um eine Variable zu leeren, schreiben Sie nichts als ihren Namen in eine Zeile.< Google Test - Enable or disable grouping of test cases by folder or gtest filter. + Enable or disable grouping of test cases by folder or GTest filter. See also Google Test settings. Gruppierung von Testfällen nach Verzeichnis oder GTest-Filter ein- oder ausschalten. Siehe auch die Einstellungen für Google Test. @@ -39249,13 +38801,6 @@ Siehe auch die Einstellungen für Google Test. Build-Verzeichnis: - - Nim::NimCompilerBuildStepFactory - - Nim Compiler Build Step - Nim-Compiler Build-Schritt - - Nim::NimCompilerCleanStep @@ -39291,17 +38836,6 @@ Siehe auch die Einstellungen für Google Test. Nim - - ProjectExplorer::CustomExecutableDialog - - Could not find the executable, please specify one. - Es konnte keine ausführbare Datei gefunden werden; bitte geben Sie eine an. - - - Executable: - Ausführbare Datei: - - ProjectExplorer::CustomExecutableRunConfiguration @@ -39532,7 +39066,7 @@ Siehe auch die Einstellungen für Google Test. Summe - %1 byte(s) + %n byte(s) Ein Byte %n Bytes @@ -39750,7 +39284,7 @@ Siehe auch die Einstellungen für Google Test. Summe - %1 byte(s) + %n byte(s) Ein Byte %n Bytes @@ -39965,7 +39499,7 @@ Weitere Informationen über GTest-Filter finden Sie in der Dokumenation von Goog Log every signal emission and resulting slot invocations. - Jede Signal-Auslösung und daraus resultierende Slot-Aufrufe aufzeichen. + Jede Signal-Auslösung und daraus resultierende Slot-Aufrufe aufzeichnen. Log signals and slots @@ -40916,10 +40450,6 @@ Fehler: %5 Failed to get process path. Reason: %1. Der Pfad des Prozesses konnte nicht ermittelt werden. Grund: %1. - - Cannot find C++ debugger. - C++-Debugger wurde nicht gefunden. - Failed to start C++ debugger. Der C++-Debugger konnte nicht gestartet werden. @@ -40933,12 +40463,8 @@ Fehler: %5 jdb-Debugging-Ports konnten nicht weitergeleitet werden. Grund: %1. - Failed to start jdb - jdb konnte nicht gestartet werden. - - - Cannot attach jdb to the running application - jdb konnte sich nicht mit der laufenden Anwendung verbinden + Cannot find/copy C++ debug server. + Kann C++-Debug-Server nicht finden/kopieren. Failed to forward QML debugging ports. Reason: %1. @@ -40948,6 +40474,14 @@ Fehler: %5 Failed to start the activity. Reason: %1. Die Aktivität konnte nicht gestartet werden: Grund: %1. + + Failed to start jdb. + jdb konnte nicht gestartet werden. + + + Cannot attach jdb to the running application. Reason: %1. + jdb konnte sich nicht mit der laufenden Anwendung verbinden. Grund: %1. + "%1" died. "%1" beendet. @@ -41545,6 +41079,10 @@ Fehler: %5 Unsupported CDB host system. Nicht unterstütztes CDB-Host-System. + + %1 - Snapshot %2 + %1 - Snapshot %2 + Debugger Debugger @@ -41557,6 +41095,14 @@ Fehler: %5 Debugging starts Debuggen beginnt + + Starting debugger "%1" for ABI "%2"... + Starte Debugger "%1" für ABI "%2"... + + + Debugging has finished + Debuggen beendet + Close Debugging Session Debuggen beenden @@ -42125,6 +41671,10 @@ Ablaufdatum: %3 Tool Chains Toolchains + + ABI + ABI + QbsProjectManager::Internal::DefaultPropertyProvider @@ -42215,9 +41765,9 @@ Ablaufdatum: %3 QmakeProjectManager "%1" is used by qmake, but "%2" is configured in the kit. -Please update your kit or choose a mkspec for qmake that matches your target environment better. +Please update your kit (%3) or choose a mkspec for qmake that matches your target environment better. "%1" wird von qmake verwendet, aber "%2" ist im Kit festgelegt. -Bitte aktualisieren Sie Ihr Kit oder wählen Sie eine mkspec für qmake, die besser zu Ihrer Zielumgebung passt. +Bitte aktualisieren Sie Ihr Kit (%3) oder wählen Sie eine mkspec für qmake, die besser zu Ihrer Zielumgebung passt. @@ -43580,6 +43130,14 @@ Wird auf Zeichen angewendet, sofern keine andere Regel zutrifft. Reserved keywords of the programming language except keywords denoting primitive types. Reservierte Schlüsselworte der Programmiersprache außer Schlüsselworte, die einfache Typen bezeichnen. + + Punctuation + Interpunktionszeichen + + + Punctuation excluding operators. + Interpunktionszeichen mit Ausnahme von Operatoren. + Operator Operator @@ -44081,9 +43639,9 @@ SDK-Manager arbeitet. Der grafische SDK-Manager ist in den installierten SDK-Tools nicht verfügbar (Version %1). Benutzen Sie das Kommandozeilenprogramm "sdkmanager" für erweitertes SDK-Management. - + Review Android SDK package licenses that have not been accepted? Please note that the installation and use of Android SDK packages may fail if respective licenses are not accepted. - + Wollen Sie Android-SDK-Paketlizenzen einsehen, denen Sie noch nicht zugestimmt haben? Bitte bedenken Sie, dass die Installation und die Nutzung von Android SDK-Paketen fehlschlagen können, wenn Sie die jeweiligen Lizenzen nicht akzeptieren. @@ -44261,6 +43819,10 @@ Breche ausstehende Operationen ab... Could not determine which run configuration to choose for running tests Es konnte nicht bestimmt werden, welche Ausführungskonfiguration zum Ausführen von Tests gewählt werden soll + + Remember choice. Cached choices can be reset by switching projects or using the option to clear the cache. + Auswahl speichern. Gespeicherte Entscheidungen können zurückgesetzt werden, indem Sie das Projekt wechseln oder mithilfe der Option zum Löschen des Zwischenspeichers. + Run Configuration: Ausführungskonfiguration: @@ -44496,6 +44058,10 @@ Breche ausstehende Operationen ab... Removing directory %1 Lösche Verzeichnis %1 + + Deploy to device + Deployment auf Gerät + Android::Internal::AndroidPackageInstallationStepWidget @@ -44504,13 +44070,6 @@ Breche ausstehende Operationen ab... Make install - - Android::Internal::AndroidPackageInstallationFactory - - Deploy to device - Deployment auf Gerät - - Autotest::Internal::TestOutputReader @@ -44580,6 +44139,10 @@ Breche ausstehende Operationen ab... CRLF CRLF + + Cppcheck + Cppcheck + CppEditor::CppQuickFixFactory @@ -44805,10 +44368,6 @@ Breche ausstehende Operationen ab... ClangTools::ClangToolsBasicSettings - - Form - Form - Build the project before analysis Projekt vor der Analyse erstellen @@ -44997,23 +44556,20 @@ Die Trace-Daten sind verloren. Die Projektdatei "%1" konnte nicht ausgewertet werden. - - BinEditor::Internal::BinEditorPluginPrivate - - &Undo - &Rückgängig - - - &Redo - &Wiederholen - - ClangCodeModel::Internal::ClangCodeModelPlugin Clang Code Model Clang Codemodell + + Generate Compilation Database + Kompilierungsdatenbank erzeugen + + + Generate Compilation Database for "%1" + Kompilierungsdatenbank für "%1" erzeugen + ClangDiagnosticWidget @@ -45121,8 +44677,12 @@ Die Trace-Daten sind verloren. Soll %1 im %2-Modus ausgeführt werden? - <html><head/><body><p>You are trying to run the tool "%1" on an application in %2 mode. The tool is designed to be used in Debug mode since enabled assertions can reduce the number of false positives.</p><p>Do you want to continue and run the tool in %2 mode?</p></body></html> - <html><head/><body><p>Sie versuchen das Werkzeug "%1" auf eine Applikation im %2 Modus anzuwenden. Das Werkzeug sollte aber im Debugmodus benutzt werden, da eingeschaltete Assertions die Zahl der False-Positives verringern können.</p><p>Wollen Sie fortfahren und das Werkzeug im %2 Modus benutzen?</p></body></html> + You are trying to run the tool "%1" on an application in %2 mode. The tool is designed to be used in Debug mode since enabled assertions can reduce the number of false positives. + Sie versuchen das Werkzeug "%1" auf eine Applikation im %2-Modus anzuwenden. Das Werkzeug sollte im Debug-Modus benutzt werden, da eingeschaltete Assertions die Zahl der False-Positives verringern können. + + + Do you want to continue and run the tool in %1 mode? + Wollen Sie fortfahren und das Werkzeug im %1-Modus benutzen? %1: Can't find clang executable, stop. @@ -45137,8 +44697,16 @@ Die Trace-Daten sind verloren. Führe %1 auf %2 aus - : Failed to create temporary dir, stop. - : Ein temporäres Verzeichnis konnte nicht erstellt werden. Abbruch. + %1: Failed to create temporary dir, stop. + %1: Ein temporäres Verzeichnis konnte nicht erstellt werden. Abbruch. + + + %1 finished: Processed %2 files successfully, %3 failed. + %1 beendet: %2 Dateien erfolgreich verarbeitet, %3 fehlgeschlagen. + + + %1: Not all files could be analyzed. + %1: Nicht alle Dateien konnten analysiert werden. Analyzing @@ -45152,14 +44720,6 @@ Die Trace-Daten sind verloren. Failed to analyze "%1": %2 Analyse von "%1" fehlgeschlagen: %2 - - finished: Processed %1 files successfully, %2 failed. - beendet: %1 Dateien erfolgreich verarbeitet, %2 fehlgeschlagen. - - - : Not all files could be analyzed. - : Nicht alle Dateien konnten analysiert werden. - ClangTools::Internal::ClangToolRunner @@ -45330,13 +44890,6 @@ Möchten Sie den Pfad zu den Quelldateien in die Zwischenablage kopieren?CMake - - Core::HelpManager - - Update Documentation - Dokumentation aktualisieren - - CppTools::ClangDiagnosticConfigsSelectionWidget @@ -45347,10 +44900,6 @@ Möchten Sie den Pfad zu den Quelldateien in die Zwischenablage kopieren?Manage... Verwalten... - - Diagnostic Configurations - Diagnosekonfigurationen - CppTools::TidyChecksTreeModel @@ -45370,56 +44919,6 @@ Möchten Sie den Pfad zu den Quelldateien in die Zwischenablage kopieren?<Keine Symbole> - - GenericProjectManager::Internal::GenericProjectPluginPrivate - - Edit Files... - Dateien bearbeiten... - - - - Git::Internal::BranchUtils - - Checkout - Auschecken - - - Checkout branch? - Branch auschecken? - - - Would you like to delete the tag "%1"? - Möchten Sie das Tag "%1" löschen? - - - Would you like to delete the branch "%1"? - Möchten Sie den Branch "%1" löschen? - - - Would you like to delete the <b>unmerged</b> branch "%1"? - Es wurde mit dem Branch "%1" noch <b>keine</b> Merge-Operation durchgeführt. Möchten Sie ihn dennoch löschen? - - - Delete Tag - Tag löschen - - - Delete Branch - Branch löschen - - - Rename Tag - Tag umbenennen - - - Git Reset - Git Reset - - - Hard reset branch "%1" to "%2"? - Möchten Sie den Branch "%1" auf "%2" zurücksetzen (Modus hard)? - - Git::Internal::GitDiffEditorController @@ -45717,7 +45216,7 @@ Möchten Sie sie überschreiben? Fehler beim Schreiben der Trace-Datei. - Could not re-read events from temporary trace file: %s + Could not re-read events from temporary trace file: %1 Saving failed. Ereignisse konnten nicht erneut aus der temporären Trace-Datei eingelesen werden: %1 Speichern fehlgeschlagen. @@ -45985,4 +45484,909 @@ Speichern fehlgeschlagen. Heob: Fehler im Handshake beim Verbinden zum Prozess (%1). + + ClangFormat::ClangFormatConfigWidget + + Create Clang Format Configuration File + Clang-Format-Konfigurationsdatei erzeugen + + + Apply + Anwenden + + + No .clang-format file for the project. + Keine .clang-format-Datei für das Projekt. + + + Current project has its own .clang-format file and can be configured in Projects > Clang Format. + Das aktuelle Projekt hat seine eigene .clang-format-Datei und kann in Projekte > Clang-Format konfiguriert werden. + + + + ProjectExplorer::Internal::MakeStep + + Override %1: + Überschreibe %1: + + + Make arguments: + Kommandozeilenargumente für make: + + + Parallel jobs: + Parallele Jobs: + + + Targets: + Ziele: + + + Override MAKEFLAGS + MAKEFLAGS überschreiben + + + + LanguageClient::ResponseError + + Error %1 + Fehler %1 + + + + Android::Internal::AndroidBuildApkInnerWidget + + Keystore files (*.keystore *.jks) + Keystore-Dateien (*.keystore *.jks) + + + Select Keystore File + Keystore-Datei auswählen + + + Build Android APK + Android-APK erstellen + + + + Android::Internal::AndroidBuildApkWidget + + Android + Android + + + Create Templates + Vorlagen erstellen + + + Additional Libraries + Zusätzliche Bibliotheken + + + List of extra libraries to include in Android package and load on startup. + Liste aller zusätzlichen Bibliotheken, die in das Paket aufgenommen und beim Start geladen werden. + + + Add... + Hinzufügen... + + + Select library to include in package. + Wählen Sie eine Bibliothek zur Aufnahme in das Paket aus. + + + Remove + Entfernen + + + Remove currently selected library from list. + Ausgewählte Bibliothek aus Liste entfernen. + + + Select additional libraries + Zusätzliche Bibliotheken auswählen + + + Libraries (*.so) + Bibliotheken (*.so) + + + Build Android APK + Android-APK erstellen + + + + Android::AndroidRunEnvironmentAspect + + Clean Environment + Saubere Umgebung + + + + Android::NoApplicationProFilePage + + No application .pro file found in this project. + Die .pro-Datei der Anwendung konnte in diesem Projekt nicht gefunden werden. + + + No Application .pro File + Keine .pro-Datei der Anwendung + + + + Android::ChooseProFilePage + + Select the .pro file for which you want to create the Android template files. + Wählen Sie die .pro-Datei, für die Sie die Android-Vorlagendateien erstellen wollen. + + + .pro file: + .pro-Datei: + + + Select a .pro File + .pro-Datei wählen + + + + Android::ChooseDirectoryPage + + Android package source directory: + Quellverzeichnis des Android-Pakets: + + + The Android package source directory cannot be the same as the project directory. + Das Android-Paket-Quellverzeichnis muss sich vom Projektverzeichnis unterscheiden. + + + Copy the Gradle files to Android directory + Gradle-Dateien ins Android-Verzeichnis kopieren + + + It is highly recommended if you are planning to extend the Java part of your Qt application. + Dies ist sehr zu empfehlen, wenn sie den Java-Teil Ihrer Qt-Anwendung erweitern wollen. + + + Select the Android package source directory. + +The files in the Android package source directory are copied to the build directory's Android directory and the default files are overwritten. + Wählen Sie das Quellverzeichnis des Android-Pakets aus. + +Die Dateien aus dem Quellverzeichnis des Android-Pakets werden in das Verzeichnis "Android" im Build-Verzeichnis kopiert und die Vorgabedateien überschrieben. + + + The Android template files will be created in the ANDROID_PACKAGE_SOURCE_DIR set in the .pro file. + Die Android-Vorlagendateien werden im in der .pro-Datei angegebenen ANDROID_PACKAGE_SOURCE_DIR angelegt. + + + + Android::CreateAndroidManifestWizard + + Create Android Template Files Wizard + Assistent zum Erzeugen von Android-Vorlagendateien + + + Overwrite %1 file + Überschreibe Datei %1 + + + Overwrite existing "%1"? + Soll "%1" überschrieben werden? + + + File Creation Error + Fehler beim Erstellen der Datei + + + Could not copy file "%1" to "%2". + Die Datei "%1" konnte nicht nach "%2" kopiert werden. + + + Project File not Updated + Projekt-Datei nicht aktualisiert + + + Could not update the project file %1. + Die Projekt-Datei %1 konnte nicht aktualisiert werden. + + + + ClangCodeModel::ClangAssistProposalItem + + Requires changing "%1" to "%2" + "%1" muss durch "%2" ersetzt werden + + + + ClangFormat::Internal::ClangFormatOptionsPage + + Clang Format + Clang Format + + + + ClangFormat::ClangFormatPlugin + + Clang Format + Clang Format + + + + CodePaster::PasteCodeDotXyzProtocol + + %1: %2 + %1: %2 + + + + Cppcheck::Internal::CppcheckOptionsPage + + Cppcheck + Cppcheck + + + + Cppcheck::Internal::CppcheckRunner + + Cppcheck failed to start: "%1". + Cppcheck konnte nicht gestartet werden: "%1". + + + + Cppcheck::Internal::CppcheckTool + + Cppcheck started: "%1". + Cppcheck gestartet: "%1". + + + Cppcheck finished. + Cppcheck beendet. + + + + Debugger::Internal::BreakpointManager + + Debuggee + Untersuchtes Programm + + + Function + Funktion + + + File + Datei + + + Line + Zeile + + + Address + Adresse + + + Condition + Bedingung + + + Ignore + Ignorieren + + + Threads + Threads + + + Add Breakpoint + Haltepunkt setzen + + + Add Breakpoint... + Haltepunkt setzen... + + + Delete Selected Breakpoints + Ausgewählte Haltepunkte löschen + + + Edit Selected Breakpoints... + Ausgewählte Haltepunkte bearbeiten... + + + Disable Selected Breakpoints + Ausgewählte Haltepunkte deaktivieren + + + Enable Selected Breakpoints + Ausgewählte Haltepunkte aktivieren + + + Disable Breakpoint + Haltepunkt deaktivieren + + + Enable Breakpoint + Haltepunkt aktivieren + + + Delete All Breakpoints + Alle Haltepunkte löschen + + + Delete Breakpoints of "%1" + Haltepunkte in Datei "%1" löschen + + + Delete Breakpoints of File + Haltepunkte in Datei löschen + + + Remove All Breakpoints + Alle Haltepunkte löschen + + + Are you sure you want to remove all breakpoints from all files in the current session? + Möchten Sie wirklich alle Haltepunkte aus allen Dateien der aktuellen Sitzung löschen? + + + + Debugger::Internal::EngineManager + + Name + Name + + + File + Datei + + + Debugger Preset + Debugger-Voreinstellung + + + Create Snapshot + Snapshot erzeugen + + + Abort Debugger + Debugger abbrechen + + + + Debugger::Internal::GlobalLogWindow + + Global Debugger &Log + Globales Debugger-&Log + + + + Git::Internal::BranchView + + Include Old Entries + Alte Einträge einschließen + + + Include Tags + Tags anzeigen + + + Refresh + Aktualisieren + + + Include branches and tags that have not been active for %n days. + + Branches und Tags einschließen, die seit einem Tag nicht benutzt wurden. + Branches und Tags einschließen, die seit %n Tagen nicht benutzt wurden. + + + + <No repository> + <Kein Repository> + + + Create Git Repository... + Git-Repository erzeugen... + + + Add Branch... + Branch hinzufügen... + + + Add... + Hinzufügen... + + + Fetch + Fetch + + + Manage Remotes... + Remotes verwalten... + + + Remove... + Entfernen... + + + Rename... + Umbenennen... + + + Checkout + Auschecken + + + Diff + Diff + + + Log + Log + + + Reset + Zurücksetzen + + + Merge (Fast-Forward) + Merge (Fast-Forward) + + + Merge (No Fast-Forward) + Merge (kein Fast-Forward) + + + Merge + Merge + + + Rebase + Rebase + + + Cherry Pick + Cherry-Pick + + + Track + Folgen + + + Checkout branch? + Branch auschecken? + + + Would you like to delete the tag "%1"? + Möchten Sie das Tag "%1" löschen? + + + Would you like to delete the branch "%1"? + Möchten Sie den Branch "%1" löschen? + + + Would you like to delete the <b>unmerged</b> branch "%1"? + Es wurde mit dem Branch "%1" noch <b>keine</b> Merge-Operation durchgeführt. Möchten Sie ihn dennoch löschen? + + + Delete Tag + Tag löschen + + + Delete Branch + Branch löschen + + + Rename Tag + Tag umbenennen + + + Git Reset + Git Reset + + + Hard reset branch "%1" to "%2"? + Möchten Sie den Branch "%1" auf "%2" zurücksetzen (Modus hard)? + + + + Git::Internal::BranchViewFactory + + Git Branches + Git Branches + + + Filter + Filter + + + + Help::Internal::HelpManager + + Update Documentation + Dokumentation aktualisieren + + + + LanguageClient::BaseClient + + Invalid parameter in "%1": %2 + Ungültiger Parameter in "%1": %2 + + + Language Server "%1" Initialize Error + Fehler bei Initialisierung von Language Server "%1" + + + Initialize error: + Fehler bei Initialisierung: + + + No initialize result. + Initialisierung ohne Ergebnis. + + + Initialize result is not valid: + Ergebnis der Initialisierung ist ungültig: + + + Cannot handle content of type: %1 + Kann Inhalt des Typs "%1" nicht verwenden. + + + + LanguageClient::StdIOClient + + Cannot send data to unstarted server %1 + Kann keine Daten an den nicht gestarteten Server %1 schicken + + + Crashed with exit code %1: %2 + Mit dem Rückgabewert %1 abgestürzt: %2 + + + + LanguageClient + + Language Client + Language Client + + + + LanguageClient::LanguageClientManager + + Unexpectedly finished. Restarting in %1 seconds. + Unerwartet beendet. Neustart in %1 Sekunden. + + + + LanguageClient::BaseSettingsWidget + + Name: + Name: + + + Language: + Sprache: + + + Set MIME Types... + MIME-Typen einstellen... + + + File pattern + Suchmuster für Dateinamen + + + + LanguageClient::StdIOSettingsWidget + + Executable: + Ausführbare Datei: + + + Arguments: + Argumente: + + + + Nim::NimCompilerBuildStep + + Nim Compiler Build Step + Nim-Compiler Build-Schritt + + + + ProjectExplorer::MakeStep + + Make + Make + + + Make command missing. Specify Make command in step configuration. + Make-Befehl fehlt. Geben Sie den Make-Befehl in der Schrittkonfiguration an. + + + + ProjectExplorer::MakeStepConfigWidget + + <code>MAKEFLAGS</code> specifies parallel jobs. Check "%1" to override. + <code>MAKEFLAGS</code> legt parallele Jobs fest. Wählen Sie "%1", um dies zu überstimmen. + + + Make: + Make: + + + Override %1: + Statt %1 verwenden: + + + <b>Make:</b> %1 + <b>Make:</b> %1 + + + <b>Make:</b> No build configuration. + <b>Make:</b> Keine Build-Konfiguration. + + + <b>Make:</b> %1 not found in the environment. + <b>Make:</b> %1 konnte in der Umgebung nicht gefunden werden. + + + + ProjectExplorer::Internal::ClangClToolChainFactory + + clang-cl + clang-cl + + + + QmakeProjectManager::QmakeMakeStep + + Cannot find Makefile. Check your build settings. + Die Makefile-Datei konnte nicht gefunden werden. Bitte überprüfen Sie die Einstellungen zur Erstellung. + + + + RemoteLinux::RemoteLinuxCustomCommandDeploymentStep + + Command line: + Kommandozeile: + + + Run custom remote command + Benutzerdefiniertes entferntes Kommando ausführen + + + + Valgrind::Internal::Visualization + + All functions with an inclusive cost ratio higher than %1 (%2 are hidden) + Alle Funktionen mit einem einschließlichen Kostenfaktor größer als %1 (%2 nicht gezeigt) + + + + VcsBase::VcsSubmitEditorFactory + + &Undo + &Rückgängig + + + &Redo + &Wiederholen + + + Diff &Selected Files + Diff für &Auswahl + + + + BaseMessage + + Unexpected header line "%1". + Unerwartete Header-Zeile "%1". + + + Cannot decode content with "%1". Falling back to "%2". + Zeichensatz "%1" kann nicht dekodiert werden. Verwende stattdessen "%2". + + + Expected an integer in "%1", but got "%2". + Statt eines Ganzzahlwerts wurde "%2" in "%1" gefunden. + + + Unexpected header field "%1" in "%2". + Unerwartetes Header-Feld "%1" in "%2". + + + + LanguageServerProtocol::JsonObject + + Expected type %1 but value contained %2 + Der Wert enthielt %2 statt des erwarteten Typs %1 + + + + LanguageServerProtocol::Notification + + No parameters in "%1". + Keine Parameter in "%1". + + + + LanguageServerProtocol::Request + + No ID set in "%1". + In "%1" ist keine ID angegeben. + + + + LanguageServerProtocol::MarkedString + + MarkedString should be either MarkedLanguageString, MarkupContent, or QList<MarkedLanguageString>. + MarkedString sollte entweder MarkedLanguageString, MarkupContent oder QList<MarkedLanguageString> sein. + + + DocumentFormattingProperty should be either bool, double, or QString. + "DocumentFormattingProperty" sollte entweder bool, double oder QString sein. + + + + LanguageServerProtocoll::MarkupOrString + + Expected a string or MarkupContent in MarkupOrString. + In MarkupOrString wurde eine Zeichenkette oder MarkupContent erwartet. + + + + JsonRpcMessageHandler + + Could not parse JSON message "%1". + Die JSON-Nachricht konnte nicht ausgewertet werden: "%1". + + + Expected a JSON object, but got a JSON "%1". + Statt eines erwarteten JSON-Objekts wurde JSON-"%1" gefunden. + + + + BinEditor::Internal::BinEditorPlugin + + &Undo + &Rückgängig + + + &Redo + &Wiederholen + + + + CppcheckOptionsPage + + Warnings + Warnungen + + + Style + Stil + + + Performance + Leistung + + + Portability + Portabilität + + + Information + Information + + + Unused functions + Nicht aufgerufene Funktionen + + + Missing include + Fehlende Includes + + + Inconclusive errors + Nicht schlüssig erscheinende Fehler + + + Check all define combinations + Alle Kombinationen von Defines prüfen + + + Show raw output + Unformatierte Ausgabe anzeigen + + + Add include paths + Include-Pfade hinzufügen + + + Calculate additional arguments + Zusätzliche Argumente berechnen + + + Disables multithreaded check. + Deaktiviert Prüfung mit mehreren Threads. + + + Comma-separated wildcards of full file paths. Files still can be checked if others include them. + Kommaseparierte Platzhalter vollständiger Dateipfade. Dateien können noch geprüft werden, wenn andere sie einschließen. + + + Can find missing includes but makes checking slower. Use only when needed. + Kann fehlende Includes finden, verlangsamt aber die Prüfung. Benutzen Sie dies nur, wenn es nötig ist. + + + Like C++ standard and language. + Wie C++-Standard und Sprache. + + + Binary: + Binär: + + + Checks: + Prüfungen: + + + Custom arguments: + Benutzerdefinierte Argumente: + + + Ignored file patterns: + Ausgeschlossene Datei-Suchmuster: + + + + GenericProjectManager::Internal::GenericProjectPlugin + + Edit Files... + Dateien bearbeiten... + + + + LanguageClientSettingsPage + + &Add + Hinzu&fügen + + + &Delete + &Löschen + + + General + Allgemein + + + + MimeTypeDialog + + Select MIME Types + MIME-Typen auswählen + + + Filter + Filter + + + + CustomExecutableDialog + + Could not find the executable, please specify one. + Es konnte keine ausführbare Datei gefunden werden; bitte geben Sie eine an. + + + Executable: + Ausführbare Datei: + + diff --git a/share/qtcreator/translations/qtcreator_ru.ts b/share/qtcreator/translations/qtcreator_ru.ts index 7388cfd817d..c2dc93dd48a 100644 --- a/share/qtcreator/translations/qtcreator_ru.ts +++ b/share/qtcreator/translations/qtcreator_ru.ts @@ -246,8 +246,8 @@ The minimum API level required by the kit is %1. Отладчик Android для %1 - Android for %1 (GCC %2, %3) - Android для %1 (GCC %2, Qt %3) + Android for %1 (Clang %2) + Android для %1 (Clang %2) @@ -1406,37 +1406,16 @@ Cancelling pending operations... Missing Android SDK packages В Android SDK недостаёт пакетов - - Cannot create kits for all architectures. - Невозможно создать комплекты для всех архитектур. - - - Qt versions are missing for the following architectures: -%1 - -To add the Qt version, select Options > Build & Run > Qt Versions. - Отсутствуют профили Qt для следующих архитектур: -%1 - -Для добавления профиля зайдите в Параметры > Сборка и запуск > Профили Qt. - (SDK Version: %1, NDK Version: %2) (Версия SDK: %1, Версия NDK: %2) - - Android::Internal::AndroidToolChainConfigWidget - - NDK Root: - Корень NDK: - - Android::Internal::AndroidToolChainFactory - Android GCC - Android GCC + Android Clang + Android Clang @@ -6992,6 +6971,13 @@ p, li { white-space: pre-wrap; } Определяет, получает ли выпадающий список фокус при нажатии или нет. + + CompilationDatabaseProject + + No matching toolchain found, use the default. + Не обнаружен подходящий инструментарий, используется стандартный. + + ContentWindow @@ -9680,6 +9666,10 @@ Do you want to kill it? Будет: "При стравнении имён файлов: учитывать регистр" При сравнении имён файлов: + + Command line arguments used for "%1". + Параметры командной строки для «%1». + Command used for reverting diff chunks. Команда, используемая для отката фрагментов diff. @@ -9728,10 +9718,6 @@ Do you want to kill it? Minimum number of open documents that should be kept in memory. Increasing this number will lead to greater resource usage when not manually closing documents. Минимальное число открытых документов, которые необходимо хранить в памяти. При увеличении этого числа будет расти и потребление ресурсов, если не закрывать документы вручную. - - Command line arguments used for "Open Terminal Here". - Параметры командной строки для «Открыть терминале в этом каталоге». - Command line arguments used for "Run in terminal". Параметры командной строки для «Запустить в терминале». @@ -13370,6 +13356,14 @@ Setting breakpoints by file name and line number may fail. Debugger::Internal::DebuggerEnginePrivate + + Continue %1 + Продолжить %1 + + + Interrupt %1 + Прервать %1 + Debugger finished. Отладчик завершился. @@ -13697,10 +13691,6 @@ Affected are breakpoints %1 Abort Debugging Прервать отладку - - Aborts debugging and resets the debugger to the initial state. - Прервать отладку и сбросить отладчик в исходное состояние. - Step Over Перейти через @@ -13761,18 +13751,6 @@ Affected are breakpoints %1 Start debugging of "%1" Запуск отладки «%1» - - Start "%1" and break at function "main" - Запускает «%1» и останавливается на функции «main» - - - Interrupt %1 - Прервать %1 - - - Continue %1 - Продолжить %1 - Process Already Under Debugger Control Процесс уже работает под контролем отладчика @@ -22744,6 +22722,10 @@ Error: %5 Unexpectedly finished. Restarting in %1 seconds. Неожиданное завершение. Перезапуск через %1 секунд. + + Unexpectedly finished. + Неожиданное завершение. + LanguageClient::ResponseError diff --git a/src/libs/clangsupport/filepathcache.h b/src/libs/clangsupport/filepathcache.h index d0c8a529dff..bdd925a79c8 100644 --- a/src/libs/clangsupport/filepathcache.h +++ b/src/libs/clangsupport/filepathcache.h @@ -133,7 +133,7 @@ public: return m_filePathStorage.fetchSourceId(directoryId, fileName); }); - return {directoryId, fileNameId}; + return fileNameId; } FilePath filePath(FilePathId filePathId) const @@ -141,20 +141,20 @@ public: if (Q_UNLIKELY(!filePathId.isValid())) throw NoFilePathForInvalidFilePathId(); - auto fetchFilePath = [&] (int id) { return m_filePathStorage.fetchDirectoryPath(id); }; - - Utils::PathString directoryPath = m_directoryPathCache.string(filePathId.directoryId, - fetchFilePath); - - - auto fetchSoureName = [&] (int id) { - return FileNameEntry{m_filePathStorage.fetchSourceName(id), filePathId.directoryId}; + auto fetchSoureNameAndDirectoryId = [&] (int id) { + auto entry = m_filePathStorage.fetchSourceNameAndDirectoryId(id); + return FileNameEntry{entry.sourceName, entry.directoryId}; }; - Utils::SmallString fileName = m_fileNameCache.string(filePathId.filePathId, - fetchSoureName); + FileNameEntry entry = m_fileNameCache.string(filePathId.filePathId, + fetchSoureNameAndDirectoryId); - return FilePath{directoryPath, fileName}; + auto fetchDirectoryPath = [&] (int id) { return m_filePathStorage.fetchDirectoryPath(id); }; + + Utils::PathString directoryPath = m_directoryPathCache.string(entry.directoryId, + fetchDirectoryPath); + + return FilePath{directoryPath, entry.fileName}; } private: diff --git a/src/libs/clangsupport/filepathid.cpp b/src/libs/clangsupport/filepathid.cpp index 7d059e0ea27..2491bc02d07 100644 --- a/src/libs/clangsupport/filepathid.cpp +++ b/src/libs/clangsupport/filepathid.cpp @@ -31,7 +31,7 @@ namespace ClangBackEnd { QDebug operator<<(QDebug debug, const FilePathId &filePathId) { - debug.nospace() << "(" << filePathId.directoryId << ", " << filePathId.filePathId << ")"; + debug.nospace() << "(" << filePathId.filePathId << ")"; return debug; } diff --git a/src/libs/clangsupport/filepathid.h b/src/libs/clangsupport/filepathid.h index 38762bd44bf..88426d93fcb 100644 --- a/src/libs/clangsupport/filepathid.h +++ b/src/libs/clangsupport/filepathid.h @@ -39,14 +39,14 @@ class FilePathId { public: constexpr FilePathId() = default; - FilePathId(int directoryId, int filePathId) - : directoryId(directoryId), - filePathId(filePathId) + + FilePathId(int filePathId) + : filePathId(filePathId) {} bool isValid() const { - return directoryId >= 0 && filePathId >= 0; + return filePathId >= 0; } friend bool operator==(FilePathId first, FilePathId second) @@ -66,7 +66,6 @@ public: friend QDataStream &operator<<(QDataStream &out, const FilePathId &filePathId) { - out << filePathId.directoryId; out << filePathId.filePathId; return out; @@ -74,14 +73,12 @@ public: friend QDataStream &operator>>(QDataStream &in, FilePathId &filePathId) { - in >> filePathId.directoryId; in >> filePathId.filePathId; return in; } public: - int directoryId = -1; int filePathId = -1; }; @@ -97,11 +94,7 @@ template<> struct hash using result_type = std::size_t; result_type operator()(const argument_type& filePathId) const { - long long hash = filePathId.directoryId; - hash = hash << 32; - hash += filePathId.filePathId; - - return std::hash{}(hash); + return std::hash{}(filePathId.filePathId); } }; diff --git a/src/libs/clangsupport/filepathstorage.h b/src/libs/clangsupport/filepathstorage.h index 69388a45d24..5917504dbf3 100644 --- a/src/libs/clangsupport/filepathstorage.h +++ b/src/libs/clangsupport/filepathstorage.h @@ -165,14 +165,14 @@ public: return statement.template value(directoryId, sourceName); } - Utils::SmallString fetchSourceName(int sourceId) + Sources::SourceNameAndDirectoryId fetchSourceNameAndDirectoryId(int sourceId) { try { Sqlite::DeferredTransaction transaction{m_statementFactory.database}; - ReadStatement &statement = m_statementFactory.selectSourceNameFromSourcesBySourceId; + ReadStatement &statement = m_statementFactory.selectSourceNameAndDirectoryIdFromSourcesBySourceId; - auto optionalSourceName = statement.template value(sourceId); + auto optionalSourceName = statement.template value(sourceId); if (!optionalSourceName) throw SourceNameIdDoesNotExists(); @@ -181,7 +181,7 @@ public: return optionalSourceName.value(); } catch (const Sqlite::StatementIsBusy &) { - return fetchSourceName(sourceId); + return fetchSourceNameAndDirectoryId(sourceId); } } diff --git a/src/libs/clangsupport/filepathstoragesources.h b/src/libs/clangsupport/filepathstoragesources.h index 7561aca908e..e76cb3b2cf6 100644 --- a/src/libs/clangsupport/filepathstoragesources.h +++ b/src/libs/clangsupport/filepathstoragesources.h @@ -69,6 +69,17 @@ public: int sourceId; Utils::PathString sourceName; }; + +class SourceNameAndDirectoryId +{ +public: + SourceNameAndDirectoryId(Utils::SmallStringView sourceName, int directoryId) + : sourceName(sourceName), directoryId(directoryId) + {} + + Utils::SmallString sourceName; + int directoryId = -1; +}; } // namespace ClangBackEnd } // namespace ClangBackEnd diff --git a/src/libs/clangsupport/filepathstoragesqlitestatementfactory.h b/src/libs/clangsupport/filepathstoragesqlitestatementfactory.h index 71e2c3e7734..dbf80717753 100644 --- a/src/libs/clangsupport/filepathstoragesqlitestatementfactory.h +++ b/src/libs/clangsupport/filepathstoragesqlitestatementfactory.h @@ -65,8 +65,8 @@ public: "SELECT sourceId FROM sources WHERE directoryId = ? AND sourceName = ?", database }; - ReadStatement selectSourceNameFromSourcesBySourceId{ - "SELECT sourceName FROM sources WHERE sourceId = ?", + ReadStatement selectSourceNameAndDirectoryIdFromSourcesBySourceId{ + "SELECT sourceName, directoryId FROM sources WHERE sourceId = ?", database }; WriteStatement insertIntoSources{ diff --git a/src/libs/clangsupport/refactoringdatabaseinitializer.h b/src/libs/clangsupport/refactoringdatabaseinitializer.h index ab15cf81e0f..cba56475c82 100644 --- a/src/libs/clangsupport/refactoringdatabaseinitializer.h +++ b/src/libs/clangsupport/refactoringdatabaseinitializer.h @@ -99,7 +99,6 @@ public: table.addColumn("sourceId", Sqlite::ColumnType::Integer, Sqlite::Contraint::PrimaryKey); const Sqlite::Column &directoryIdColumn = table.addColumn("directoryId", Sqlite::ColumnType::Integer); const Sqlite::Column &sourceNameColumn = table.addColumn("sourceName", Sqlite::ColumnType::Text); - table.addColumn("sourceType", Sqlite::ColumnType::Integer); table.addUniqueIndex({directoryIdColumn, sourceNameColumn}); table.initialize(database); @@ -139,6 +138,7 @@ public: table.setName("projectPartsSources"); const Sqlite::Column &projectPartIdColumn = table.addColumn("projectPartId", Sqlite::ColumnType::Integer); const Sqlite::Column &sourceIdColumn = table.addColumn("sourceId", Sqlite::ColumnType::Integer); + table.addColumn("sourceType", Sqlite::ColumnType::Integer); table.addUniqueIndex({sourceIdColumn, projectPartIdColumn}); table.addIndex({projectPartIdColumn}); @@ -167,6 +167,7 @@ public: table.addColumn("sourceId", Sqlite::ColumnType::Integer, Sqlite::Contraint::PrimaryKey); table.addColumn("size", Sqlite::ColumnType::Integer); table.addColumn("lastModified", Sqlite::ColumnType::Integer); + table.addColumn("buildDependencyTimeStamp", Sqlite::ColumnType::Integer); table.addColumn("isInPrecompiledHeader", Sqlite::ColumnType::Integer); table.initialize(database); } diff --git a/src/plugins/android/androidtoolchain.cpp b/src/plugins/android/androidtoolchain.cpp index 8bd4dd0cea8..f1213959bd7 100644 --- a/src/plugins/android/androidtoolchain.cpp +++ b/src/plugins/android/androidtoolchain.cpp @@ -38,7 +38,7 @@ namespace { -Q_LOGGING_CATEGORY(androidTCLog, "qtc.android.toolchainmanagement"); +Q_LOGGING_CATEGORY(androidTCLog, "qtc.android.toolchainmanagement", QtWarningMsg); } namespace Android { diff --git a/src/plugins/autotest/gtest/gtestoutputreader.cpp b/src/plugins/autotest/gtest/gtestoutputreader.cpp index 8087639d3a3..d42390ef8dc 100644 --- a/src/plugins/autotest/gtest/gtestoutputreader.cpp +++ b/src/plugins/autotest/gtest/gtestoutputreader.cpp @@ -62,7 +62,7 @@ GTestOutputReader::GTestOutputReader(const QFutureInterface &futu } } -void GTestOutputReader::processOutput(const QByteArray &outputLine) +void GTestOutputReader::processOutputLine(const QByteArray &outputLineWithNewLine) { static QRegExp newTestStarts("^\\[-{10}\\] \\d+ tests? from (.*)$"); static QRegExp testEnds("^\\[-{10}\\] \\d+ tests? from (.*) \\((.*)\\)$"); @@ -74,7 +74,7 @@ void GTestOutputReader::processOutput(const QByteArray &outputLine) static QRegExp errorLocation("^(.*)\\((\\d+)\\): error:.*$"); static QRegExp iterations("^Repeating all tests \\(iteration (\\d+)\\) \\. \\. \\.$"); - const QString line = QString::fromLatin1(outputLine); + const QString line = QString::fromLatin1(chopLineBreak(outputLineWithNewLine)); if (line.trimmed().isEmpty()) return; diff --git a/src/plugins/autotest/gtest/gtestoutputreader.h b/src/plugins/autotest/gtest/gtestoutputreader.h index fd60b9fbedd..8f29ae73e17 100644 --- a/src/plugins/autotest/gtest/gtestoutputreader.h +++ b/src/plugins/autotest/gtest/gtestoutputreader.h @@ -44,7 +44,7 @@ public: QProcess *testApplication, const QString &buildDirectory, const QString &projectFile); protected: - void processOutput(const QByteArray &outputLine) override; + void processOutputLine(const QByteArray &outputLineWithNewLine) override; TestResultPtr createDefaultResult() const override; private: diff --git a/src/plugins/autotest/qtest/qttestoutputreader.cpp b/src/plugins/autotest/qtest/qttestoutputreader.cpp index 864d2190973..de46727b09e 100644 --- a/src/plugins/autotest/qtest/qttestoutputreader.cpp +++ b/src/plugins/autotest/qtest/qttestoutputreader.cpp @@ -139,7 +139,7 @@ QtTestOutputReader::QtTestOutputReader(const QFutureInterface &fu { } -void QtTestOutputReader::processOutput(const QByteArray &outputLine) +void QtTestOutputReader::processOutputLine(const QByteArray &outputLine) { static const QByteArray qmlDebug = "QML Debugger: Waiting for connection on port"; switch (m_mode) { @@ -329,7 +329,7 @@ static QStringList extractFunctionInformation(const QString &testClassName, return result; } -void QtTestOutputReader::processPlainTextOutput(const QByteArray &outputLine) +void QtTestOutputReader::processPlainTextOutput(const QByteArray &outputLineWithNewLine) { static QRegExp start("^[*]{9} Start testing of (.*) [*]{9}$"); static QRegExp config("^Config: Using QtTest library (.*), (Qt (\\d+(\\.\\d+){2}) \\(.*\\))$"); @@ -346,7 +346,7 @@ void QtTestOutputReader::processPlainTextOutput(const QByteArray &outputLine) if (m_futureInterface.isCanceled()) return; - const QString &line = QString::fromLatin1(outputLine); + const QString line = QString::fromLatin1(chopLineBreak(outputLineWithNewLine)); if (result.exactMatch(line)) { processResultOutput(result.cap(1).toLower().trimmed(), result.cap(2)); diff --git a/src/plugins/autotest/qtest/qttestoutputreader.h b/src/plugins/autotest/qtest/qttestoutputreader.h index 3487cce066c..89da00a8b91 100644 --- a/src/plugins/autotest/qtest/qttestoutputreader.h +++ b/src/plugins/autotest/qtest/qttestoutputreader.h @@ -51,12 +51,12 @@ public: QProcess *testApplication, const QString &buildDirectory, const QString &projectFile, OutputMode mode, TestType type); protected: - void processOutput(const QByteArray &outputLine) override; + void processOutputLine(const QByteArray &outputLine) override; TestResultPtr createDefaultResult() const override; private: - void processXMLOutput(const QByteArray &outputLine); - void processPlainTextOutput(const QByteArray &outputLine); + void processXMLOutput(const QByteArray &outputLineWithNewline); + void processPlainTextOutput(const QByteArray &outputLineWithNewline); void processResultOutput(const QString &result, const QString &message); void processLocationOutput(const QString &fileWithLine); void processSummaryFinishOutput(); diff --git a/src/plugins/autotest/testoutputreader.cpp b/src/plugins/autotest/testoutputreader.cpp index f888f7b34c0..ff96d10e793 100644 --- a/src/plugins/autotest/testoutputreader.cpp +++ b/src/plugins/autotest/testoutputreader.cpp @@ -27,6 +27,8 @@ #include "testresult.h" #include "testresultspane.h" +#include + #include #include @@ -44,27 +46,28 @@ TestOutputReader::TestOutputReader(const QFutureInterface &future connect(m_testApplication, &QProcess::readyRead, this, [this] () { while (m_testApplication->canReadLine()) { - QByteArray output = m_testApplication->readLine(); - output.chop(1); // remove the newline from the output - if (output.endsWith('\r')) - output.chop(1); - - emit newOutputAvailable(output); + const QByteArray output = m_testApplication->readLine(); processOutput(output); } }); connect(m_testApplication, &QProcess::readyReadStandardError, this, [this] () { const QByteArray output = m_testApplication->readAllStandardError(); - emit newOutputAvailable(output); processStdError(output); }); } } -void TestOutputReader::processStdError(const QByteArray &output) +void TestOutputReader::processOutput(const QByteArray &output) { - qWarning() << "AutoTest.Run: Ignored plain output:" << output; + processOutputLine(output); + emit newOutputAvailable(output); +} + +void TestOutputReader::processStdError(const QByteArray &outputLineWithNewLine) +{ + qWarning() << "AutoTest.Run: Ignored plain output:" << outputLineWithNewLine; + emit newOutputAvailable(outputLineWithNewLine); } void TestOutputReader::reportCrash() @@ -83,6 +86,16 @@ void TestOutputReader::createAndReportResult(const QString &message, Result::Typ reportResult(result); } +QByteArray TestOutputReader::chopLineBreak(const QByteArray &original) +{ + QTC_ASSERT(original.endsWith('\n'), return original); + QByteArray output(original); + output.chop(1); // remove the newline from the output + if (output.endsWith('\r')) + output.chop(1); + return output; +} + void TestOutputReader::reportResult(const TestResultPtr &result) { m_futureInterface.reportResult(result); diff --git a/src/plugins/autotest/testoutputreader.h b/src/plugins/autotest/testoutputreader.h index 225ad3de33a..7c1f7d0f137 100644 --- a/src/plugins/autotest/testoutputreader.h +++ b/src/plugins/autotest/testoutputreader.h @@ -42,17 +42,20 @@ public: TestOutputReader(const QFutureInterface &futureInterface, QProcess *testApplication, const QString &buildDirectory); - virtual void processOutput(const QByteArray &outputLine) = 0; - virtual void processStdError(const QByteArray &output); + void processOutput(const QByteArray &output); + virtual void processStdError(const QByteArray &outputLineWithNewLine); void reportCrash(); void createAndReportResult(const QString &message, Result::Type type); bool hadValidOutput() const { return m_hadValidOutput; } void setId(const QString &id) { m_id = id; } QString id() const { return m_id; } + static QByteArray chopLineBreak(const QByteArray &original); + signals: - void newOutputAvailable(const QByteArray &output); + void newOutputAvailable(const QByteArray &outputWithLineBreak); protected: + virtual void processOutputLine(const QByteArray &outputLineWithNewLine) = 0; virtual TestResultPtr createDefaultResult() const = 0; void reportResult(const TestResultPtr &result); diff --git a/src/plugins/autotest/testresultspane.cpp b/src/plugins/autotest/testresultspane.cpp index 277109b600a..c67cd15ae56 100644 --- a/src/plugins/autotest/testresultspane.cpp +++ b/src/plugins/autotest/testresultspane.cpp @@ -33,6 +33,7 @@ #include "testtreemodel.h" #include "testcodeparser.h" #include "testeditormark.h" +#include "testoutputreader.h" #include #include @@ -236,7 +237,7 @@ void TestResultsPane::addTestResult(const TestResultPtr &result) void TestResultsPane::addOutput(const QByteArray &output) { - m_textOutput->appendPlainText(QString::fromLatin1(output)); + m_textOutput->appendPlainText(QString::fromLatin1(TestOutputReader::chopLineBreak(output))); } QWidget *TestResultsPane::outputWidget(QWidget *parent) diff --git a/src/plugins/autotest/testresultspane.h b/src/plugins/autotest/testresultspane.h index 7dcd1f94be7..862270534c3 100644 --- a/src/plugins/autotest/testresultspane.h +++ b/src/plugins/autotest/testresultspane.h @@ -92,7 +92,7 @@ public: void goToPrev() override; void addTestResult(const TestResultPtr &result); - void addOutput(const QByteArray &output); + void addOutput(const QByteArray &outputWithNewLine); void showTestResult(const QModelIndex &index); private: diff --git a/src/plugins/autotest/testrunner.cpp b/src/plugins/autotest/testrunner.cpp index 78780f4a03f..6792b96cb38 100644 --- a/src/plugins/autotest/testrunner.cpp +++ b/src/plugins/autotest/testrunner.cpp @@ -471,25 +471,35 @@ void TestRunner::runTests() static void processOutput(TestOutputReader *outputreader, const QString &msg, Utils::OutputFormat format) { + QByteArray message = msg.toUtf8(); switch (format) { case Utils::OutputFormat::StdOutFormatSameLine: case Utils::OutputFormat::DebugFormat: { - static const QString gdbSpecialOut = "Qt: gdb: -nograb added to command-line options.\n" - "\t Use the -dograb option to enforce grabbing."; - int start = msg.startsWith(gdbSpecialOut) ? gdbSpecialOut.length() + 1 : 0; + static const QByteArray gdbSpecialOut = "Qt: gdb: -nograb added to command-line options.\n" + "\t Use the -dograb option to enforce grabbing."; + int start = message.startsWith(gdbSpecialOut) ? gdbSpecialOut.length() + 1 : 0; if (start) { - int maxIndex = msg.length() - 1; + int maxIndex = message.length() - 1; while (start < maxIndex && msg.at(start + 1) == '\n') ++start; - if (start >= msg.length()) // we cut out the whole message + if (start >= message.length()) // we cut out the whole message break; } - for (const QString &line : msg.mid(start).split('\n')) - outputreader->processOutput(line.toUtf8()); + + int index = message.indexOf('\n', start); + while (index != -1) { + const QByteArray line = message.mid(start, index - start + 1); + outputreader->processOutput(line); + start = index + 1; + index = message.indexOf('\n', start); + } + if (!QTC_GUARD(start == message.length())) // paranoia + outputreader->processOutput(message.mid(start).append('\n')); + break; } case Utils::OutputFormat::StdErrFormatSameLine: - outputreader->processStdError(msg.toUtf8()); + outputreader->processStdError(message); break; default: break; // channels we're not caring about diff --git a/src/plugins/clangcodemodel/clangdiagnostictooltipwidget.cpp b/src/plugins/clangcodemodel/clangdiagnostictooltipwidget.cpp index d7af5ab8ec7..d92b5d67ac2 100644 --- a/src/plugins/clangcodemodel/clangdiagnostictooltipwidget.cpp +++ b/src/plugins/clangcodemodel/clangdiagnostictooltipwidget.cpp @@ -98,6 +98,7 @@ public: bool enableClickableFixits; bool limitWidth; bool hideTooltipAfterLinkActivation; + bool allowTextSelection; }; static QWidget *create(const QVector &diagnostics, @@ -122,7 +123,12 @@ private: auto *label = new QLabel; label->setTextFormat(Qt::RichText); label->setText(text); - label->setTextInteractionFlags(Qt::TextBrowserInteraction); + if (m_displayHints.allowTextSelection) { + label->setTextInteractionFlags(Qt::TextBrowserInteraction); + } else { + label->setTextInteractionFlags(Qt::LinksAccessibleByMouse + | Qt::LinksAccessibleByKeyboard); + } if (m_displayHints.limitWidth) { const int limit = widthLimit(); @@ -457,6 +463,7 @@ QWidget *ClangDiagnosticWidget::create( hints.enableClickableFixits = true; hints.limitWidth = true; hints.hideTooltipAfterLinkActivation = true; + hints.allowTextSelection = false; } else { // Info Bar hints.showCategoryAndEnableOption = false; hints.showFileNameInMainDiagnostic = true; @@ -464,6 +471,7 @@ QWidget *ClangDiagnosticWidget::create( hints.enableClickableFixits = false; hints.limitWidth = false; hints.hideTooltipAfterLinkActivation = false; + hints.allowTextSelection = true; } return WidgetFromDiagnostics::create(diagnostics, hints); diff --git a/src/plugins/clangcodemodel/clangfollowsymbol.cpp b/src/plugins/clangcodemodel/clangfollowsymbol.cpp index 3e85ebc8d93..c430c810c30 100644 --- a/src/plugins/clangcodemodel/clangfollowsymbol.cpp +++ b/src/plugins/clangcodemodel/clangfollowsymbol.cpp @@ -163,13 +163,10 @@ void ClangFollowSymbol::findLink(const CppTools::CursorInEditor &data, CppTools::SymbolFinder *symbolFinder, bool inNextSplit) { - int lineNumber = 0, positionInBlock = 0; + int line = 0; + int column = 0; QTextCursor cursor = Utils::Text::wordStartCursor(data.cursor()); - Utils::Text::convertPosition(cursor.document(), cursor.position(), &lineNumber, - &positionInBlock); - - const uint line = lineNumber; - const uint column = positionInBlock + 1; + Utils::Text::convertPosition(cursor.document(), cursor.position(), &line, &column); ClangEditorDocumentProcessor *processor = ClangEditorDocumentProcessor::get( data.filePath().toString()); @@ -177,7 +174,10 @@ void ClangFollowSymbol::findLink(const CppTools::CursorInEditor &data, return processLinkCallback(Utils::Link()); if (!resolveTarget) { - processLinkCallback(linkAtCursor(cursor, data.filePath().toString(), line, column, + processLinkCallback(linkAtCursor(cursor, + data.filePath().toString(), + static_cast(line), + static_cast(column), processor)); return; } diff --git a/src/plugins/clangformat/clangformat.pro b/src/plugins/clangformat/clangformat.pro index 74331b9e5f6..70eefe17f46 100644 --- a/src/plugins/clangformat/clangformat.pro +++ b/src/plugins/clangformat/clangformat.pro @@ -18,7 +18,8 @@ QMAKE_CXXFLAGS += $$LLVM_CXXFLAGS SOURCES = \ clangformatconfigwidget.cpp \ clangformatindenter.cpp \ - clangformatplugin.cpp + clangformatplugin.cpp \ + clangformatutils.cpp HEADERS = \ clangformatconfigwidget.h \ diff --git a/src/plugins/clangformat/clangformat.qbs b/src/plugins/clangformat/clangformat.qbs index 37bb4c1f647..66e481785e5 100644 --- a/src/plugins/clangformat/clangformat.qbs +++ b/src/plugins/clangformat/clangformat.qbs @@ -33,5 +33,6 @@ QtcPlugin { "clangformatplugin.cpp", "clangformatplugin.h", "clangformatutils.h", + "clangformatutils.cpp", ] } diff --git a/src/plugins/clangformat/clangformatconfigwidget.cpp b/src/plugins/clangformat/clangformatconfigwidget.cpp index 620989d02b0..213fd88a1a2 100644 --- a/src/plugins/clangformat/clangformatconfigwidget.cpp +++ b/src/plugins/clangformat/clangformatconfigwidget.cpp @@ -138,7 +138,7 @@ void ClangFormatConfigWidget::initialize() connect(m_ui->createFileButton, &QPushButton::clicked, this, [this]() { - createStyleFileIfNeeded(m_project->projectDirectory()); + createStyleFileIfNeeded(m_project->projectDirectory(), false); initialize(); }); return; @@ -146,10 +146,8 @@ void ClangFormatConfigWidget::initialize() m_ui->createFileButton->hide(); - std::string testFilePath; if (m_project) { m_ui->projectHasClangFormat->hide(); - testFilePath = m_project->projectDirectory().appendPath("t.cpp").toString().toStdString(); connect(m_ui->applyButton, &QPushButton::clicked, this, &ClangFormatConfigWidget::apply); } else { const Project *currentProject = SessionManager::startupProject(); @@ -162,34 +160,20 @@ void ClangFormatConfigWidget::initialize() "and can be configured in Projects > Clang Format.")); } const QString settingsDir = Core::ICore::userResourcePath(); - createStyleFileIfNeeded(Utils::FileName::fromString(settingsDir)); - testFilePath = settingsDir.toStdString() + "/t.cpp"; + createStyleFileIfNeeded(Utils::FileName::fromString(settingsDir), true); m_ui->applyButton->hide(); } - fillTable(testFilePath); + fillTable(); } -void ClangFormatConfigWidget::fillTable(const std::string &testFilePath) +void ClangFormatConfigWidget::fillTable() { - llvm::Expected formatStyle = - clang::format::getStyle("file", testFilePath, "LLVM"); - std::string configText; - bool brokenConfig = false; - if (!formatStyle) { - handleAllErrors(formatStyle.takeError(), [](const llvm::ErrorInfoBase &) { - // do nothing - }); - configText = clang::format::configurationAsText(clang::format::getLLVMStyle()); - brokenConfig = true; - } else { - configText = clang::format::configurationAsText(*formatStyle); - } + clang::format::FormatStyle style = m_project ? currentProjectStyle() : currentGlobalStyle(); + std::string configText = clang::format::configurationAsText(style); std::istringstream stream(configText); readTable(m_ui->clangFormatOptionsTable, stream); - if (brokenConfig) - apply(); } diff --git a/src/plugins/clangformat/clangformatconfigwidget.h b/src/plugins/clangformat/clangformatconfigwidget.h index 5694bd820b7..951e0cc4088 100644 --- a/src/plugins/clangformat/clangformatconfigwidget.h +++ b/src/plugins/clangformat/clangformatconfigwidget.h @@ -49,7 +49,7 @@ public: private: void initialize(); - void fillTable(const std::string &testFilePath); + void fillTable(); ProjectExplorer::Project *m_project; std::unique_ptr m_ui; diff --git a/src/plugins/clangformat/clangformatindenter.cpp b/src/plugins/clangformat/clangformatindenter.cpp index b8c1ebbb9a0..ddd786fc22f 100644 --- a/src/plugins/clangformat/clangformatindenter.cpp +++ b/src/plugins/clangformat/clangformatindenter.cpp @@ -30,10 +30,7 @@ #include #include -#include #include -#include -#include #include #include @@ -78,7 +75,7 @@ Replacements filteredReplacements(const Replacements &replacements, Replacements filtered; for (const Replacement &replacement : replacements) { int replacementOffset = static_cast(replacement.getOffset()); - if (replacementOffset > offset + lengthForFilter) + if (replacementOffset >= offset + lengthForFilter) break; if (replacementOffset + 1 >= offset) @@ -95,31 +92,6 @@ Replacements filteredReplacements(const Replacements &replacements, return filtered; } -Utils::FileName styleConfigPath() -{ - const Project *project = SessionManager::startupProject(); - if (project && project->projectDirectory().appendPath(".clang-format").exists()) - return project->projectDirectory(); - - return Utils::FileName::fromString(Core::ICore::userResourcePath()); -} - -FormatStyle formatStyle(Utils::FileName styleConfigPath) -{ - createStyleFileIfNeeded(styleConfigPath); - - Expected style = format::getStyle( - "file", styleConfigPath.appendPath("test.cpp").toString().toStdString(), "LLVM"); - if (style) - return *style; - - handleAllErrors(style.takeError(), [](const ErrorInfoBase &) { - // do nothing - }); - - return format::getLLVMStyle(); -} - void trimFirstNonEmptyBlock(const QTextBlock ¤tBlock) { QTextBlock prevBlock = currentBlock.previous(); @@ -198,8 +170,7 @@ Replacements replacements(QByteArray buffer, const QTextBlock *block = nullptr, const QChar &typedChar = QChar::Null) { - Utils::FileName stylePath = styleConfigPath(); - FormatStyle style = formatStyle(stylePath); + FormatStyle style = currentStyle(); int extraOffset = 0; if (block) { @@ -227,6 +198,7 @@ Replacements replacements(QByteArray buffer, static_cast(utf8Length)}}; FormattingAttemptStatus status; + Utils::FileName stylePath = currentStyleConfigPath(); const std::string assumedFilePath = stylePath.appendPath("test.cpp").toString().toStdString(); Replacements replacements = reformat(style, buffer.data(), ranges, assumedFilePath, &status); @@ -234,13 +206,9 @@ Replacements replacements(QByteArray buffer, if (!status.FormatComplete) Replacements(); - int lengthForFilter = 0; - if (block == nullptr) - lengthForFilter = utf8Length; - return filteredReplacements(replacements, utf8Offset, - lengthForFilter, + utf8Length, extraOffset); } @@ -330,6 +298,17 @@ void applyReplacements(const QTextBlock &block, } } +QString selectedLines(QTextDocument *doc, const QTextBlock &startBlock, const QTextBlock &endBlock) +{ + QString text = Utils::Text::textAt( + QTextCursor(doc), + startBlock.position(), + std::max(0, endBlock.position() + endBlock.length() - startBlock.position() - 1)); + while (!text.isEmpty() && text.rbegin()->isSpace()) + text.chop(1); + return text; +} + } // anonymous namespace bool ClangFormatIndenter::isElectricCharacter(const QChar &ch) const @@ -366,12 +345,7 @@ void ClangFormatIndenter::indent(QTextDocument *doc, const QTextBlock end = doc->findBlock(cursor.selectionEnd()); utf8Offset = Utils::Text::utf8NthLineOffset(doc, buffer, start.blockNumber() + 1); QTC_ASSERT(utf8Offset >= 0, return;); - utf8Length = - Utils::Text::textAt( - QTextCursor(doc), - start.position(), - std::max(0, end.position() + end.length() - start.position() - 1)) - .toUtf8().size(); + utf8Length = selectedLines(doc, start, end).toUtf8().size(); applyReplacements(start, utf8Offset, buffer, @@ -449,7 +423,7 @@ int ClangFormatIndenter::indentFor(const QTextBlock &block, const TextEditor::Ta TabSettings ClangFormatIndenter::tabSettings() const { - FormatStyle style = formatStyle(styleConfigPath()); + FormatStyle style = currentStyle(); TabSettings tabSettings; switch (style.UseTab) { @@ -466,8 +440,8 @@ TabSettings ClangFormatIndenter::tabSettings() const tabSettings.m_tabSize = static_cast(style.TabWidth); tabSettings.m_indentSize = static_cast(style.IndentWidth); - if (style.AlignAfterOpenBracket) - tabSettings.m_continuationAlignBehavior = TabSettings::ContinuationAlignWithSpaces; + if (style.AlignAfterOpenBracket == FormatStyle::BAS_DontAlign) + tabSettings.m_continuationAlignBehavior = TabSettings::NoContinuationAlign; else tabSettings.m_continuationAlignBehavior = TabSettings::ContinuationAlignWithIndent; diff --git a/src/plugins/clangformat/clangformatplugin.cpp b/src/plugins/clangformat/clangformatplugin.cpp index f421b686aca..0c51a5ed2c6 100644 --- a/src/plugins/clangformat/clangformatplugin.cpp +++ b/src/plugins/clangformat/clangformatplugin.cpp @@ -45,8 +45,12 @@ #include #include +#include + #include +#include + #include #include #include @@ -95,6 +99,26 @@ private: ClangFormatPlugin::ClangFormatPlugin() = default; ClangFormatPlugin::~ClangFormatPlugin() = default; +#ifdef KEEP_LINE_BREAKS_FOR_NON_EMPTY_LINES_BACKPORTED +static void disableCppCodeStyle() +{ + using namespace TextEditor; + TextEditorSettings::unregisterCodeStyleFactory(CppTools::Constants::CPP_SETTINGS_ID); + TextEditorSettings::unregisterCodeStylePool(CppTools::Constants::CPP_SETTINGS_ID); + TextEditorSettings::unregisterCodeStyle(CppTools::Constants::CPP_SETTINGS_ID); + + QList pages = Core::IOptionsPage::allOptionsPages(); + int codeStylePageIndex = Utils::indexOf(pages, [](Core::IOptionsPage *page) { + return page->id() == CppTools::Constants::CPP_CODE_STYLE_SETTINGS_ID; + }); + if (codeStylePageIndex >= 0) { + auto *page = pages[codeStylePageIndex]; + page->finish(); + page->deleteLater(); + } +} +#endif + bool ClangFormatPlugin::initialize(const QStringList &arguments, QString *errorString) { Q_UNUSED(arguments); @@ -113,6 +137,8 @@ bool ClangFormatPlugin::initialize(const QStringList &arguments, QString *errorS CppTools::CppModelManager::instance()->setCppIndenterCreator([]() { return new ClangFormatIndenter(); }); + + disableCppCodeStyle(); #endif return true; } diff --git a/src/plugins/clangformat/clangformatutils.cpp b/src/plugins/clangformat/clangformatutils.cpp new file mode 100644 index 00000000000..4e901ab5631 --- /dev/null +++ b/src/plugins/clangformat/clangformatutils.cpp @@ -0,0 +1,179 @@ +/**************************************************************************** +** +** Copyright (C) 2018 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +****************************************************************************/ + +#include "clangformatutils.h" + +#include +#include +#include +#include +#include + +using namespace clang; +using namespace format; +using namespace llvm; +using namespace CppTools; +using namespace ProjectExplorer; +using namespace TextEditor; + +namespace ClangFormat { + +static void applyTabSettings(clang::format::FormatStyle &style, const TabSettings &settings) +{ + style.IndentWidth = static_cast(settings.m_indentSize); + style.TabWidth = static_cast(settings.m_tabSize); + + if (settings.m_tabPolicy == TabSettings::TabsOnlyTabPolicy) + style.UseTab = FormatStyle::UT_Always; + else if (settings.m_tabPolicy == TabSettings::SpacesOnlyTabPolicy) + style.UseTab = FormatStyle::UT_Never; + else + style.UseTab = FormatStyle::UT_ForContinuationAndIndentation; + + if (settings.m_continuationAlignBehavior == TabSettings::NoContinuationAlign) { + style.ContinuationIndentWidth = 0; + style.AlignAfterOpenBracket = FormatStyle::BAS_DontAlign; + } else { + style.ContinuationIndentWidth = style.IndentWidth; + style.AlignAfterOpenBracket = FormatStyle::BAS_Align; + } +} + +static void applyCppCodeStyleSettings(clang::format::FormatStyle &style, + const CppCodeStyleSettings &settings) +{ + style.IndentCaseLabels = settings.indentSwitchLabels; + style.AlignOperands = settings.alignAssignments; + style.NamespaceIndentation = FormatStyle::NI_None; + if (settings.indentNamespaceBody) + style.NamespaceIndentation = FormatStyle::NI_All; + + style.BraceWrapping.IndentBraces = false; + if (settings.indentBlockBraces) { + if (settings.indentClassBraces && settings.indentEnumBraces + && settings.indentNamespaceBraces && settings.indentFunctionBraces) { + style.BraceWrapping.IndentBraces = true; + } else { + style.BreakBeforeBraces = FormatStyle::BS_GNU; + } + } + + if (settings.bindStarToIdentifier || settings.bindStarToRightSpecifier) + style.PointerAlignment = FormatStyle::PAS_Right; + else + style.PointerAlignment = FormatStyle::PAS_Left; + + style.AccessModifierOffset = settings.indentAccessSpecifiers + ? 0 + : - static_cast(style.IndentWidth); +} + +static Utils::FileName projectStylePath() +{ + const Project *project = SessionManager::startupProject(); + if (project) + return project->projectDirectory(); + + return Utils::FileName(); +} + +static Utils::FileName globalStylePath() +{ + return Utils::FileName::fromString(Core::ICore::userResourcePath()); +} + +Utils::FileName currentStyleConfigPath() +{ + Utils::FileName path = projectStylePath(); + if (!path.isEmpty()) + return path; + + return globalStylePath(); +} + +static clang::format::FormatStyle constructStyle(bool isGlobal) +{ + FormatStyle style = getLLVMStyle(); + const CppCodeStyleSettings codeStyleSettings = isGlobal + ? CppCodeStyleSettings::currentGlobalCodeStyle() + : CppCodeStyleSettings::currentProjectCodeStyle(); + const TabSettings tabSettings = isGlobal + ? CppCodeStyleSettings::currentGlobalTabSettings() + : CppCodeStyleSettings::currentProjectTabSettings(); + + applyTabSettings(style, tabSettings); + applyCppCodeStyleSettings(style, codeStyleSettings); + + return style; +} + +void createStyleFileIfNeeded(Utils::FileName styleConfigPath, bool isGlobal) +{ + const QString configFile = styleConfigPath.appendPath(".clang-format").toString(); + if (QFile::exists(configFile)) + return; + + std::fstream newStyleFile(configFile.toStdString(), std::fstream::out); + if (newStyleFile.is_open()) { + newStyleFile << clang::format::configurationAsText(constructStyle(isGlobal)); + newStyleFile.close(); + } +} + +static clang::format::FormatStyle currentStyle(bool isGlobal) +{ + Utils::FileName styleConfigPath = isGlobal ? globalStylePath() : projectStylePath(); + createStyleFileIfNeeded(styleConfigPath, isGlobal); + + Expected style = format::getStyle( + "file", styleConfigPath.appendPath("test.cpp").toString().toStdString(), "LLVM"); + if (style) + return *style; + + handleAllErrors(style.takeError(), [](const ErrorInfoBase &) { + // do nothing + }); + + return constructStyle(isGlobal); +} + +clang::format::FormatStyle currentProjectStyle() +{ + return currentStyle(false); +} + +clang::format::FormatStyle currentGlobalStyle() +{ + return currentStyle(true); +} + +clang::format::FormatStyle currentStyle() +{ + const bool isGlobal = (CppCodeStyleSettings::currentProjectCodeStyle() + == CppCodeStyleSettings::currentGlobalCodeStyle()); + return currentStyle(isGlobal); +} + +} diff --git a/src/plugins/clangformat/clangformatutils.h b/src/plugins/clangformat/clangformatutils.h index ad4e21f8899..8634685971e 100644 --- a/src/plugins/clangformat/clangformatutils.h +++ b/src/plugins/clangformat/clangformatutils.h @@ -34,18 +34,12 @@ namespace ClangFormat { -inline void createStyleFileIfNeeded(Utils::FileName styleConfigPath) -{ - const QString configFile = styleConfigPath.appendPath(".clang-format").toString(); - if (QFile::exists(configFile)) - return; +void createStyleFileIfNeeded(Utils::FileName styleConfigPath, bool isGlobal); - clang::format::FormatStyle newStyle = clang::format::getLLVMStyle(); - std::fstream newStyleFile(configFile.toStdString(), std::fstream::out); - if (newStyleFile.is_open()) { - newStyleFile << clang::format::configurationAsText(newStyle); - newStyleFile.close(); - } -} +clang::format::FormatStyle currentProjectStyle(); +clang::format::FormatStyle currentGlobalStyle(); + +Utils::FileName currentStyleConfigPath(); +clang::format::FormatStyle currentStyle(); } diff --git a/src/plugins/clangrefactoring/querysqlitestatementfactory.h b/src/plugins/clangrefactoring/querysqlitestatementfactory.h index 21a1f022ec3..14fc27149d2 100644 --- a/src/plugins/clangrefactoring/querysqlitestatementfactory.h +++ b/src/plugins/clangrefactoring/querysqlitestatementfactory.h @@ -40,7 +40,7 @@ public: {} Database &database; ReadStatement selectLocationsForSymbolLocation{ - "SELECT directoryId, sourceId, line, column FROM locations JOIN sources USING(sourceId) WHERE symbolId = " + "SELECT sourceId, line, column FROM locations WHERE symbolId = " " (SELECT symbolId FROM locations WHERE sourceId=? AND line=? AND column=?) " "ORDER BY sourceId, line, column", database}; @@ -59,7 +59,7 @@ public: "SELECT symbolId, symbolName, signature FROM symbols WHERE symbolKind IN (?,?,?) AND symbolName LIKE ?", database}; ReadStatement selectLocationOfSymbol{ - "SELECT (SELECT directoryId FROM sources WHERE sourceId = l.sourceId), sourceId, line, column FROM locations AS l WHERE symbolId = ? AND locationKind = ?", + "SELECT sourceId, line, column FROM locations AS l WHERE symbolId = ? AND locationKind = ?", database}; }; diff --git a/src/plugins/clangrefactoring/sourcelocations.h b/src/plugins/clangrefactoring/sourcelocations.h index 9766a779b5d..80fc0d89c00 100644 --- a/src/plugins/clangrefactoring/sourcelocations.h +++ b/src/plugins/clangrefactoring/sourcelocations.h @@ -45,8 +45,8 @@ public: SourceLocation(ClangBackEnd::FilePathId filePathId, int line, int column) : filePathId{filePathId}, lineColumn{line, column} {} - SourceLocation(int directoryId, int sourceId, int line, int column) - : filePathId{directoryId, sourceId}, lineColumn{line, column} + SourceLocation(int sourceId, int line, int column) + : filePathId{sourceId}, lineColumn{line, column} {} friend bool operator==(SourceLocation first, SourceLocation second) diff --git a/src/plugins/clangrefactoring/symbolquery.h b/src/plugins/clangrefactoring/symbolquery.h index 507d032f06f..b5a46ab7e60 100644 --- a/src/plugins/clangrefactoring/symbolquery.h +++ b/src/plugins/clangrefactoring/symbolquery.h @@ -55,7 +55,7 @@ public: const std::size_t reserveSize = 128; - return locationsStatement.template values(reserveSize, + return locationsStatement.template values(reserveSize, filePathId.filePathId, line, utf8Column); @@ -120,7 +120,7 @@ public: { ReadStatement &statement = m_statementFactory.selectLocationOfSymbol; - return statement.template value(symbolId, int(kind)); + return statement.template value(symbolId, int(kind)); } private: StatementFactory &m_statementFactory; diff --git a/src/plugins/clangtools/clangtidyclazyrunner.cpp b/src/plugins/clangtools/clangtidyclazyrunner.cpp index eab10ebc607..00a945c1240 100644 --- a/src/plugins/clangtools/clangtidyclazyrunner.cpp +++ b/src/plugins/clangtools/clangtidyclazyrunner.cpp @@ -79,7 +79,8 @@ QStringList ClangTidyClazyRunner::constructCommandLineArguments(const QStringLis arguments << QString("-fsyntax-only") << QString("-serialize-diagnostics") << QString(m_logFile) - << ClangDiagnosticConfigsModel::globalDiagnosticOptions(); + << ClangDiagnosticConfigsModel::globalDiagnosticOptions() + << m_diagnosticConfig.clangOptions(); const ClangDiagnosticConfig::TidyMode tidyMode = m_diagnosticConfig.clangTidyMode(); if (tidyMode != ClangDiagnosticConfig::TidyMode::Disabled) { diff --git a/src/plugins/classview/classviewmanager.cpp b/src/plugins/classview/classviewmanager.cpp index 9d099820650..d00343ccb3b 100644 --- a/src/plugins/classview/classviewmanager.cpp +++ b/src/plugins/classview/classviewmanager.cpp @@ -421,7 +421,7 @@ void Manager::onDocumentUpdated(CPlusPlus::Document::Ptr doc) /*! Opens the text editor for the file \a fileName on \a line (1-based) and - \a column (1-based). + \a column (0-based). */ void Manager::gotoLocation(const QString &fileName, int line, int column) @@ -466,7 +466,8 @@ void Manager::gotoLocations(const QList &list) } } } - gotoLocation(loc.fileName(), loc.line(), loc.column()); + // line is 1-based, column is 0-based + gotoLocation(loc.fileName(), loc.line(), loc.column() - 1); } /*! diff --git a/src/plugins/classview/classviewparser.cpp b/src/plugins/classview/classviewparser.cpp index 5dc37c528cf..14034b46a38 100644 --- a/src/plugins/classview/classviewparser.cpp +++ b/src/plugins/classview/classviewparser.cpp @@ -366,9 +366,9 @@ void Parser::addSymbol(const ParserTreeItem::Ptr &item, const CPlusPlus::Symbol if (itemAdd.isNull()) itemAdd = ParserTreeItem::Ptr(new ParserTreeItem()); - // locations are 1-based in Symbol, start with 0 for the editor + // locations have 1-based column in Symbol, use the same here. SymbolLocation location(QString::fromUtf8(symbol->fileName() , symbol->fileNameLength()), - symbol->line(), symbol->column() - 1); + symbol->line(), symbol->column()); itemAdd->addSymbolLocation(location); // prevent showing a content of the functions diff --git a/src/plugins/cmakeprojectmanager/cmakeeditor.cpp b/src/plugins/cmakeprojectmanager/cmakeeditor.cpp index a1b529e3e98..122569616e1 100644 --- a/src/plugins/cmakeprojectmanager/cmakeeditor.cpp +++ b/src/plugins/cmakeprojectmanager/cmakeeditor.cpp @@ -146,8 +146,10 @@ void CMakeEditorWidget::findLinkAt(const QTextCursor &cursor, { Utils::Link link; - int lineNumber = 0, positionInBlock = 0; - convertPosition(cursor.position(), &lineNumber, &positionInBlock); + int line = 0; + int column = 0; + convertPosition(cursor.position(), &line, &column); + const int positionInBlock = column - 1; const QString block = cursor.block().text(); diff --git a/src/plugins/compilationdatabaseprojectmanager/compilationdatabaseproject.cpp b/src/plugins/compilationdatabaseprojectmanager/compilationdatabaseproject.cpp index 155ed5185aa..f8c19219886 100644 --- a/src/plugins/compilationdatabaseprojectmanager/compilationdatabaseproject.cpp +++ b/src/plugins/compilationdatabaseprojectmanager/compilationdatabaseproject.cpp @@ -75,6 +75,7 @@ QStringList jsonObjectFlags(const QJsonObject &object) if (arguments.isEmpty()) { flags = splitCommandLine(object["command"].toString()); } else { + flags.reserve(arguments.size()); for (const QJsonValue &arg : arguments) flags.append(arg.toString()); } @@ -284,27 +285,43 @@ FolderNode *createFoldersIfNeeded(FolderNode *root, const Utils::FileName &folde return parent; } -void createFolders(FolderNode *root, const Utils::FileName &rootPath) +FileType fileTypeForName(const QString &fileName) +{ + CppTools::ProjectFile::Kind fileKind = CppTools::ProjectFile::classify(fileName); + if (CppTools::ProjectFile::isHeader(fileKind)) + return FileType::Header; + return FileType::Source; +} + +void createTree(FolderNode *root, + const Utils::FileName &rootPath, + const CppTools::RawProjectParts &rpps) { root->setAbsoluteFilePathAndLine(rootPath, -1); - for (Node *child : root->nodes()) { - FileNode *fileNode = child->asFileNode(); - if (!fileNode) - continue; - - FolderNode *parentNode = createFoldersIfNeeded(root, - fileNode->filePath().parentDir()); - child->setParentFolderNode(nullptr); - std::unique_ptr childNode = root->takeNode(child); - if (!parentNode->fileNode(child->filePath())) - parentNode->addNode(std::move(childNode)); + for (const CppTools::RawProjectPart &rpp : rpps) { + for (const QString &filePath : rpp.files) { + Utils::FileName fileName = Utils::FileName::fromString(filePath); + FolderNode *parentNode = createFoldersIfNeeded(root, fileName.parentDir()); + if (!parentNode->fileNode(fileName)) { + parentNode->addNode(std::make_unique(fileName, + fileTypeForName(fileName.fileName()), + false)); + } + } } } -std::vector readJsonObjects(const QString &filePath) +struct Entry { - std::vector result; + QStringList flags; + Utils::FileName fileName; + QString workingDir; +}; + +std::vector readJsonObjects(const QString &filePath) +{ + std::vector result; QFile file(filePath); if (!file.open(QIODevice::ReadOnly)) return result; @@ -322,7 +339,12 @@ std::vector readJsonObjects(const QString &filePath) continue; } - result.push_back(document.object()); + const QJsonObject object = document.object(); + const Utils::FileName fileName = jsonObjectFilename(object); + const QStringList flags + = filterFromFileName(jsonObjectFlags(object), fileName.toFileInfo().baseName()); + result.push_back({flags, fileName, object["directory"].toString()}); + objectStart = contents.indexOf('{', objectEnd + 1); objectEnd = contents.indexOf('}', objectStart + 1); } @@ -334,7 +356,7 @@ std::vector readJsonObjects(const QString &filePath) void CompilationDatabaseProject::buildTreeAndProjectParts(const Utils::FileName &projectFile) { - std::vector array = readJsonObjects(projectFilePath().toString()); + std::vector array = readJsonObjects(projectFilePath().toString()); if (array.empty()) { emitParsingFinished(false); return; @@ -346,37 +368,37 @@ void CompilationDatabaseProject::buildTreeAndProjectParts(const Utils::FileName Utils::FileName commonPath; ToolChain *cToolchain = nullptr; ToolChain *cxxToolchain = nullptr; - for (const QJsonObject &object : array) { - Utils::FileName fileName = jsonObjectFilename(object); - const QStringList flags = jsonObjectFlags(object); + + std::sort(array.begin(), array.end(), [](const Entry &lhs, const Entry &rhs) { + return std::lexicographical_compare(lhs.flags.begin(), lhs.flags.end(), + rhs.flags.begin(), rhs.flags.end()); + }); + + const Entry *prevEntry = nullptr; + for (const Entry &entry : array) { + if (prevEntry && prevEntry->flags == entry.flags) { + rpps.back().files.append(entry.fileName.toString()); + continue; + } + + prevEntry = &entry; commonPath = rpps.empty() - ? fileName.parentDir() - : Utils::FileUtils::commonPath(commonPath, fileName); - - ProjectExplorer::FileType type = ProjectExplorer::FileType::Unknown; - root->addNode(std::make_unique(fileName, type, false)); + ? entry.fileName.parentDir() + : Utils::FileUtils::commonPath(commonPath, entry.fileName); CppTools::RawProjectPart rpp = makeRawProjectPart(projectFile, m_kit.get(), cToolchain, cxxToolchain, - object["directory"].toString(), - fileName, - flags); - int rppIndex = Utils::indexOf(rpps, [&rpp](const CppTools::RawProjectPart ¤tRpp) { - return rpp.buildSystemTarget == currentRpp.buildSystemTarget - && rpp.headerPaths == currentRpp.headerPaths - && rpp.projectMacros == currentRpp.projectMacros - && rpp.flagsForCxx.commandLineFlags == currentRpp.flagsForCxx.commandLineFlags; - }); - if (rppIndex == -1) - rpps.append(rpp); - else - rpps[rppIndex].files.append(rpp.files); + entry.workingDir, + entry.fileName, + entry.flags); + + rpps.append(rpp); } - createFolders(root.get(), commonPath); + createTree(root.get(), commonPath, rpps); root->addNode(std::make_unique( projectFile, diff --git a/src/plugins/compilationdatabaseprojectmanager/compilationdatabaseutils.cpp b/src/plugins/compilationdatabaseprojectmanager/compilationdatabaseutils.cpp index 2dd20dd9e5f..1884aa1c6d3 100644 --- a/src/plugins/compilationdatabaseprojectmanager/compilationdatabaseutils.cpp +++ b/src/plugins/compilationdatabaseprojectmanager/compilationdatabaseutils.cpp @@ -81,6 +81,19 @@ static CppTools::ProjectFile::Kind fileKindFromString(QString flag) return ProjectFile::Unclassified; } +QStringList filterFromFileName(const QStringList &flags, QString baseName) +{ + baseName.append('.'); // to match name.c, name.o, etc. + QStringList result; + result.reserve(flags.size()); + for (const QString &flag : flags) { + if (!flag.contains(baseName)) + result.push_back(flag); + } + + return result; +} + void filteredFlags(const QString &fileName, const QString &workingDir, QStringList &flags, @@ -88,13 +101,13 @@ void filteredFlags(const QString &fileName, Macros ¯os, CppTools::ProjectFile::Kind &fileKind) { - if (flags.isEmpty()) + if (flags.empty()) return; // Skip compiler call if present. bool skipNext = Utils::HostOsInfo::isWindowsHost() - ? (!flags.first().startsWith('/') && !flags.first().startsWith('-')) - : (!flags.first().startsWith('-')); + ? (!flags.front().startsWith('/') && !flags.front().startsWith('-')) + : (!flags.front().startsWith('-')); Utils::optional includePathType; Utils::optional macroType; bool fileKindIsNext = false; @@ -121,11 +134,6 @@ void filteredFlags(const QString &fileName, continue; } - if (flag == "-o") { - skipNext = true; - continue; - } - if (flag != "-x" && (fileKindIsNext || flag == "/TC" || flag == "/TP" || flag.startsWith("/Tc") || flag.startsWith("/Tp") || flag.startsWith("-x"))) { @@ -139,16 +147,13 @@ void filteredFlags(const QString &fileName, continue; } - if (flag == "-c" || flag == "-pedantic" + if (flag == "-o" || flag == "-MF" || flag == "-c" || flag == "-pedantic" || flag.startsWith("-O") || flag.startsWith("-W") || flag.startsWith("-w") || QString::compare(flag, "-fpic", Qt::CaseInsensitive) == 0 || QString::compare(flag, "-fpie", Qt::CaseInsensitive) == 0) { continue; } - if (flag.endsWith(fileName)) - continue; - if ((flag.startsWith("-I") || flag.startsWith("-isystem") || flag.startsWith("/I")) && flag != "-I" && flag != "-isystem" && flag != "/I") { bool userInclude = flag.startsWith("-I"); diff --git a/src/plugins/compilationdatabaseprojectmanager/compilationdatabaseutils.h b/src/plugins/compilationdatabaseprojectmanager/compilationdatabaseutils.h index 5e123a8c271..e465b6ba23c 100644 --- a/src/plugins/compilationdatabaseprojectmanager/compilationdatabaseutils.h +++ b/src/plugins/compilationdatabaseprojectmanager/compilationdatabaseutils.h @@ -38,6 +38,8 @@ class Macro; namespace CompilationDatabaseProjectManager { +QStringList filterFromFileName(const QStringList &flags, QString baseName); + void filteredFlags(const QString &fileName, const QString &workingDir, QStringList &flags, diff --git a/src/plugins/cppeditor/cppuseselections_test.cpp b/src/plugins/cppeditor/cppuseselections_test.cpp index 8de8048a892..99674b2e3c7 100644 --- a/src/plugins/cppeditor/cppuseselections_test.cpp +++ b/src/plugins/cppeditor/cppuseselections_test.cpp @@ -31,6 +31,7 @@ #include #include +// Uses 1-based line and 0-based column. struct Selection { Selection(int line, int column, int length) : line(line), column(column), length(length) {} int line; @@ -116,7 +117,7 @@ SelectionList UseSelectionsTestCase::toSelectionList( int line, column; const int position = qMin(selection.cursor.position(), selection.cursor.anchor()); m_editorWidget->convertPosition(position, &line, &column); - result << Selection(line, column, selection.cursor.selectedText().length()); + result << Selection(line, column - 1, selection.cursor.selectedText().length()); } return result; } diff --git a/src/plugins/cppeditor/followsymbol_switchmethoddecldef_test.cpp b/src/plugins/cppeditor/followsymbol_switchmethoddecldef_test.cpp index 3ac121d918e..8d30cfbd437 100644 --- a/src/plugins/cppeditor/followsymbol_switchmethoddecldef_test.cpp +++ b/src/plugins/cppeditor/followsymbol_switchmethoddecldef_test.cpp @@ -317,7 +317,7 @@ F2TestCase::F2TestCase(CppEditorAction action, initialTestFile->m_editor->setCursorPosition(initialTestFile->m_cursorPosition); // qDebug() << "Initial line:" << initialTestFile->editor->currentLine(); -// qDebug() << "Initial column:" << initialTestFile->editor->currentColumn() - 1; +// qDebug() << "Initial column:" << initialTestFile->editor->currentColumn(); OverrideItemList immediateVirtualSymbolResults; OverrideItemList finalVirtualSymbolResults; @@ -338,7 +338,7 @@ F2TestCase::F2TestCase(CppEditorAction action, QSKIP((curTestName + " is not supported by Clang FollowSymbol").toLatin1()); } - initialTestFile->m_editorWidget->openLinkUnderCursor(); + widget->openLinkUnderCursor(); break; } @@ -349,7 +349,7 @@ F2TestCase::F2TestCase(CppEditorAction action, QSharedPointer testProvider( new VirtualFunctionTestAssistProvider(widget)); builtinFollowSymbol->setVirtualFunctionAssistProvider(testProvider); - initialTestFile->m_editorWidget->openLinkUnderCursor(); + widget->openLinkUnderCursor(); immediateVirtualSymbolResults = testProvider->m_immediateItems; finalVirtualSymbolResults = testProvider->m_finalItems; @@ -382,7 +382,7 @@ F2TestCase::F2TestCase(CppEditorAction action, QEXPECT_FAIL("globalVarFromEnum", "Contributor works on a fix.", Abort); QEXPECT_FAIL("matchFunctionSignature_Follow_5", "foo(int) resolved as CallAST", Abort); QCOMPARE(currentTextEditor->currentLine(), expectedLine); - QCOMPARE(currentTextEditor->currentColumn() - 1, expectedColumn); + QCOMPARE(currentTextEditor->currentColumn(), expectedColumn); // qDebug() << immediateVirtualSymbolResults; // qDebug() << finalVirtualSymbolResults; diff --git a/src/plugins/cpptools/builtincursorinfo.cpp b/src/plugins/cpptools/builtincursorinfo.cpp index 4522af15a96..85603ba0902 100644 --- a/src/plugins/cpptools/builtincursorinfo.cpp +++ b/src/plugins/cpptools/builtincursorinfo.cpp @@ -184,8 +184,9 @@ private: { CursorInfo result; + // findLocalUses operates with 1-based line and 0-based column const CppTools::SemanticInfo::LocalUseMap localUses - = BuiltinCursorInfo::findLocalUses(m_document, m_line, m_column); + = BuiltinCursorInfo::findLocalUses(m_document, m_line, m_column - 1); result.localUses = localUses; splitLocalUses(localUses, &result.useRanges, &result.unusedVariablesRanges); @@ -216,8 +217,7 @@ private: bool good = false; foreach (const CppTools::SemanticInfo::Use &use, uses) { unsigned l = static_cast(m_line); - // convertCursorPosition() returns a 0-based column number. - unsigned c = static_cast(m_column + 1); + unsigned c = static_cast(m_column); if (l == use.line && c >= use.column && c <= (use.column + use.length)) { good = true; break; diff --git a/src/plugins/cpptools/builtineditordocumentprocessor.cpp b/src/plugins/cpptools/builtineditordocumentprocessor.cpp index 684f765eace..d5bfa510203 100644 --- a/src/plugins/cpptools/builtineditordocumentprocessor.cpp +++ b/src/plugins/cpptools/builtineditordocumentprocessor.cpp @@ -112,7 +112,6 @@ CppTools::CheckSymbols *createHighlighter(const CPlusPlus::Document::Ptr &doc, int line, column; convertPosition(textDocument, macro.utf16CharOffset(), &line, &column); - ++column; //Highlighting starts at (column-1) --> compensate here Result use(line, column, macro.nameToQString().size(), SemanticHighlighter::MacroUse); macroUses.append(use); } diff --git a/src/plugins/cpptools/clangdiagnosticconfigsselectionwidget.cpp b/src/plugins/cpptools/clangdiagnosticconfigsselectionwidget.cpp index 70432047cf9..06d8478b508 100644 --- a/src/plugins/cpptools/clangdiagnosticconfigsselectionwidget.cpp +++ b/src/plugins/cpptools/clangdiagnosticconfigsselectionwidget.cpp @@ -126,6 +126,9 @@ void ClangDiagnosticConfigsSelectionWidget::connectToClangDiagnosticConfigsDialo = settings->clangCustomDiagnosticConfigs(); const ClangDiagnosticConfigs currentDiagnosticConfigs = widget->customConfigs(); if (oldDiagnosticConfigs != currentDiagnosticConfigs) { + const ClangDiagnosticConfigsModel configsModel(currentDiagnosticConfigs); + if (!configsModel.hasConfigWithId(settings->clangDiagnosticConfigId())) + settings->resetClangDiagnosticConfigId(); settings->setClangCustomDiagnosticConfigs(currentDiagnosticConfigs); settings->toSettings(Core::ICore::settings()); } diff --git a/src/plugins/cpptools/cppcanonicalsymbol.cpp b/src/plugins/cpptools/cppcanonicalsymbol.cpp index 3f1869de63b..fa5d0749213 100644 --- a/src/plugins/cpptools/cppcanonicalsymbol.cpp +++ b/src/plugins/cpptools/cppcanonicalsymbol.cpp @@ -60,7 +60,6 @@ Scope *CanonicalSymbol::getScopeAndExpression(const QTextCursor &cursor, QString QTextCursor tc = cursor; int line, column; Utils::Text::convertPosition(cursor.document(), tc.position(), &line, &column); - ++column; // 1-based line and 1-based column int pos = tc.position(); QTextDocument *textDocument = cursor.document(); @@ -74,7 +73,7 @@ Scope *CanonicalSymbol::getScopeAndExpression(const QTextCursor &cursor, QString ExpressionUnderCursor expressionUnderCursor(m_document->languageFeatures()); *code = expressionUnderCursor(tc); - return m_document->scopeAt(line, column); + return m_document->scopeAt(line, column - 1); } Symbol *CanonicalSymbol::operator()(const QTextCursor &cursor) diff --git a/src/plugins/cpptools/cppcodemodelsettings.cpp b/src/plugins/cpptools/cppcodemodelsettings.cpp index 00c57c81733..c5aee2089bc 100644 --- a/src/plugins/cpptools/cppcodemodelsettings.cpp +++ b/src/plugins/cpptools/cppcodemodelsettings.cpp @@ -118,6 +118,12 @@ void CppCodeModelSettings::fromSettings(QSettings *s) setClangCustomDiagnosticConfigs(customDiagnosticConfigsFromSettings(s)); setClangDiagnosticConfigId(clangDiagnosticConfigIdFromSettings(s)); + { // Before Qt Creator 4.8, inconsistent settings might have been written. + const ClangDiagnosticConfigsModel model(m_clangCustomDiagnosticConfigs); + if (!model.hasConfigWithId(m_clangDiagnosticConfigId)) + setClangDiagnosticConfigId(initialClangDiagnosticConfigId()); + } + const QVariant pchUsageVariant = s->value(pchUsageKey(), initialPchUsage()); setPCHUsage(static_cast(pchUsageVariant.toInt())); @@ -189,6 +195,11 @@ void CppCodeModelSettings::setClangDiagnosticConfigId(const Core::Id &configId) m_clangDiagnosticConfigId = configId; } +void CppCodeModelSettings::resetClangDiagnosticConfigId() +{ + m_clangDiagnosticConfigId = initialClangDiagnosticConfigId(); +} + const ClangDiagnosticConfig CppCodeModelSettings::clangDiagnosticConfig() const { const ClangDiagnosticConfigsModel configsModel(m_clangCustomDiagnosticConfigs); diff --git a/src/plugins/cpptools/cppcodemodelsettings.h b/src/plugins/cpptools/cppcodemodelsettings.h index ca1a3cf155c..d1783711f19 100644 --- a/src/plugins/cpptools/cppcodemodelsettings.h +++ b/src/plugins/cpptools/cppcodemodelsettings.h @@ -55,6 +55,7 @@ public: public: Core::Id clangDiagnosticConfigId() const; void setClangDiagnosticConfigId(const Core::Id &configId); + void resetClangDiagnosticConfigId(); const ClangDiagnosticConfig clangDiagnosticConfig() const; ClangDiagnosticConfigs clangCustomDiagnosticConfigs() const; diff --git a/src/plugins/cpptools/cppcodestylesettings.cpp b/src/plugins/cpptools/cppcodestylesettings.cpp index 06d396e59c8..723ae2c2222 100644 --- a/src/plugins/cpptools/cppcodestylesettings.cpp +++ b/src/plugins/cpptools/cppcodestylesettings.cpp @@ -33,6 +33,8 @@ #include #include +#include + #include #include @@ -226,6 +228,31 @@ CppCodeStyleSettings CppCodeStyleSettings::currentGlobalCodeStyle() return cppCodeStylePreferences->currentCodeStyleSettings(); } +TextEditor::TabSettings CppCodeStyleSettings::currentProjectTabSettings() +{ + ProjectExplorer::Project *project = ProjectExplorer::ProjectTree::currentProject(); + if (!project) + return currentGlobalTabSettings(); + + ProjectExplorer::EditorConfiguration *editorConfiguration = project->editorConfiguration(); + QTC_ASSERT(editorConfiguration, return currentGlobalTabSettings()); + + TextEditor::ICodeStylePreferences *codeStylePreferences + = editorConfiguration->codeStyle(CppTools::Constants::CPP_SETTINGS_ID); + QTC_ASSERT(codeStylePreferences, return currentGlobalTabSettings()); + return codeStylePreferences->tabSettings(); +} + +TextEditor::TabSettings CppCodeStyleSettings::currentGlobalTabSettings() +{ + CppTools::CppCodeStylePreferences *cppCodeStylePreferences + = CppTools::CppToolsSettings::instance()->cppCodeStyle(); + QTC_ASSERT(cppCodeStylePreferences, return TextEditor::TabSettings()); + + return cppCodeStylePreferences->tabSettings(); +} + + static void configureOverviewWithCodeStyleSettings(CPlusPlus::Overview &overview, const CppCodeStyleSettings &settings) { diff --git a/src/plugins/cpptools/cppcodestylesettings.h b/src/plugins/cpptools/cppcodestylesettings.h index f69d72d0ab8..4af18fbdbc1 100644 --- a/src/plugins/cpptools/cppcodestylesettings.h +++ b/src/plugins/cpptools/cppcodestylesettings.h @@ -34,6 +34,7 @@ class QSettings; QT_END_NAMESPACE namespace CPlusPlus { class Overview; } +namespace TextEditor { class TabSettings; } namespace CppTools { @@ -94,6 +95,8 @@ public: static CppCodeStyleSettings currentProjectCodeStyle(); static CppCodeStyleSettings currentGlobalCodeStyle(); + static TextEditor::TabSettings currentProjectTabSettings(); + static TextEditor::TabSettings currentGlobalTabSettings(); /*! Returns an Overview configured by the current project's code style. diff --git a/src/plugins/cpptools/cppcompletionassist.cpp b/src/plugins/cpptools/cppcompletionassist.cpp index af4372a4580..87bc2df0b4d 100644 --- a/src/plugins/cpptools/cppcompletionassist.cpp +++ b/src/plugins/cpptools/cppcompletionassist.cpp @@ -1092,7 +1092,7 @@ int InternalCppCompletionAssistProcessor::startCompletionHelper() int line = 0, column = 0; Utils::Text::convertPosition(m_interface->textDocument(), startOfExpression, &line, &column); const QString fileName = m_interface->fileName(); - return startCompletionInternal(fileName, line, column, expression, endOfExpression); + return startCompletionInternal(fileName, line, column - 1, expression, endOfExpression); } bool InternalCppCompletionAssistProcessor::tryObjCCompletion() @@ -1125,7 +1125,7 @@ bool InternalCppCompletionAssistProcessor::tryObjCCompletion() int line = 0, column = 0; Utils::Text::convertPosition(m_interface->textDocument(), m_interface->position(), &line, &column); - Scope *scope = thisDocument->scopeAt(line, column); + Scope *scope = thisDocument->scopeAt(line, column - 1); if (!scope) return false; @@ -1319,7 +1319,8 @@ bool InternalCppCompletionAssistProcessor::objcKeywordsWanted() const } int InternalCppCompletionAssistProcessor::startCompletionInternal(const QString &fileName, - unsigned line, unsigned column, + unsigned line, + unsigned positionInBlock, const QString &expr, int endOfExpression) { @@ -1331,7 +1332,7 @@ int InternalCppCompletionAssistProcessor::startCompletionInternal(const QString m_model->m_typeOfExpression->init(thisDocument, m_interface->snapshot()); - Scope *scope = thisDocument->scopeAt(line, column); + Scope *scope = thisDocument->scopeAt(line, positionInBlock); QTC_ASSERT(scope != 0, return -1); if (expression.isEmpty()) { @@ -2016,7 +2017,7 @@ bool InternalCppCompletionAssistProcessor::completeConstructorOrFunction(const Q int lineSigned = 0, columnSigned = 0; Utils::Text::convertPosition(m_interface->textDocument(), m_interface->position(), &lineSigned, &columnSigned); - unsigned line = lineSigned, column = columnSigned; + unsigned line = lineSigned, column = columnSigned - 1; // find a scope that encloses the current location, starting from the lastVisibileSymbol // and moving outwards diff --git a/src/plugins/cpptools/cppcompletionassist.h b/src/plugins/cpptools/cppcompletionassist.h index 8e0097b2fa8..7bb7776940c 100644 --- a/src/plugins/cpptools/cppcompletionassist.h +++ b/src/plugins/cpptools/cppcompletionassist.h @@ -113,7 +113,7 @@ private: bool tryObjCCompletion(); bool objcKeywordsWanted() const; int startCompletionInternal(const QString &fileName, - unsigned line, unsigned column, + unsigned line, unsigned positionInBlock, const QString &expression, int endOfExpression); diff --git a/src/plugins/cpptools/cppelementevaluator.cpp b/src/plugins/cpptools/cppelementevaluator.cpp index 90fb21a34c4..afd8944bde9 100644 --- a/src/plugins/cpptools/cppelementevaluator.cpp +++ b/src/plugins/cpptools/cppelementevaluator.cpp @@ -373,7 +373,7 @@ void CppElementEvaluator::execute() // Fetch the expression's code ExpressionUnderCursor expressionUnderCursor(doc->languageFeatures()); const QString &expression = expressionUnderCursor(m_tc); - Scope *scope = doc->scopeAt(line, column); + Scope *scope = doc->scopeAt(line, column - 1); TypeOfExpression typeOfExpression; typeOfExpression.init(doc, snapshot); diff --git a/src/plugins/cpptools/cppfollowsymbolundercursor.cpp b/src/plugins/cpptools/cppfollowsymbolundercursor.cpp index 65bfd310a55..a66c357986b 100644 --- a/src/plugins/cpptools/cppfollowsymbolundercursor.cpp +++ b/src/plugins/cpptools/cppfollowsymbolundercursor.cpp @@ -491,12 +491,12 @@ void FollowSymbolUnderCursor::findLink( { Link link; - int lineNumber = 0, positionInBlock = 0; + int line = 0; + int column = 0; QTextCursor cursor = data.cursor(); QTextDocument *document = cursor.document(); - Utils::Text::convertPosition(document, cursor.position(), &lineNumber, &positionInBlock); - const unsigned line = lineNumber; - const unsigned column = positionInBlock + 1; + Utils::Text::convertPosition(document, cursor.position(), &line, &column); + const int positionInBlock = column - 1; Snapshot snapshot = theSnapshot; @@ -541,8 +541,8 @@ void FollowSymbolUnderCursor::findLink( for (int i = 0; i < tokens.size(); ++i) { const Token &tk = tokens.at(i); - if (((unsigned) positionInBlock) >= tk.utf16charsBegin() - && ((unsigned) positionInBlock) < tk.utf16charsEnd()) { + if (static_cast(positionInBlock) >= tk.utf16charsBegin() + && static_cast(positionInBlock) < tk.utf16charsEnd()) { int closingParenthesisPos = tokens.size(); if (i >= 2 && tokens.at(i).is(T_IDENTIFIER) && tokens.at(i - 1).is(T_LPAREN) && (tokens.at(i - 2).is(T_SIGNAL) || tokens.at(i - 2).is(T_SLOT))) { @@ -584,8 +584,8 @@ void FollowSymbolUnderCursor::findLink( // In this case we want to look at one token before the current position to recognize // an operator if the cursor is inside the actual operator: operator[$] - if (unsigned(positionInBlock) >= tk.utf16charsBegin() - && unsigned(positionInBlock) <= tk.utf16charsEnd()) { + if (static_cast(positionInBlock) >= tk.utf16charsBegin() + && static_cast(positionInBlock) <= tk.utf16charsEnd()) { cursorRegionReached = true; if (tk.is(T_OPERATOR)) { link = attemptFuncDeclDef(cursor, theSnapshot, @@ -675,7 +675,7 @@ void FollowSymbolUnderCursor::findLink( } // Find the last symbol up to the cursor position - Scope *scope = doc->scopeAt(line, column); + Scope *scope = doc->scopeAt(line, positionInBlock); if (!scope) return processLinkCallback(link); @@ -698,19 +698,21 @@ void FollowSymbolUnderCursor::findLink( if (d->isDeclaration() || d->isFunction()) { const QString fileName = QString::fromUtf8(d->fileName(), d->fileNameLength()); if (data.filePath().toString() == fileName) { - if (unsigned(lineNumber) == d->line() - && unsigned(positionInBlock) >= d->column()) { // TODO: check the end + if (static_cast(line) == d->line() + && static_cast(positionInBlock) >= d->column()) { + // TODO: check the end result = r; // take the symbol under cursor. break; } } } else if (d->isUsingDeclaration()) { - int tokenBeginLineNumber = 0, tokenBeginColumnNumber = 0; + int tokenBeginLineNumber = 0; + int tokenBeginColumnNumber = 0; Utils::Text::convertPosition(document, beginOfToken, &tokenBeginLineNumber, &tokenBeginColumnNumber); - if (unsigned(tokenBeginLineNumber) > d->line() - || (unsigned(tokenBeginLineNumber) == d->line() - && unsigned(tokenBeginColumnNumber) > d->column())) { + if (static_cast(tokenBeginLineNumber) > d->line() + || (static_cast(tokenBeginLineNumber) == d->line() + && static_cast(tokenBeginColumnNumber) >= d->column())) { result = r; // take the symbol under cursor. break; } diff --git a/src/plugins/debugger/analyzer/analyzerutils.cpp b/src/plugins/debugger/analyzer/analyzerutils.cpp index ec181953951..4c6e92ddbcc 100644 --- a/src/plugins/debugger/analyzer/analyzerutils.cpp +++ b/src/plugins/debugger/analyzer/analyzerutils.cpp @@ -74,7 +74,7 @@ CPlusPlus::Symbol *AnalyzerUtils::findSymbolUnderCursor() CPlusPlus::ExpressionUnderCursor expressionUnderCursor(doc->languageFeatures()); moveCursorToEndOfName(&tc); const QString &expression = expressionUnderCursor(tc); - CPlusPlus::Scope *scope = doc->scopeAt(line, column); + CPlusPlus::Scope *scope = doc->scopeAt(line, column - 1); CPlusPlus::TypeOfExpression typeOfExpression; typeOfExpression.init(doc, snapshot); diff --git a/src/plugins/debugger/breakhandler.cpp b/src/plugins/debugger/breakhandler.cpp index 7ac4671ed8b..bf340113275 100644 --- a/src/plugins/debugger/breakhandler.cpp +++ b/src/plugins/debugger/breakhandler.cpp @@ -1408,8 +1408,9 @@ void BreakHandler::handleAlienBreakpoint(const QString &responseId, const Breakp } else { bp = new BreakpointItem(nullptr); bp->m_responseId = responseId; - bp->setState(BreakpointInserted); - bp->setParameters(params); + bp->m_parameters = params; + bp->m_state = BreakpointInserted; + bp->updateMarker(); rootItem()->appendChild(bp); // This has no global breakpoint, so there's nothing to update here. } diff --git a/src/plugins/debugger/debuggerengine.cpp b/src/plugins/debugger/debuggerengine.cpp index 7ee5dcec54c..e425138a2ae 100644 --- a/src/plugins/debugger/debuggerengine.cpp +++ b/src/plugins/debugger/debuggerengine.cpp @@ -793,8 +793,8 @@ void DebuggerEnginePrivate::setupViews() m_perspective->addWindow(m_modulesWindow, Perspective::AddToTab, m_threadsWindow, false); m_perspective->addWindow(m_sourceFilesWindow, Perspective::AddToTab, m_modulesWindow, false); m_perspective->addWindow(m_localsAndInspectorWindow, Perspective::AddToTab, nullptr, true, Qt::RightDockWidgetArea); - m_perspective->addWindow(m_watchersWindow, Perspective::AddToTab, m_localsAndInspectorWindow, true, Qt::RightDockWidgetArea); - m_perspective->addWindow(m_registerWindow, Perspective::AddToTab, m_watchersWindow, false, Qt::RightDockWidgetArea); + m_perspective->addWindow(m_watchersWindow, Perspective::SplitVertical, m_localsAndInspectorWindow, true, Qt::RightDockWidgetArea); + m_perspective->addWindow(m_registerWindow, Perspective::AddToTab, m_localsAndInspectorWindow, false, Qt::RightDockWidgetArea); m_perspective->addWindow(m_logWindow, Perspective::AddToTab, nullptr, false, Qt::TopDockWidgetArea); m_perspective->select(); diff --git a/src/plugins/debugger/debuggerplugin.cpp b/src/plugins/debugger/debuggerplugin.cpp index 81c6ac8ee33..7447d46916a 100644 --- a/src/plugins/debugger/debuggerplugin.cpp +++ b/src/plugins/debugger/debuggerplugin.cpp @@ -1471,7 +1471,7 @@ void DebuggerPluginPrivate::updatePresetState() // No engine running -- or -- we have a running engine but it does not // correspond to the current start up project. m_startAction.setEnabled(canRun); - m_startAction.setIcon(startIcon(false)); + m_startAction.setIcon(startIcon(true)); m_startAction.setToolButtonStyle(Qt::ToolButtonTextBesideIcon); m_startAction.setVisible(true); m_debugWithoutDeployAction.setEnabled(canRun); diff --git a/src/plugins/debugger/enginemanager.cpp b/src/plugins/debugger/enginemanager.cpp index 8e829c7cfb0..9ac2e31b11e 100644 --- a/src/plugins/debugger/enginemanager.cpp +++ b/src/plugins/debugger/enginemanager.cpp @@ -133,7 +133,10 @@ public: EngineManagerPrivate() { m_engineModel.setHeader({EngineManager::tr("Name"), EngineManager::tr("File")}); - m_engineModel.rootItem()->appendChild(new EngineItem); // The preset case. + // The preset case: + auto preset = new EngineItem; + m_engineModel.rootItem()->appendChild(preset); + m_currentItem = preset; m_engineChooser = new QComboBox; m_engineChooser->setModel(&m_engineModel); diff --git a/src/plugins/debugger/gdb/gdbengine.cpp b/src/plugins/debugger/gdb/gdbengine.cpp index ad4b484d684..fb417f5540c 100644 --- a/src/plugins/debugger/gdb/gdbengine.cpp +++ b/src/plugins/debugger/gdb/gdbengine.cpp @@ -1456,6 +1456,8 @@ void GdbEngine::handleStop2(const GdbMi &data) // stopping debugging. if (name == stopSignal(rp.toolChainAbi) || rp.expectedSignals.contains(name)) { showMessage(name + " CONSIDERED HARMLESS. CONTINUING."); + } else if (m_isQnxGdb && name == "0" && meaning == "Signal 0") { + showMessage("SIGNAL 0 CONSIDERED BOGUS."); } else { showMessage("HANDLING SIGNAL " + name); if (boolSetting(UseMessageBoxForSignals) && !isStopperThread) diff --git a/src/plugins/debugger/lldb/lldbengine.cpp b/src/plugins/debugger/lldb/lldbengine.cpp index 9d13f1d2ebe..f6e81e069ea 100644 --- a/src/plugins/debugger/lldb/lldbengine.cpp +++ b/src/plugins/debugger/lldb/lldbengine.cpp @@ -253,20 +253,15 @@ void LldbEngine::setupEngine() const DebuggerRunParameters &rp = runParameters(); - QString executable; - QtcProcess::Arguments args; - QtcProcess::prepareCommand(QFileInfo(rp.inferior.executable).absoluteFilePath(), - rp.inferior.commandLineArguments, &executable, &args); - DebuggerCommand cmd2("setupInferior"); - cmd2.arg("executable", executable); + cmd2.arg("executable", rp.inferior.executable); cmd2.arg("breakonmain", rp.breakOnMain); cmd2.arg("useterminal", bool(terminal())); cmd2.arg("startmode", rp.startMode); cmd2.arg("nativemixed", isNativeMixedActive()); cmd2.arg("workingdirectory", rp.inferior.workingDirectory); cmd2.arg("environment", rp.inferior.environment.toStringList()); - cmd2.arg("processargs", args.toUnixArgs()); + cmd2.arg("processargs", toHex(rp.inferior.commandLineArguments)); if (terminal()) { const qint64 attachedPID = terminal()->applicationPid(); diff --git a/src/plugins/debugger/threadshandler.cpp b/src/plugins/debugger/threadshandler.cpp index 205790eb401..de58f7b6155 100644 --- a/src/plugins/debugger/threadshandler.cpp +++ b/src/plugins/debugger/threadshandler.cpp @@ -221,13 +221,11 @@ ThreadsHandler::ThreadsHandler(DebuggerEngine *engine) tr("Address"), tr("Function"), tr("File"), tr("Line"), tr("State"), tr("Name"), tr("Target ID"), tr("Details"), tr("Core"), }); +} - m_comboBox = new QComboBox; - m_comboBox->setSizeAdjustPolicy(QComboBox::AdjustToContents); - m_comboBox->setModel(this); - connect(m_comboBox, QOverload::of(&QComboBox::activated), this, [this](int row) { - setData(index(row, 0), {}, BaseTreeView::ItemActivatedRole); - }); +ThreadsHandler::~ThreadsHandler() +{ + delete m_comboBox; } QVariant ThreadsHandler::data(const QModelIndex &index, int role) const @@ -249,7 +247,7 @@ bool ThreadsHandler::setData(const QModelIndex &idx, const QVariant &data, int r const Thread thread = itemForIndexAtLevel<1>(idx); if (thread != m_currentThread) { m_currentThread = thread; - m_comboBox->setCurrentIndex(idx.row()); + threadSwitcher()->setCurrentIndex(idx.row()); m_engine->selectThread(thread); } return true; @@ -364,6 +362,19 @@ void ThreadsHandler::notifyStopped(const QString &id) thread->notifyStopped(); } +QPointer ThreadsHandler::threadSwitcher() +{ + if (!m_comboBox) { + m_comboBox = new QComboBox; + m_comboBox->setSizeAdjustPolicy(QComboBox::AdjustToContents); + m_comboBox->setModel(this); + connect(m_comboBox, QOverload::of(&QComboBox::activated), this, [this](int row) { + setData(index(row, 0), {}, BaseTreeView::ItemActivatedRole); + }); + } + return m_comboBox; +} + void ThreadsHandler::setThreads(const GdbMi &data) { rootItem()->removeChildren(); diff --git a/src/plugins/debugger/threadshandler.h b/src/plugins/debugger/threadshandler.h index 5c8cb189c4f..e365c8e462e 100644 --- a/src/plugins/debugger/threadshandler.h +++ b/src/plugins/debugger/threadshandler.h @@ -77,6 +77,7 @@ class ThreadsHandler : public ThreadsHandlerModel public: explicit ThreadsHandler(DebuggerEngine *engine); + ~ThreadsHandler(); Thread currentThread() const; Thread threadForId(const QString &id) const; @@ -95,7 +96,7 @@ public: void notifyRunning(const QString &id); void notifyStopped(const QString &id); - QComboBox *threadSwitcher() { return m_comboBox; } + QPointer threadSwitcher(); private: void sort(int column, Qt::SortOrder order) override; @@ -105,7 +106,7 @@ private: DebuggerEngine *m_engine; Thread m_currentThread; QHash m_pidForGroupId; - QComboBox *m_comboBox; + QPointer m_comboBox; }; } // namespace Internal diff --git a/src/plugins/designer/qtcreatorintegration.cpp b/src/plugins/designer/qtcreatorintegration.cpp index 703fac1434d..9d3f9919a0a 100644 --- a/src/plugins/designer/qtcreatorintegration.cpp +++ b/src/plugins/designer/qtcreatorintegration.cpp @@ -329,7 +329,8 @@ static Document::Ptr addDefinition(const Snapshot &docTable, const QString contents = editor->textDocument()->plainText(); int column; editor->convertPosition(contents.length(), line, &column); - editor->gotoLine(*line, column); + // gotoLine accepts 0-based column. + editor->gotoLine(*line, column - 1); editor->insert(definition); *line += 1; } diff --git a/src/plugins/git/branchmodel.cpp b/src/plugins/git/branchmodel.cpp index 8c9db00828a..b045953e180 100644 --- a/src/plugins/git/branchmodel.cpp +++ b/src/plugins/git/branchmodel.cpp @@ -318,7 +318,7 @@ Qt::ItemFlags BranchModel::flags(const QModelIndex &index) const if (!node) return Qt::NoItemFlags; Qt::ItemFlags res = Qt::ItemIsSelectable | Qt::ItemIsEnabled; - if (node->isLeaf() && node->isLocal()) + if (node->isLeaf() && node->isLocal() && index.column() == 0) res |= Qt::ItemIsEditable; return res; } diff --git a/src/plugins/projectexplorer/gcctoolchain.cpp b/src/plugins/projectexplorer/gcctoolchain.cpp index c29b39d2ca4..f0469b9c472 100644 --- a/src/plugins/projectexplorer/gcctoolchain.cpp +++ b/src/plugins/projectexplorer/gcctoolchain.cpp @@ -544,7 +544,8 @@ QStringList GccToolChain::gccPrepareArguments(const QStringList &flags, allFlags << platformCodeGenFlags << flags; for (int i = 0; i < allFlags.size(); ++i) { const QString &flag = allFlags.at(i); - if (flag.startsWith("-stdlib=") || flag.startsWith("--gcctoolchain=")) { + if (flag.startsWith("-stdlib=") || flag.startsWith("--gcctoolchain=") + || flag.startsWith("-B")) { arguments << flag; } else if (!hasKitSysroot) { // pass build system's sysroot to compiler, if we didn't pass one from kit diff --git a/src/plugins/projectexplorer/makestep.cpp b/src/plugins/projectexplorer/makestep.cpp index ea8223e60c1..504892c1494 100644 --- a/src/plugins/projectexplorer/makestep.cpp +++ b/src/plugins/projectexplorer/makestep.cpp @@ -196,14 +196,23 @@ void MakeStep::setJobCountOverrideMakeflags(bool override) m_overrideMakeflags = override; } +static bool argsContainsJobCount(const QString &str) +{ + const QStringList args = Utils::QtcProcess::splitArgs(str, Utils::HostOsInfo::hostOs()); + return Utils::anyOf(args, [](const QString &arg) { return arg.startsWith("-j"); }); +} + bool MakeStep::makeflagsContainsJobCount() const { const Utils::Environment env = environment(buildConfiguration()); if (!env.hasKey(MAKEFLAGS)) return false; - const QStringList args = Utils::QtcProcess::splitArgs(env.value(MAKEFLAGS), - Utils::HostOsInfo::hostOs()); - return Utils::anyOf(args, [](const QString &arg) { return arg.startsWith("-j"); }); + return argsContainsJobCount(env.value(MAKEFLAGS)); +} + +bool MakeStep::userArgsContainsJobCount() const +{ + return argsContainsJobCount(m_makeArguments); } Utils::Environment MakeStep::environment(BuildConfiguration *bc) const @@ -262,8 +271,10 @@ int MakeStep::defaultJobCount() QStringList MakeStep::jobArguments() const { - if (!isJobCountSupported() || (makeflagsContainsJobCount() && !jobCountOverridesMakeflags())) + if (!isJobCountSupported() || userArgsContainsJobCount() + || (makeflagsContainsJobCount() && !jobCountOverridesMakeflags())) { return {}; + } return {"-j" + QString::number(m_userJobCount)}; } @@ -408,6 +419,13 @@ void MakeStepConfigWidget::setUserJobCountVisible(bool visible) m_ui->overrideMakeflags->setVisible(visible); } +void MakeStepConfigWidget::setUserJobCountEnabled(bool enabled) +{ + m_ui->jobsLabel->setEnabled(enabled); + m_ui->userJobCount->setEnabled(enabled); + m_ui->overrideMakeflags->setEnabled(enabled); +} + void MakeStepConfigWidget::updateDetails() { BuildConfiguration *bc = m_makeStep->buildConfiguration(); @@ -428,6 +446,7 @@ void MakeStepConfigWidget::updateDetails() } setUserJobCountVisible(m_makeStep->isJobCountSupported()); + setUserJobCountEnabled(!m_makeStep->userArgsContainsJobCount()); m_ui->userJobCount->setValue(m_makeStep->jobCount()); m_ui->overrideMakeflags->setCheckState( m_makeStep->jobCountOverridesMakeflags() ? Qt::Checked : Qt::Unchecked); diff --git a/src/plugins/projectexplorer/makestep.h b/src/plugins/projectexplorer/makestep.h index 94e71376f7f..0b4541b2116 100644 --- a/src/plugins/projectexplorer/makestep.h +++ b/src/plugins/projectexplorer/makestep.h @@ -73,6 +73,7 @@ public: bool jobCountOverridesMakeflags() const; void setJobCountOverrideMakeflags(bool override); bool makeflagsContainsJobCount() const; + bool userArgsContainsJobCount() const; Utils::Environment environment(BuildConfiguration *bc) const; @@ -105,6 +106,7 @@ private: void makeArgumentsLineEditTextEdited(); void updateDetails(); void setUserJobCountVisible(bool visible); + void setUserJobCountEnabled(bool enabled); Internal::Ui::MakeStep *m_ui; MakeStep *m_makeStep; diff --git a/src/plugins/qmakeprojectmanager/profileeditor.cpp b/src/plugins/qmakeprojectmanager/profileeditor.cpp index fb854311a75..cb261427674 100644 --- a/src/plugins/qmakeprojectmanager/profileeditor.cpp +++ b/src/plugins/qmakeprojectmanager/profileeditor.cpp @@ -81,8 +81,10 @@ void ProFileEditorWidget::findLinkAt(const QTextCursor &cursor, { Link link; - int lineNumber = 0, positionInBlock = 0; - convertPosition(cursor.position(), &lineNumber, &positionInBlock); + int line = 0; + int column = 0; + convertPosition(cursor.position(), &line, &column); + const int positionInBlock = column - 1; const QString block = cursor.block().text(); diff --git a/src/plugins/qmakeprojectmanager/qmakeprojectmanager.cpp b/src/plugins/qmakeprojectmanager/qmakeprojectmanager.cpp index 6e3a3e43ad4..3af228874a7 100644 --- a/src/plugins/qmakeprojectmanager/qmakeprojectmanager.cpp +++ b/src/plugins/qmakeprojectmanager/qmakeprojectmanager.cpp @@ -128,7 +128,8 @@ void QmakeManager::addLibraryImpl(const QString &fileName, BaseTextEditor *edito // add extra \n in case the last line is not empty int line, column; editor->convertPosition(endOfDoc, &line, &column); - if (!editor->textAt(endOfDoc - column, column).simplified().isEmpty()) + const int positionInBlock = column - 1; + if (!editor->textAt(endOfDoc - positionInBlock, positionInBlock).simplified().isEmpty()) snippet = QLatin1Char('\n') + snippet; editor->insert(snippet); diff --git a/src/plugins/qmldesigner/components/texteditor/texteditorwidget.cpp b/src/plugins/qmldesigner/components/texteditor/texteditorwidget.cpp index 8bf98d79c97..240fe160d4b 100644 --- a/src/plugins/qmldesigner/components/texteditor/texteditorwidget.cpp +++ b/src/plugins/qmldesigner/components/texteditor/texteditorwidget.cpp @@ -133,9 +133,10 @@ void TextEditorWidget::jumpTextCursorToSelectedModelNode() const int nodeOffset = rewriterView->nodeOffset(selectedNode); if (nodeOffset > 0) { - int line, column; - m_textEditor->editorWidget()->convertPosition(nodeOffset, &line, &column); - m_textEditor->editorWidget()->gotoLine(line, column); + int line, column; + m_textEditor->editorWidget()->convertPosition(nodeOffset, &line, &column); + // line has to be 1 based, column 0 based! + m_textEditor->editorWidget()->gotoLine(line, column - 1); } } m_updateSelectionTimer.stop(); diff --git a/src/plugins/qmldesigner/componentsplugin/images/column-layouts-icon-16px.png b/src/plugins/qmldesigner/componentsplugin/images/column-layouts-icon-16px.png index 9e17cc85bf8..1113e8148b8 100644 Binary files a/src/plugins/qmldesigner/componentsplugin/images/column-layouts-icon-16px.png and b/src/plugins/qmldesigner/componentsplugin/images/column-layouts-icon-16px.png differ diff --git a/src/plugins/qmldesigner/componentsplugin/images/row-layouts-icon-16px.png b/src/plugins/qmldesigner/componentsplugin/images/row-layouts-icon-16px.png index 706194278ea..9e17cc85bf8 100644 Binary files a/src/plugins/qmldesigner/componentsplugin/images/row-layouts-icon-16px.png and b/src/plugins/qmldesigner/componentsplugin/images/row-layouts-icon-16px.png differ diff --git a/src/plugins/qmldesigner/designercore/include/abstractview.h b/src/plugins/qmldesigner/designercore/include/abstractview.h index 4eb4f056666..4136be46725 100644 --- a/src/plugins/qmldesigner/designercore/include/abstractview.h +++ b/src/plugins/qmldesigner/designercore/include/abstractview.h @@ -259,6 +259,7 @@ public: virtual void contextHelpId(const Core::IContext::HelpIdCallback &callback) const; + void activateTimeline(const ModelNode &timeline); void activateTimelineRecording(const ModelNode &timeline); void deactivateTimelineRecording(); diff --git a/src/plugins/qmldesigner/designercore/include/qmltimeline.h b/src/plugins/qmldesigner/designercore/include/qmltimeline.h index 75280ba5f75..a92a2921198 100644 --- a/src/plugins/qmldesigner/designercore/include/qmltimeline.h +++ b/src/plugins/qmldesigner/designercore/include/qmltimeline.h @@ -67,6 +67,11 @@ public: void destroyKeyframesForTarget(const ModelNode &target); static bool hasActiveTimeline(AbstractView *view); + bool isRecording() const; + void toogleRecording(bool b) const; + + void resetGroupRecording() const; + private: void addKeyframeGroupIfNotExists(const ModelNode &node, const PropertyName &propertyName); bool hasKeyframeGroup(const ModelNode &node, const PropertyName &propertyName) const; diff --git a/src/plugins/qmldesigner/designercore/model/abstractview.cpp b/src/plugins/qmldesigner/designercore/model/abstractview.cpp index cc2f1412eea..5d536fb0c41 100644 --- a/src/plugins/qmldesigner/designercore/model/abstractview.cpp +++ b/src/plugins/qmldesigner/designercore/model/abstractview.cpp @@ -586,17 +586,37 @@ void AbstractView::contextHelpId(const Core::IContext::HelpIdCallback &callback) #endif } -void AbstractView::activateTimelineRecording(const ModelNode &timeline) +void AbstractView::activateTimeline(const ModelNode &timeline) { + if (currentTimeline().isValid()) + currentTimeline().toogleRecording(false); + Internal::WriteLocker locker(m_model.data()); + if (model()) model()->d->notifyCurrentTimelineChanged(timeline); +} +void AbstractView::activateTimelineRecording(const ModelNode &timeline) +{ + if (currentTimeline().isValid()) + currentTimeline().toogleRecording(true); + + Internal::WriteLocker locker(m_model.data()); + + if (model()) + model()->d->notifyCurrentTimelineChanged(timeline); } void AbstractView::deactivateTimelineRecording() { + if (currentTimeline().isValid()) { + currentTimeline().toogleRecording(false); + currentTimeline().resetGroupRecording(); + } + Internal::WriteLocker locker(m_model.data()); + if (model()) model()->d->notifyCurrentTimelineChanged(ModelNode()); } diff --git a/src/plugins/qmldesigner/designercore/model/qmlobjectnode.cpp b/src/plugins/qmldesigner/designercore/model/qmlobjectnode.cpp index 650d1e73059..ad7cf13efc0 100644 --- a/src/plugins/qmldesigner/designercore/model/qmlobjectnode.cpp +++ b/src/plugins/qmldesigner/designercore/model/qmlobjectnode.cpp @@ -52,7 +52,7 @@ void QmlObjectNode::setVariantProperty(const PropertyName &name, const QVariant if (!isValid()) throw new InvalidModelNodeException(__LINE__, __FUNCTION__, __FILE__); - if (timelineIsActive()) { + if (timelineIsActive() && currentTimeline().isRecording()) { modelNode().validId(); QmlTimelineKeyframeGroup timelineFrames(currentTimeline().keyframeGroup(modelNode(), name)); @@ -63,6 +63,18 @@ void QmlObjectNode::setVariantProperty(const PropertyName &name, const QVariant timelineFrames.setValue(value, frame); return; + } else if (timelineIsActive()) { + + QmlTimelineKeyframeGroup timelineFrames(currentTimeline().keyframeGroup(modelNode(), name)); + + Q_ASSERT(timelineFrames.isValid()); + + if (timelineFrames.isRecording()) { + qreal frame = currentTimeline().modelNode().auxiliaryData("currentFrame@NodeInstance").toReal(); + timelineFrames.setValue(value, frame); + + return; + } } if (isInBaseState()) { diff --git a/src/plugins/qmldesigner/designercore/model/qmltimeline.cpp b/src/plugins/qmldesigner/designercore/model/qmltimeline.cpp index 1cc44716640..04139385d28 100644 --- a/src/plugins/qmldesigner/designercore/model/qmltimeline.cpp +++ b/src/plugins/qmldesigner/designercore/model/qmltimeline.cpp @@ -224,6 +224,37 @@ bool QmlTimeline::hasActiveTimeline(AbstractView *view) return false; } +bool QmlTimeline::isRecording() const +{ + QTC_ASSERT(isValid(), return false); + + return modelNode().hasAuxiliaryData("Record@Internal"); +} + +void QmlTimeline::toogleRecording(bool record) const +{ + QTC_ASSERT(isValid(), return); + + if (!record) { + if (isRecording()) + modelNode().removeAuxiliaryData("Record@Internal"); + } else { + modelNode().setAuxiliaryData("Record@Internal", true); + } +} + +void QmlTimeline::resetGroupRecording() const +{ + QTC_ASSERT(isValid(), return); + + for (const ModelNode &childNode : modelNode().defaultNodeListProperty().toModelNodeList()) { + if (QmlTimelineKeyframeGroup::isValidQmlTimelineKeyframeGroup(childNode)) { + const QmlTimelineKeyframeGroup frames(childNode); + frames.toogleRecording(false); + } + } +} + void QmlTimeline::addKeyframeGroupIfNotExists(const ModelNode &node, const PropertyName &propertyName) { if (!isValid()) diff --git a/src/plugins/qmldesigner/designercore/model/qmltimelinekeyframegroup.cpp b/src/plugins/qmldesigner/designercore/model/qmltimelinekeyframegroup.cpp index e105fb279b9..35ff98710ca 100644 --- a/src/plugins/qmldesigner/designercore/model/qmltimelinekeyframegroup.cpp +++ b/src/plugins/qmldesigner/designercore/model/qmltimelinekeyframegroup.cpp @@ -129,7 +129,7 @@ bool QmlTimelineKeyframeGroup::isRecording() const { QTC_ASSERT(isValid(), return false); - return modelNode().hasAuxiliaryData("REC@Internal"); + return modelNode().hasAuxiliaryData("Record@Internal"); } void QmlTimelineKeyframeGroup::toogleRecording(bool record) const @@ -138,9 +138,9 @@ void QmlTimelineKeyframeGroup::toogleRecording(bool record) const if (!record) { if (isRecording()) - modelNode().removeAuxiliaryData("REC@Internal"); + modelNode().removeAuxiliaryData("Record@Internal"); } else { - modelNode().setAuxiliaryData("REC@Internal", true); + modelNode().setAuxiliaryData("Record@Internal", true); } } diff --git a/src/plugins/qmldesigner/qmldesignerplugin.cpp b/src/plugins/qmldesigner/qmldesignerplugin.cpp index 877010a3b72..9ab39cce379 100644 --- a/src/plugins/qmldesigner/qmldesignerplugin.cpp +++ b/src/plugins/qmldesigner/qmldesignerplugin.cpp @@ -374,7 +374,8 @@ void QmlDesignerPlugin::jumpTextCursorToSelectedModelNode() if (currentSelectedNode != selectedNode) { int line, column; currentDesignDocument()->textEditor()->convertPosition(nodeOffset, &line, &column); - currentDesignDocument()->textEditor()->gotoLine(line, column); + // line has to be 1 based, column 0 based! + currentDesignDocument()->textEditor()->gotoLine(line, column - 1); } } } diff --git a/src/plugins/qmldesigner/qtquickplugin/images/column-positioner-icon-16px.png b/src/plugins/qmldesigner/qtquickplugin/images/column-positioner-icon-16px.png index 9e17cc85bf8..1113e8148b8 100644 Binary files a/src/plugins/qmldesigner/qtquickplugin/images/column-positioner-icon-16px.png and b/src/plugins/qmldesigner/qtquickplugin/images/column-positioner-icon-16px.png differ diff --git a/src/plugins/qmldesigner/qtquickplugin/images/column-positioner-icon.png b/src/plugins/qmldesigner/qtquickplugin/images/column-positioner-icon.png index a75ee209d5c..df4b60327e0 100644 Binary files a/src/plugins/qmldesigner/qtquickplugin/images/column-positioner-icon.png and b/src/plugins/qmldesigner/qtquickplugin/images/column-positioner-icon.png differ diff --git a/src/plugins/qmldesigner/qtquickplugin/images/row-positioner-icon-16px.png b/src/plugins/qmldesigner/qtquickplugin/images/row-positioner-icon-16px.png index 1113e8148b8..9e17cc85bf8 100644 Binary files a/src/plugins/qmldesigner/qtquickplugin/images/row-positioner-icon-16px.png and b/src/plugins/qmldesigner/qtquickplugin/images/row-positioner-icon-16px.png differ diff --git a/src/plugins/qmldesigner/qtquickplugin/images/row-positioner-icon.png b/src/plugins/qmldesigner/qtquickplugin/images/row-positioner-icon.png index df4b60327e0..a75ee209d5c 100644 Binary files a/src/plugins/qmldesigner/qtquickplugin/images/row-positioner-icon.png and b/src/plugins/qmldesigner/qtquickplugin/images/row-positioner-icon.png differ diff --git a/src/plugins/qmldesigner/qtquickplugin/images/row-positioner-icon@2x.png b/src/plugins/qmldesigner/qtquickplugin/images/row-positioner-icon@2x.png index ffef790cdc0..c70f845e708 100644 Binary files a/src/plugins/qmldesigner/qtquickplugin/images/row-positioner-icon@2x.png and b/src/plugins/qmldesigner/qtquickplugin/images/row-positioner-icon@2x.png differ diff --git a/src/plugins/serialterminal/serialoutputpane.cpp b/src/plugins/serialterminal/serialoutputpane.cpp index 12613d447df..0ae2cf1e42f 100644 --- a/src/plugins/serialterminal/serialoutputpane.cpp +++ b/src/plugins/serialterminal/serialoutputpane.cpp @@ -55,7 +55,7 @@ namespace SerialTerminal { namespace Internal { -static Q_LOGGING_CATEGORY(log, Constants::LOGGING_CATEGORY) +static Q_LOGGING_CATEGORY(log, Constants::LOGGING_CATEGORY, QtWarningMsg) // Tab Widget helper for middle click tab close class TabWidget : public QTabWidget diff --git a/src/plugins/serialterminal/serialterminalsettings.cpp b/src/plugins/serialterminal/serialterminalsettings.cpp index 8136ea3ffa4..7c66d01e2b7 100644 --- a/src/plugins/serialterminal/serialterminalsettings.cpp +++ b/src/plugins/serialterminal/serialterminalsettings.cpp @@ -32,7 +32,7 @@ namespace SerialTerminal { namespace Internal { -static Q_LOGGING_CATEGORY(log, Constants::LOGGING_CATEGORY) +static Q_LOGGING_CATEGORY(log, Constants::LOGGING_CATEGORY, QtWarningMsg) // Set 'value' only if the key exists in the settings template diff --git a/src/plugins/texteditor/codeassist/codeassistant.cpp b/src/plugins/texteditor/codeassist/codeassistant.cpp index 9abbe3a8f19..1290199a54d 100644 --- a/src/plugins/texteditor/codeassist/codeassistant.cpp +++ b/src/plugins/texteditor/codeassist/codeassistant.cpp @@ -104,6 +104,7 @@ private: IAssistProposalWidget *m_proposalWidget = nullptr; QScopedPointer m_proposal; bool m_receivedContentWhileWaiting = false; + bool m_proposalItemProcessed = false; QTimer m_automaticProposalTimer; CompletionSettings m_settings; int m_abortedBasePosition = -1; @@ -192,6 +193,13 @@ void CodeAssistantPrivate::requestProposal(AssistReason reason, if (m_editorWidget->hasBlockSelection()) return; // TODO + if (m_proposalItemProcessed + && reason == IdleEditor + && m_assistKind == TextEditor::Completion + && !identifyActivationSequence()) { + return; + } + if (!provider) { if (kind == Completion) provider = m_editorWidget->textDocument()->completionAssistProvider(); @@ -358,6 +366,15 @@ void CodeAssistantPrivate::processProposalItem(AssistProposalItemInterface *prop if (!proposalItem->isSnippet()) process(); m_editorWidget->encourageApply(); + m_proposalItemProcessed = true; + + auto connection = std::make_shared(); + *connection = connect(m_editorWidget->textDocument(), + &Core::IDocument::contentsChanged, + this, [this, connection] { + m_proposalItemProcessed = false; + disconnect(*connection); + }); } void CodeAssistantPrivate::handlePrefixExpansion(const QString &newPrefix) diff --git a/src/plugins/texteditor/codeassist/genericproposalmodel.cpp b/src/plugins/texteditor/codeassist/genericproposalmodel.cpp index 35e82384b21..1c05e1f1eae 100644 --- a/src/plugins/texteditor/codeassist/genericproposalmodel.cpp +++ b/src/plugins/texteditor/codeassist/genericproposalmodel.cpp @@ -167,29 +167,57 @@ static QString cleanText(const QString &original) return clean; } +static bool textStartsWith(CaseSensitivity cs, const QString &text, const QString &prefix) +{ + switch (cs) { + case TextEditor::CaseInsensitive: + return text.startsWith(prefix, Qt::CaseInsensitive); + case TextEditor::CaseSensitive: + return text.startsWith(prefix, Qt::CaseSensitive); + case TextEditor::FirstLetterCaseSensitive: + return prefix.at(0) == text.at(0) + && prefix.midRef(1).startsWith(text.midRef(1), Qt::CaseInsensitive); + } + + return false; +} + +enum class PerfectMatchType { + None, + StartsWith, + Full, +}; + +static PerfectMatchType perfectMatch(CaseSensitivity cs, const QString &text, const QString &prefix) +{ + if (textStartsWith(cs, text, prefix)) + return prefix.size() == text.size() ? PerfectMatchType::Full : PerfectMatchType::StartsWith; + + return PerfectMatchType::None; +} + bool GenericProposalModel::isPerfectMatch(const QString &prefix) const { if (prefix.isEmpty()) return false; + const CaseSensitivity cs = TextEditorSettings::completionSettings().m_caseSensitivity; + bool hasFullMatch = false; + for (int i = 0; i < size(); ++i) { const QString ¤t = cleanText(text(i)); - if (!current.isEmpty()) { - CaseSensitivity cs = TextEditorSettings::completionSettings().m_caseSensitivity; - if (cs == TextEditor::CaseSensitive) { - if (prefix == current) - return true; - } else if (cs == TextEditor::CaseInsensitive) { - if (prefix.compare(current, Qt::CaseInsensitive) == 0) - return true; - } else if (cs == TextEditor::FirstLetterCaseSensitive) { - if (prefix.at(0) == current.at(0) - && prefix.midRef(1).compare(current.midRef(1), Qt::CaseInsensitive) == 0) - return true; - } - } + if (current.isEmpty()) + continue; + + const PerfectMatchType match = perfectMatch(cs, current, prefix); + if (match == PerfectMatchType::StartsWith) + return false; + + if (!hasFullMatch && match == PerfectMatchType::Full) + hasFullMatch = true; } - return false; + + return hasFullMatch; } bool GenericProposalModel::isPrefiltered(const QString &prefix) const diff --git a/src/plugins/texteditor/generichighlighter/highlighter.cpp b/src/plugins/texteditor/generichighlighter/highlighter.cpp index f7004e878ca..e4d07adef91 100644 --- a/src/plugins/texteditor/generichighlighter/highlighter.cpp +++ b/src/plugins/texteditor/generichighlighter/highlighter.cpp @@ -337,6 +337,13 @@ void Highlighter::iterateThroughRules(const QString &text, const bool childRule, const QList > &rules) { + if (!childRule) { + if (progress->detectRecursion(m_currentContext->id())) { + progress->setOffset(length); + return; + } + } + typedef QList >::const_iterator RuleIterator; bool contextChanged = false; diff --git a/src/plugins/texteditor/generichighlighter/progressdata.cpp b/src/plugins/texteditor/generichighlighter/progressdata.cpp index d79d5b01524..a6453c83998 100644 --- a/src/plugins/texteditor/generichighlighter/progressdata.cpp +++ b/src/plugins/texteditor/generichighlighter/progressdata.cpp @@ -113,3 +113,18 @@ void ProgressData::unTrackRule(Rule *rule) { m_trackedRules.removeAll(rule); } + +bool ProgressData::detectRecursion(const QString &contextId) +{ + if (m_offset != m_iterationOffset) { + m_iterationOffset = m_offset; + m_iterationContextIds.clear(); + } + + if (m_iterationContextIds.contains(contextId)) + return true; + + m_iterationContextIds.append(contextId); + + return false; +} diff --git a/src/plugins/texteditor/generichighlighter/progressdata.h b/src/plugins/texteditor/generichighlighter/progressdata.h index d2b158146d5..7350eb0d047 100644 --- a/src/plugins/texteditor/generichighlighter/progressdata.h +++ b/src/plugins/texteditor/generichighlighter/progressdata.h @@ -67,6 +67,8 @@ public: void trackRule(Rule *rule); void unTrackRule(Rule *rule); + bool detectRecursion(const QString &contextId); + private: int m_offset; int m_savedOffset; @@ -76,6 +78,8 @@ private: bool m_willContinueLine; QStringList m_captures; QList m_trackedRules; + int m_iterationOffset = -1; + QStringList m_iterationContextIds; }; } // namespace Internal diff --git a/src/plugins/texteditor/texteditor.cpp b/src/plugins/texteditor/texteditor.cpp index 3141a126208..37a57412bf7 100644 --- a/src/plugins/texteditor/texteditor.cpp +++ b/src/plugins/texteditor/texteditor.cpp @@ -3104,14 +3104,14 @@ bool TextEditorWidget::restoreState(const QByteArray &state) int version; int vval; int hval; - int lval; - int cval; + int lineVal; + int columnVal; QDataStream stream(state); stream >> version; stream >> vval; stream >> hval; - stream >> lval; - stream >> cval; + stream >> lineVal; + stream >> columnVal; if (version >= 1) { QList collapsedBlocks; @@ -3137,7 +3137,8 @@ bool TextEditorWidget::restoreState(const QByteArray &state) } d->m_lastCursorChangeWasInteresting = false; // avoid adding last position to history - gotoLine(lval, cval); + // line is 1-based, column is 0-based + gotoLine(lineVal, columnVal - 1); verticalScrollBar()->setValue(vval); horizontalScrollBar()->setValue(hval); d->saveCurrentCursorPositionForNavigation(); diff --git a/src/plugins/valgrind/callgrind/callgrindcontroller.cpp b/src/plugins/valgrind/callgrind/callgrindcontroller.cpp index d0633caa837..e0f308ebaab 100644 --- a/src/plugins/valgrind/callgrind/callgrindcontroller.cpp +++ b/src/plugins/valgrind/callgrind/callgrindcontroller.cpp @@ -225,11 +225,11 @@ void CallgrindController::getLocalDataFile() // this, &CallgrindController::foundRemoteFile); // m_findRemoteFile->start(); } else { - QDir dir(workingDir, QString::fromLatin1("%1.*").arg(baseFileName), QDir::Time); - QStringList outputFiles = dir.entryList(); + const QDir dir(workingDir, QString::fromLatin1("%1.*").arg(baseFileName), QDir::Time); + const QStringList outputFiles = dir.entryList(); // if there are files like callgrind.out.PID.NUM, set it to the most recent one of those if (!outputFiles.isEmpty()) - fileName = workingDir + QLatin1Char('/') + dir.entryList().first(); + fileName = workingDir + QLatin1Char('/') + outputFiles.first(); emit localParseDataAvailable(fileName); } diff --git a/src/shared/qbs b/src/shared/qbs index 783f2f91854..03be661fee6 160000 --- a/src/shared/qbs +++ b/src/shared/qbs @@ -1 +1 @@ -Subproject commit 783f2f91854d9c0a3cacca668d52ea761cc2a1b8 +Subproject commit 03be661fee6394e08d122e22a40b7ba6e3818155 diff --git a/src/tools/clangpchmanagerbackend/source/builddependenciesgeneratorinterface.h b/src/tools/clangpchmanagerbackend/source/builddependenciesgeneratorinterface.h new file mode 100644 index 00000000000..f3863d8027b --- /dev/null +++ b/src/tools/clangpchmanagerbackend/source/builddependenciesgeneratorinterface.h @@ -0,0 +1,43 @@ +/**************************************************************************** +** +** Copyright (C) 2018 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +****************************************************************************/ + +#pragma once + +#include "builddependency.h" + +#include "projectpartcontainerv2.h" + +namespace ClangBackEnd { + +class BuildDependenciesGeneratorInterface +{ +public: + virtual BuildDependency create(const V2::ProjectPartContainer &projectPart) = 0; + +protected: + ~BuildDependenciesGeneratorInterface() = default; +}; + +} // namespace ClangBackEnd diff --git a/src/tools/clangpchmanagerbackend/source/builddependenciesprovider.cpp b/src/tools/clangpchmanagerbackend/source/builddependenciesprovider.cpp new file mode 100644 index 00000000000..f10b6494d8c --- /dev/null +++ b/src/tools/clangpchmanagerbackend/source/builddependenciesprovider.cpp @@ -0,0 +1,108 @@ +/**************************************************************************** +** +** Copyright (C) 2018 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +****************************************************************************/ + +#include "builddependenciesprovider.h" + +#include "builddependenciesstorageinterface.h" +#include "modifiedtimecheckerinterface.h" +#include "builddependenciesgeneratorinterface.h" + +#include + +namespace ClangBackEnd { + +template +OutputContainer setUnion(InputContainer1 &&input1, + InputContainer2 &&input2) +{ + OutputContainer results; + results.reserve(input1.size() + input2.size()); + + std::set_union(std::begin(input1), + std::end(input1), + std::begin(input2), + std::end(input2), + std::back_inserter(results)); + + return results; +} + +BuildDependency BuildDependenciesProvider::create(const V2::ProjectPartContainer &projectPart) const +{ + SourceEntries includes = createSourceEntriesFromStorage(projectPart.sourcePathIds, + projectPart.projectPartId); + + if (!m_modifiedTimeChecker.isUpToDate(includes)) + return m_buildDependenciesGenerator.create(projectPart); + + return createBuildDependencyFromStorage(std::move(includes)); + +} + +BuildDependency BuildDependenciesProvider::createBuildDependencyFromStorage(SourceEntries &&includes) const +{ + BuildDependency buildDependency; + + buildDependency.usedMacros = createUsedMacrosFromStorage(includes); + buildDependency.includes = std::move(includes); + + return buildDependency; +} + +UsedMacros BuildDependenciesProvider::createUsedMacrosFromStorage(const SourceEntries &includes) const +{ + UsedMacros usedMacros; + usedMacros.reserve(1024); + + for (const SourceEntry &entry : includes) { + UsedMacros macros = m_buildDependenciesStorage.fetchUsedMacros(entry.sourceId); + std::sort(macros.begin(), macros.end()); + usedMacros.insert(usedMacros.end(), + std::make_move_iterator(macros.begin()), + std::make_move_iterator(macros.end())); + } + + return usedMacros; +} + +SourceEntries BuildDependenciesProvider::createSourceEntriesFromStorage( + const FilePathIds &sourcePathIds, Utils::SmallStringView projectPartId) const +{ + SourceEntries includes; + + for (FilePathId sourcePathId : sourcePathIds) { + SourceEntries entries = m_buildDependenciesStorage.fetchDependSources(sourcePathId, + projectPartId); + SourceEntries mergedEntries = setUnion(includes, entries); + + includes = std::move(mergedEntries); + } + + return includes; +} + +} // namespace ClangBackEnd diff --git a/src/tools/clangpchmanagerbackend/source/builddependenciesprovider.h b/src/tools/clangpchmanagerbackend/source/builddependenciesprovider.h new file mode 100644 index 00000000000..00d4101b166 --- /dev/null +++ b/src/tools/clangpchmanagerbackend/source/builddependenciesprovider.h @@ -0,0 +1,62 @@ +/**************************************************************************** +** +** Copyright (C) 2018 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +****************************************************************************/ + +#pragma once + +#include "builddependenciesproviderinterface.h" + +namespace ClangBackEnd { + +class BuildDependenciesStorageInterface; +class ModifiedTimeCheckerInterface; +class BuildDependenciesGeneratorInterface; + +class BuildDependenciesProvider : public BuildDependenciesProviderInterface +{ +public: + BuildDependenciesProvider(BuildDependenciesStorageInterface &buildDependenciesStorage, + ModifiedTimeCheckerInterface &modifiedTimeChecker, + BuildDependenciesGeneratorInterface &buildDependenciesGenerator) + : m_buildDependenciesStorage(buildDependenciesStorage), + m_modifiedTimeChecker(modifiedTimeChecker), + m_buildDependenciesGenerator(buildDependenciesGenerator) + { + } + + BuildDependency create(const V2::ProjectPartContainer &projectPart) const override; + +private: + BuildDependency createBuildDependencyFromStorage(SourceEntries &&includes) const; + UsedMacros createUsedMacrosFromStorage(const SourceEntries &includes) const; + SourceEntries createSourceEntriesFromStorage(const FilePathIds &sourcePathIds, + Utils::SmallStringView projectPartId) const; + +private: + BuildDependenciesStorageInterface &m_buildDependenciesStorage; + ModifiedTimeCheckerInterface &m_modifiedTimeChecker; + BuildDependenciesGeneratorInterface &m_buildDependenciesGenerator; +}; + +} // namespace ClangBackEnd diff --git a/src/tools/clangpchmanagerbackend/source/builddependenciesproviderinterface.h b/src/tools/clangpchmanagerbackend/source/builddependenciesproviderinterface.h index b02831a7bae..f596b83da9b 100644 --- a/src/tools/clangpchmanagerbackend/source/builddependenciesproviderinterface.h +++ b/src/tools/clangpchmanagerbackend/source/builddependenciesproviderinterface.h @@ -25,7 +25,7 @@ #pragma once -#include "builddependencies.h" +#include "builddependency.h" #include "projectpartcontainerv2.h" @@ -34,7 +34,7 @@ namespace ClangBackEnd { class BuildDependenciesProviderInterface { public: - virtual BuildDependency create(const V2::ProjectPartContainer &projectPart) = 0; + virtual BuildDependency create(const V2::ProjectPartContainer &projectPart) const = 0; protected: ~BuildDependenciesProviderInterface() = default; diff --git a/src/tools/clangpchmanagerbackend/source/usedmacroandsourcestorage.h b/src/tools/clangpchmanagerbackend/source/builddependenciesstorage.h similarity index 75% rename from src/tools/clangpchmanagerbackend/source/usedmacroandsourcestorage.h rename to src/tools/clangpchmanagerbackend/source/builddependenciesstorage.h index ed45465c686..ecb2d7cc7dc 100644 --- a/src/tools/clangpchmanagerbackend/source/usedmacroandsourcestorage.h +++ b/src/tools/clangpchmanagerbackend/source/builddependenciesstorage.h @@ -25,7 +25,7 @@ #pragma once -#include "usedmacroandsourcestorageinterface.h" +#include "builddependenciesstorageinterface.h" #include #include @@ -41,21 +41,31 @@ namespace ClangBackEnd { template -class UsedMacroAndSourceStorage final : public UsedMacroAndSourceStorageInterface +class BuildDependenciesStorage final : public BuildDependenciesStorageInterface { using ReadStatement = typename Database::ReadStatement; using WriteStatement = typename Database::WriteStatement; public: - UsedMacroAndSourceStorage(Database &database) + BuildDependenciesStorage(Database &database) : m_transaction(database), m_database(database) { m_transaction.commit(); } + void updateSources(const SourceEntries &sourceEntries) override + { + for (const SourceEntry &entry : sourceEntries) { + m_updateBuildDependencyTimeStampStatement.write(static_cast(entry.lastModified), + entry.sourceId.filePathId); + m_updateSourceTypeStatement.write(static_cast(entry.sourceType), + entry.sourceId.filePathId); + } + } + void insertFileStatuses(const FileStatuses &fileStatuses) override { - WriteStatement &statement = m_insertFileStatuses; + WriteStatement &statement = m_insertFileStatusesStatement; for (const FileStatus &fileStatus : fileStatuses) statement.write(fileStatus.filePathId.filePathId, @@ -94,6 +104,25 @@ public: m_deleteNewSourceDependenciesStatement.execute(); } + SourceEntries fetchDependSources(FilePathId sourceId, + Utils::SmallStringView projectPartName) const override + { + auto projectPartId = m_fetchProjectPartIdStatement.template value(projectPartName); + + if (projectPartId) { + return m_fetchSourceDependenciesStatement.template values( + 300, + sourceId.filePathId, + projectPartId.value()); + } + return {}; + } + + UsedMacros fetchUsedMacros(FilePathId sourceId) const override + { + return m_fetchUsedMacrosStatement.template values(128, sourceId.filePathId); + } + static Utils::SmallString toJson(const Utils::SmallStringVector &strings) { QJsonDocument document; @@ -178,7 +207,7 @@ public: "INSERT INTO newSourceDependencies(sourceId, dependencySourceId) VALUES (?,?)", m_database }; - WriteStatement m_insertFileStatuses{ + WriteStatement m_insertFileStatusesStatement{ "INSERT OR REPLACE INTO fileStatuses(sourceId, size, lastModified, isInPrecompiledHeader) VALUES (?,?,?,?)", m_database }; @@ -194,5 +223,25 @@ public: "DELETE FROM newSourceDependencies", m_database }; + WriteStatement m_updateBuildDependencyTimeStampStatement{ + "UPDATE fileStatuses SET buildDependencyTimeStamp = ? WHERE sourceId == ?", + m_database + }; + WriteStatement m_updateSourceTypeStatement{ + "UPDATE projectPartsSources SET sourceType = ? WHERE sourceId == ?", + m_database + }; + mutable ReadStatement m_fetchSourceDependenciesStatement{ + "WITH RECURSIVE collectedDependencies(sourceId) AS (VALUES(?) UNION SELECT dependencySourceId FROM sourceDependencies, collectedDependencies WHERE sourceDependencies.sourceId == collectedDependencies.sourceId) SELECT sourceId, buildDependencyTimeStamp, sourceType FROM collectedDependencies NATURAL JOIN projectPartsSources NATURAL JOIN fileStatuses WHERE projectPartId = ?", + m_database + }; + mutable ReadStatement m_fetchProjectPartIdStatement{ + "SELECT projectPartId FROM projectParts WHERE projectPartName = ?", + m_database + }; + mutable ReadStatement m_fetchUsedMacrosStatement{ + "SELECT macroName, sourceId FROM usedMacros WHERE sourceId = ?", + m_database + }; }; } diff --git a/src/tools/clangpchmanagerbackend/source/usedmacroandsourcestorageinterface.h b/src/tools/clangpchmanagerbackend/source/builddependenciesstorageinterface.h similarity index 66% rename from src/tools/clangpchmanagerbackend/source/usedmacroandsourcestorageinterface.h rename to src/tools/clangpchmanagerbackend/source/builddependenciesstorageinterface.h index 2cbb9f84b51..445afa052f2 100644 --- a/src/tools/clangpchmanagerbackend/source/usedmacroandsourcestorageinterface.h +++ b/src/tools/clangpchmanagerbackend/source/builddependenciesstorageinterface.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2017 The Qt Company Ltd. +** Copyright (C) 2018 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of Qt Creator. @@ -25,28 +25,33 @@ #pragma once -#include "filestatus.h" -#include "sourcedependency.h" -#include "usedmacro.h" +#include "sourceentry.h" + +#include +#include +#include +#include +#include namespace ClangBackEnd { -class UsedMacroAndSourceStorageInterface +class BuildDependenciesStorageInterface { public: - UsedMacroAndSourceStorageInterface() = default; - UsedMacroAndSourceStorageInterface(const UsedMacroAndSourceStorageInterface &) = delete; - UsedMacroAndSourceStorageInterface &operator=(const UsedMacroAndSourceStorageInterface &) = delete; + BuildDependenciesStorageInterface() = default; + BuildDependenciesStorageInterface(const BuildDependenciesStorageInterface &) = delete; + BuildDependenciesStorageInterface &operator=(const BuildDependenciesStorageInterface &) = delete; + virtual void updateSources(const SourceEntries &sourceIds) = 0; virtual void insertOrUpdateUsedMacros(const UsedMacros &usedMacros) = 0; virtual void insertFileStatuses(const FileStatuses &fileStatuses) = 0; virtual void insertOrUpdateSourceDependencies(const SourceDependencies &sourceDependencies) = 0; virtual long long fetchLowestLastModifiedTime(FilePathId sourceId) const = 0; - + virtual SourceEntries fetchDependSources(FilePathId sourceId, Utils::SmallStringView projectPartId) const = 0; + virtual UsedMacros fetchUsedMacros(FilePathId sourceId) const = 0; protected: - ~UsedMacroAndSourceStorageInterface() = default; + ~BuildDependenciesStorageInterface() = default; }; } // namespace ClangBackEnd - diff --git a/src/tools/clangpchmanagerbackend/source/builddependencies.h b/src/tools/clangpchmanagerbackend/source/builddependency.h similarity index 93% rename from src/tools/clangpchmanagerbackend/source/builddependencies.h rename to src/tools/clangpchmanagerbackend/source/builddependency.h index 9e0eb3f6293..8821b0162c0 100644 --- a/src/tools/clangpchmanagerbackend/source/builddependencies.h +++ b/src/tools/clangpchmanagerbackend/source/builddependency.h @@ -25,18 +25,18 @@ #pragma once -#include - -#include +#include "sourceentry.h" +#include "usedmacro.h" namespace ClangBackEnd { class BuildDependency { public: - FilePathIds includeIds; + SourceEntries includes; FilePathIds topIncludeIds; FilePathIds topsSystemIncludeIds; + UsedMacros usedMacros; }; using BuildDependencies = std::vector; diff --git a/src/tools/clangpchmanagerbackend/source/clangpchmanagerbackend-source.pri b/src/tools/clangpchmanagerbackend/source/clangpchmanagerbackend-source.pri index ad17b98f18e..abdebd22f08 100644 --- a/src/tools/clangpchmanagerbackend/source/clangpchmanagerbackend-source.pri +++ b/src/tools/clangpchmanagerbackend/source/clangpchmanagerbackend-source.pri @@ -4,7 +4,8 @@ SOURCES += \ $$PWD/pchmanagerserver.cpp \ $$PWD/projectparts.cpp \ $$PWD/projectpartqueue.cpp \ - $$PWD/pchtaskgenerator.cpp + $$PWD/pchtaskgenerator.cpp \ + $$PWD/builddependenciesprovider.cpp HEADERS += \ $$PWD/pchmanagerserver.h \ @@ -23,12 +24,16 @@ HEADERS += \ $$PWD/taskschedulerinterface.h \ $$PWD/precompiledheaderstorage.h \ $$PWD/precompiledheaderstorageinterface.h \ - $$PWD/usedmacroandsourcestorageinterface.h \ - $$PWD/usedmacroandsourcestorage.h \ $$PWD/pchtaskgenerator.h \ $$PWD/pchtask.h \ $$PWD/builddependenciesproviderinterface.h \ - $$PWD/builddependencies.h + $$PWD/builddependenciesprovider.h \ + $$PWD/builddependenciesstorageinterface.h \ + $$PWD/builddependency.h \ + $$PWD/modifiedtimecheckerinterface.h \ + $$PWD/sourceentry.h \ + $$PWD/builddependenciesgeneratorinterface.h \ + $$PWD/builddependenciesstorage.h !isEmpty(LIBTOOLING_LIBS) { SOURCES += \ diff --git a/src/tools/clangpchmanagerbackend/source/modifiedtimecheckerinterface.h b/src/tools/clangpchmanagerbackend/source/modifiedtimecheckerinterface.h new file mode 100644 index 00000000000..c0cae1cf4bb --- /dev/null +++ b/src/tools/clangpchmanagerbackend/source/modifiedtimecheckerinterface.h @@ -0,0 +1,46 @@ +/**************************************************************************** +** +** Copyright (C) 2018 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +****************************************************************************/ + +#pragma once + +#include "sourceentry.h" + +namespace ClangBackEnd { + +class ModifiedTimeCheckerInterface +{ +public: + ModifiedTimeCheckerInterface() = default; + ModifiedTimeCheckerInterface(const ModifiedTimeCheckerInterface &) = delete; + ModifiedTimeCheckerInterface &operator=(const ModifiedTimeCheckerInterface &) = delete; + + virtual bool isUpToDate(const SourceEntries &sourceEntries) const = 0; + +protected: + ~ModifiedTimeCheckerInterface() = default; +}; + +} // namespace ClangBackEnd + diff --git a/src/tools/clangpchmanagerbackend/source/pchtask.h b/src/tools/clangpchmanagerbackend/source/pchtask.h index 39c7bbf01a6..48ae6864ea4 100644 --- a/src/tools/clangpchmanagerbackend/source/pchtask.h +++ b/src/tools/clangpchmanagerbackend/source/pchtask.h @@ -25,7 +25,7 @@ #pragma once -#include "builddependencies.h" +#include "builddependency.h" #include diff --git a/src/tools/clangpchmanagerbackend/source/sourceentry.h b/src/tools/clangpchmanagerbackend/source/sourceentry.h new file mode 100644 index 00000000000..2a5e4ba06fd --- /dev/null +++ b/src/tools/clangpchmanagerbackend/source/sourceentry.h @@ -0,0 +1,96 @@ +/**************************************************************************** +** +** Copyright (C) 2018 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +****************************************************************************/ + +#pragma once + +#include + +#include + +namespace ClangBackEnd { + +enum class SourceType : unsigned char +{ + Any, + TopInclude, + TopSystemInclude +}; + +class TimeStamp +{ + using int64 = long long; +public: + TimeStamp(int64 value) + : value(value) + {} + + operator int64() const + { + return value; + } + + int64 value = -1; +}; + +class SourceEntry +{ + using int64 = long long; +public: + SourceEntry(int sourceId, int64 lastModified, int sourceType) + : lastModified(lastModified), + sourceId(sourceId), + sourceType(static_cast(sourceType)) + + {} + + SourceEntry(FilePathId sourceId, SourceType sourceType, TimeStamp lastModified) + : lastModified(lastModified), + sourceId(sourceId), + sourceType(sourceType) + {} + + friend + bool operator<(SourceEntry first, SourceEntry second) + { + return first.sourceId < second.sourceId; + } + + friend + bool operator==(SourceEntry first, SourceEntry second) + { + return first.sourceId == second.sourceId + && first.sourceType == second.sourceType + && first.lastModified == second.lastModified ; + } + +public: + TimeStamp lastModified; + FilePathId sourceId; + SourceType sourceType = SourceType::Any; +}; + +using SourceEntries = std::vector; + +} diff --git a/src/tools/clangrefactoringbackend/source/clangquery.cpp b/src/tools/clangrefactoringbackend/source/clangquery.cpp index 1524e36da53..21ebeb83674 100644 --- a/src/tools/clangrefactoringbackend/source/clangquery.cpp +++ b/src/tools/clangrefactoringbackend/source/clangquery.cpp @@ -101,7 +101,7 @@ namespace { V2::SourceRangeContainer convertToContainer(const clang::ast_matchers::dynamic::SourceRange sourceRange) { - return V2::SourceRangeContainer({1, 0}, + return V2::SourceRangeContainer(0, sourceRange.Start.Line, sourceRange.Start.Column, 0, diff --git a/src/tools/clangrefactoringbackend/source/symbolindexer.cpp b/src/tools/clangrefactoringbackend/source/symbolindexer.cpp index 02a2fd14a0a..47a02e9fa32 100644 --- a/src/tools/clangrefactoringbackend/source/symbolindexer.cpp +++ b/src/tools/clangrefactoringbackend/source/symbolindexer.cpp @@ -58,7 +58,7 @@ private: SymbolIndexer::SymbolIndexer(SymbolIndexerTaskQueueInterface &symbolIndexerTaskQueue, SymbolStorageInterface &symbolStorage, - UsedMacroAndSourceStorageInterface &usedMacroAndSourceStorage, + BuildDependenciesStorageInterface &usedMacroAndSourceStorage, ClangPathWatcherInterface &pathWatcher, FilePathCachingInterface &filePathCache, FileStatusCache &fileStatusCache, diff --git a/src/tools/clangrefactoringbackend/source/symbolindexer.h b/src/tools/clangrefactoringbackend/source/symbolindexer.h index 6e96e2fee5e..d9070005ce3 100644 --- a/src/tools/clangrefactoringbackend/source/symbolindexer.h +++ b/src/tools/clangrefactoringbackend/source/symbolindexer.h @@ -28,7 +28,7 @@ #include "filestatuscache.h" #include "symbolindexertaskqueueinterface.h" #include "symbolstorageinterface.h" -#include "usedmacroandsourcestorageinterface.h" +#include "builddependenciesstorageinterface.h" #include "clangpathwatcher.h" #include @@ -43,7 +43,7 @@ class SymbolIndexer final : public ClangPathWatcherNotifier public: SymbolIndexer(SymbolIndexerTaskQueueInterface &symbolIndexerTaskQueue, SymbolStorageInterface &symbolStorage, - UsedMacroAndSourceStorageInterface &usedMacroAndSourceStorage, + BuildDependenciesStorageInterface &usedMacroAndSourceStorage, ClangPathWatcherInterface &pathWatcher, FilePathCachingInterface &filePathCache, FileStatusCache &fileStatusCache, @@ -73,7 +73,7 @@ public: private: SymbolIndexerTaskQueueInterface &m_symbolIndexerTaskQueue; SymbolStorageInterface &m_symbolStorage; - UsedMacroAndSourceStorageInterface &m_usedMacroAndSourceStorage; + BuildDependenciesStorageInterface &m_usedMacroAndSourceStorage; ClangPathWatcherInterface &m_pathWatcher; FilePathCachingInterface &m_filePathCache; FileStatusCache &m_fileStatusCache; diff --git a/src/tools/clangrefactoringbackend/source/symbolindexing.h b/src/tools/clangrefactoringbackend/source/symbolindexing.h index 488e73be9ed..d20142870e3 100644 --- a/src/tools/clangrefactoringbackend/source/symbolindexing.h +++ b/src/tools/clangrefactoringbackend/source/symbolindexing.h @@ -34,7 +34,7 @@ #include "taskscheduler.h" #include "symbolstorage.h" -#include +#include #include #include @@ -75,7 +75,7 @@ private: class SymbolIndexing final : public SymbolIndexingInterface { public: - using UsedMacroAndSourceStorage = ClangBackEnd::UsedMacroAndSourceStorage; + using BuildDependenciesStorage = ClangBackEnd::BuildDependenciesStorage; using SymbolStorage = ClangBackEnd::SymbolStorage; SymbolIndexing(Sqlite::Database &database, FilePathCachingInterface &filePathCache, @@ -114,7 +114,7 @@ public: private: using SymbolIndexerTaskScheduler = TaskScheduler; FilePathCachingInterface &m_filePathCache; - UsedMacroAndSourceStorage m_usedMacroAndSourceStorage; + BuildDependenciesStorage m_usedMacroAndSourceStorage; SymbolStorage m_symbolStorage; ClangPathWatcher m_sourceWatcher{m_filePathCache}; FileStatusCache m_fileStatusCache{m_filePathCache}; diff --git a/src/tools/clangrefactoringbackend/source/usedmacro.h b/src/tools/clangrefactoringbackend/source/usedmacro.h index 2c3588da7e7..a7312b63761 100644 --- a/src/tools/clangrefactoringbackend/source/usedmacro.h +++ b/src/tools/clangrefactoringbackend/source/usedmacro.h @@ -42,6 +42,11 @@ public: filePathId(filePathId) {} + UsedMacro(Utils::SmallStringView macroName, int filePathId) + : macroName(macroName), + filePathId(filePathId) + {} + friend bool operator<(const UsedMacro &first, const UsedMacro &second) { return std::tie(first.filePathId, first.macroName) diff --git a/tests/auto/debugger/tst_dumpers.cpp b/tests/auto/debugger/tst_dumpers.cpp index 3084db31b55..b3754c90e54 100644 --- a/tests/auto/debugger/tst_dumpers.cpp +++ b/tests/auto/debugger/tst_dumpers.cpp @@ -5520,7 +5520,9 @@ void tst_Dumpers::dumper_data() "enum E { V1, V2 };" "struct S\n" "{\n" - " S() : x(2), y(3), z(39), e(V2), c(1), b(0), f(5), d(6), i(7) {}\n" + " S() : front(13), x(2), y(3), z(39), e(V2), c(1), b(0), f(5)," + " d(6), i(7) {}\n" + " unsigned int front;\n" " unsigned int x : 3;\n" " unsigned int y : 4;\n" " unsigned int z : 18;\n" @@ -5547,6 +5549,7 @@ void tst_Dumpers::dumper_data() + Check("s.x", "2", "unsigned int") % CdbEngine + Check("s.y", "3", "unsigned int") % CdbEngine + Check("s.z", "39", "unsigned int") % CdbEngine + + Check("s.front", "13", "unsigned int") + Check("s.e", "V2 (1)", TypePattern("main::[a-zA-Z0-9_]*::E")) % CdbEngine; @@ -5757,7 +5760,11 @@ void tst_Dumpers::dumper_data() "const Foo &b4 = a4;\n" "typedef Foo &Ref4;\n" "const Ref4 d4 = const_cast(a4);\n" - "unused(&a4, &b4, &d4);\n") + "unused(&a4, &b4, &d4);\n" + + "int *q = 0;\n" + "int &qq = *q;\n" + "unused(&qq, &q);\n") + CoreProfile() + NoCdbEngine // The Cdb has no information about references @@ -5781,7 +5788,9 @@ void tst_Dumpers::dumper_data() + Check("b4", "", "Foo &") + Check("b4.a", "12", "int") //+ Check("d4", "\"hello\"", "Ref4"); FIXME: We get "Foo &" instead - + Check("d4.a", "12", "int"); + + Check("d4.a", "12", "int") + + + Check("qq", "", "int &"); QTest::newRow("DynamicReference") << Data("struct BaseClass { virtual ~BaseClass() {} };\n" diff --git a/tests/system/suite_editors/tst_memberoperator/test.py b/tests/system/suite_editors/tst_memberoperator/test.py index d7b20f8b3d7..910e4b35c51 100644 --- a/tests/system/suite_editors/tst_memberoperator/test.py +++ b/tests/system/suite_editors/tst_memberoperator/test.py @@ -25,12 +25,29 @@ source("../../shared/qtcreator.py") +WhatsThisRole = 5 # Qt::WhatsThisRole + +def __getGenericProposalListView__(timeout): + try: + waitForObject(':popupFrame_TextEditor::GenericProposalWidget', timeout) + return findObject(':popupFrame_Proposal_QListView') + except LookupError: + return None + + +def __verifyLineUnderCursor__(cppwindow, record): + found = str(lineUnderCursor(cppwindow)).strip() + exp = testData.field(record, "expected") + test.compare(found, exp) + + def main(): for useClang in [False, True]: with TestSection(getCodeModelString(useClang)): if not startCreatorVerifyingClang(useClang): continue createProject_Qt_Console(tempDir(), "SquishProject") + selectBuildConfig(Targets.DESKTOP_5_6_1_DEFAULT, "Debug") # do not use the default Qt4 checkCodeModelSettings(useClang) selectFromLocator("main.cpp") cppwindow = waitForObject(":Qt Creator_CppEditor::Internal::CPPEditorWidget") @@ -45,10 +62,36 @@ def main(): type(cppwindow, testData.field(record, "usage")) snooze(1) # maybe find something better type(cppwindow, testData.field(record, "operator")) - waitFor("object.exists(':popupFrame_TextEditor::GenericProposalWidget')", 1500) - found = str(lineUnderCursor(cppwindow)).strip() - exp = testData.field(record, "expected") - test.compare(found, exp) + genericProposalWidget = __getGenericProposalListView__(1500) + # the clang code model does not change the . to -> before applying a proposal + # so, verify list of proposals roughly + if useClang: + expectProposal = testData.field(record, "clangProposal") == 'True' + test.compare(genericProposalWidget is not None, expectProposal, + 'Verifying whether proposal widget is displayed as expected.') + + if genericProposalWidget is not None: + model = genericProposalWidget.model() + proposalToolTips = dumpItems(model, role=WhatsThisRole) + needCorrection = filter(lambda x: 'Requires changing "." to "->"' in x, + proposalToolTips) + correction = testData.field(record, "correction") + if correction == 'all': + test.compare(len(needCorrection), len(proposalToolTips), + "Verifying whether all proposal need correction.") + elif correction == 'mixed': + test.verify(len(proposalToolTips) > len(needCorrection) > 0, + "Verifying whether some of the proposals need correction.") + elif correction == 'none': + test.verify(len(needCorrection) == 0, + "Verifying whether no proposal needs a correction.") + else: + test.warning("Used tsv file seems to be broken - found '%s' in " + "correction column." % correction) + elif not expectProposal: + __verifyLineUnderCursor__(cppwindow, record) + else: + __verifyLineUnderCursor__(cppwindow, record) invokeMenuItem("File", 'Revert "main.cpp" to Saved') clickButton(waitForObject(":Revert to Saved.Proceed_QPushButton")) snooze(1) diff --git a/tests/system/suite_editors/tst_memberoperator/testdata/usages.tsv b/tests/system/suite_editors/tst_memberoperator/testdata/usages.tsv index 9d44b0431f4..daecc37c7ac 100644 --- a/tests/system/suite_editors/tst_memberoperator/testdata/usages.tsv +++ b/tests/system/suite_editors/tst_memberoperator/testdata/usages.tsv @@ -1,30 +1,32 @@ -"include" "declaration" "usage" "operator" "expected" -"" "" "syntaxError" "." "syntaxError." -"" "" "argc" "." "argc." -"" "" "argv[0]" "." "argv[0]." -"" "" "2" "." "2." -"" "" "float fl = 2" "." "float fl = 2." -"" "QCoreApplication qa;" "qa" "." "qa." -"" "QCoreApplication *p;" "p" "." "p->" -"" "QCoreApplication &ref = a;" "ref" "." "ref." -"" "QPointer p;" "p" "." "p." -"" "QPointer *poi;" "poi" "." "poi->" -"" "QPointer &poi;" "poi" "." "poi." -"" "QPointer poi[5];" "poi[2]" "." "poi[2]." -"" "QPointer *poi[5];" "poi[2]" "." "poi[2]->" -"" "std::auto_ptr sap;" "sap" "." "sap." -"" "std::auto_ptr *sap;" "sap" "." "sap->" -"" "std::auto_ptr &sap;" "sap" "." "sap." -"" "std::auto_ptr sap[10];" "sap[2]" "." "sap[2]." -"" "std::auto_ptr *sap[10];" "sap[2]" "." "sap[2]->" -"" "QVector vec;" "vec" "." "vec." -"" "QVector vec;" "vec" "." "vec." -"" "QVector *vec;" "vec" "." "vec->" -"" "QVector *vec;" "vec" "." "vec->" -"" "QVector vec;" "vec[0]" "." "vec[0]." -"" "QVector vec;" "vec[0]" "." "vec[0]->" -"" "struct Foo { int foo; }; Foo *baz;" "baz" "." "baz->" -"" "auto s = QString();" "s" "." "s." -"" "auto *s = QString();" "s" "." "s." -"" "auto s = new QString();" "s" "." "s->" -"" "auto *s = new QString();" "s" "." "s->" +"include" "declaration" "usage" "operator" "expected" "clangProposal" "correction" +"" "" "syntaxError" "." "syntaxError." "False" "" +"" "" "argc" "." "argc." "False" "" +"" "" "argv[0]" "." "argv[0]." "False" "" +"" "" "2" "." "2." "False" "" +"" "" "float fl = 2" "." "float fl = 2." "False" "" +"" "QCoreApplication qa;" "qa" "." "qa." "False" "" +"" "QCoreApplication *p;" "p" "." "p->" "True" "all" +"" "QCoreApplication &ref = a;" "ref" "." "ref." "True" "none" +"" "QPointer p;" "p" "." "p." "True" "mixed" +"" "QPointer *poi;" "poi" "." "poi->" "True" "all" +"" "QPointer &poi;" "poi" "." "poi." "False" "" +"" "QPointer pa; QPointer &poi = pa;" "poi" "." "poi." "True" "mixed" +"" "QPointer poi[5];" "poi[2]" "." "poi[2]." "True" "mixed" +"" "QPointer *poi[5];" "poi[2]" "." "poi[2]->" "True" "all" +"" "std::auto_ptr sap;" "sap" "." "sap." "True" "mixed" +"" "std::auto_ptr *sap;" "sap" "." "sap->" "True" "all" +"" "std::auto_ptr &sap;" "sap" "." "sap." "False" "" +"" "std::auto_ptr sapqa; std::auto_ptr &sap = sapqa;" "sap" "." "sap." "True" "mixed" +"" "std::auto_ptr sap[10];" "sap[2]" "." "sap[2]." "True" "mixed" +"" "std::auto_ptr *sap[10];" "sap[2]" "." "sap[2]->" "True" "all" +"" "QVector vec;" "vec" "." "vec." "True" "none" +"" "QVector vec;" "vec" "." "vec." "True" "none" +"" "QVector *vec;" "vec" "." "vec->" "True" "all" +"" "QVector *vec;" "vec" "." "vec->" "True" "all" +"" "QVector vec;" "vec[0]" "." "vec[0]." "True" "none" +"" "QVector vec;" "vec[0]" "." "vec[0]->" "True" "all" +"" "struct Foo { int foo; }; Foo *baz;" "baz" "." "baz->" "True" "all" +"" "auto s = QString();" "s" "." "s." "True" "none" +"" "auto *s = QString();" "s" "." "s." "False" "" +"" "auto s = new QString();" "s" "." "s->" "True" "all" +"" "auto *s = new QString();" "s" "." "s->" "True" "all" diff --git a/tests/unit/unittest/builddependenciesprovider-test.cpp b/tests/unit/unittest/builddependenciesprovider-test.cpp new file mode 100644 index 00000000000..24d4b104654 --- /dev/null +++ b/tests/unit/unittest/builddependenciesprovider-test.cpp @@ -0,0 +1,152 @@ +/**************************************************************************** +** +** Copyright (C) 2018 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +****************************************************************************/ + +#include "googletest.h" + +#include "mockbuilddependenciesstorage.h" +#include "mockmodifiedtimechecker.h" +#include "mockbuilddependenciesgenerator.h" + +#include + +namespace { + +using ClangBackEnd::BuildDependency; +using ClangBackEnd::BuildDependencies; +using ClangBackEnd::FilePathId; +using ClangBackEnd::FilePathIds; +using ClangBackEnd::SourceEntry; +using ClangBackEnd::SourceEntries; +using ClangBackEnd::SourceType; +using ClangBackEnd::UsedMacro; +using ClangBackEnd::UsedMacros; + +MATCHER_P(HasSourceId, sourceId, std::string(negation ? "hasn't" : "has") + + " sourceId " + PrintToString(sourceId)) +{ + const SourceEntry & sourceEntry = arg; + + return sourceEntry.sourceId.filePathId == sourceId; +} + +class BuildDependenciesProvider : public testing::Test +{ +protected: + NiceMock mockBuildDependenciesStorage; + NiceMock mockModifiedTimeChecker; + NiceMock mockBuildDependenciesGenerator; + ClangBackEnd::BuildDependenciesProvider provider{mockBuildDependenciesStorage, mockModifiedTimeChecker, mockBuildDependenciesGenerator}; + ClangBackEnd::V2::ProjectPartContainer projectPart1{"ProjectPart1", + {"--yi"}, + {{"YI","1"}}, + {"/yi"}, + {1}, + {2}}; + ClangBackEnd::V2::ProjectPartContainer projectPart2{"ProjectPart2", + {"--er"}, + {{"ER","2"}}, + {"/er"}, + {1}, + {2, 3, 4}}; + SourceEntries firstSources{{1, SourceType::Any, 1}, {2, SourceType::Any, 1}, {10, SourceType::Any, 1}}; + SourceEntries secondSources{{1, SourceType::Any, 1}, {3, SourceType::Any, 1}, {8, SourceType::Any, 1}}; + SourceEntries thirdSources{{4, SourceType::Any, 1}, {8, SourceType::Any, 1}, {10, SourceType::Any, 1}}; + UsedMacros firstUsedMacros{{"YI", 1}}; + UsedMacros secondUsedMacros{{"LIANG", 2}, {"ER", 2}}; + UsedMacros thirdUsedMacros{{"SAN", 10}}; + BuildDependency buildDependency{secondSources, {}, {}, {}}; +}; + +TEST_F(BuildDependenciesProvider, CreateCallsFetchDependSourcesFromStorageIfTimeStampsAreUpToDate) +{ + InSequence s; + + EXPECT_CALL(mockBuildDependenciesStorage, fetchDependSources({2}, TypedEq("ProjectPart1"))).WillRepeatedly(Return(firstSources)); + EXPECT_CALL(mockModifiedTimeChecker, isUpToDate(firstSources)).WillRepeatedly(Return(true)); + EXPECT_CALL(mockBuildDependenciesGenerator, create(projectPart1)).Times(0); + + provider.create(projectPart1); +} + +TEST_F(BuildDependenciesProvider, FetchDependSourcesFromStorage) +{ + ON_CALL(mockBuildDependenciesStorage, fetchDependSources({2}, TypedEq("ProjectPart2"))).WillByDefault(Return(firstSources)); + ON_CALL(mockBuildDependenciesStorage, fetchDependSources({3}, TypedEq("ProjectPart2"))).WillByDefault(Return(secondSources)); + ON_CALL(mockBuildDependenciesStorage, fetchDependSources({4}, TypedEq("ProjectPart2"))).WillByDefault(Return(thirdSources)); + ON_CALL(mockModifiedTimeChecker, isUpToDate(_)).WillByDefault(Return(true)); + + auto buildDependency = provider.create(projectPart2); + + ASSERT_THAT(buildDependency.includes, ElementsAre(HasSourceId(1), HasSourceId(2), HasSourceId(3), HasSourceId(4), HasSourceId(8), HasSourceId(10))); +} + +TEST_F(BuildDependenciesProvider, CreateCallsFetchDependSourcesFromGeneratorIfTimeStampsAreNotUpToDate) +{ + InSequence s; + + EXPECT_CALL(mockBuildDependenciesStorage, fetchDependSources({2}, TypedEq("ProjectPart1"))).WillRepeatedly(Return(firstSources)); + EXPECT_CALL(mockModifiedTimeChecker, isUpToDate(firstSources)).WillRepeatedly(Return(false)); + EXPECT_CALL(mockBuildDependenciesGenerator, create(projectPart1)); + + provider.create(projectPart1); +} + +TEST_F(BuildDependenciesProvider, FetchDependSourcesFromGenerator) +{ + ON_CALL(mockBuildDependenciesStorage, fetchDependSources({2}, TypedEq("ProjectPart1"))).WillByDefault(Return(firstSources)); + ON_CALL(mockModifiedTimeChecker, isUpToDate(_)).WillByDefault(Return(false)); + ON_CALL(mockBuildDependenciesGenerator, create(projectPart1)).WillByDefault(Return(buildDependency)); + + auto buildDependency = provider.create(projectPart1); + + ASSERT_THAT(buildDependency.includes, ElementsAre(HasSourceId(1), HasSourceId(3), HasSourceId(8))); +} + +TEST_F(BuildDependenciesProvider, CreateCallsFetchUsedMacrosFromStorageIfTimeStampsAreUpToDate) +{ + InSequence s; + + EXPECT_CALL(mockBuildDependenciesStorage, fetchDependSources({2}, TypedEq("ProjectPart1"))).WillRepeatedly(Return(firstSources)); + EXPECT_CALL(mockModifiedTimeChecker, isUpToDate(firstSources)).WillRepeatedly(Return(true)); + EXPECT_CALL(mockBuildDependenciesStorage, fetchUsedMacros({1})); + EXPECT_CALL(mockBuildDependenciesStorage, fetchUsedMacros({2})); + EXPECT_CALL(mockBuildDependenciesStorage, fetchUsedMacros({10})); + + provider.create(projectPart1); +} + +TEST_F(BuildDependenciesProvider, FetchUsedMacrosFromStorageIfDependSourcesAreUpToDate) +{ + ON_CALL(mockBuildDependenciesStorage, fetchDependSources({2}, TypedEq("ProjectPart1"))).WillByDefault(Return(firstSources)); + ON_CALL(mockModifiedTimeChecker, isUpToDate(firstSources)).WillByDefault(Return(true)); + ON_CALL(mockBuildDependenciesStorage, fetchUsedMacros({1})).WillByDefault(Return(firstUsedMacros)); + ON_CALL(mockBuildDependenciesStorage, fetchUsedMacros({2})).WillByDefault(Return(secondUsedMacros)); + ON_CALL(mockBuildDependenciesStorage, fetchUsedMacros({10})).WillByDefault(Return(thirdUsedMacros)); + + auto buildDependency = provider.create(projectPart1); + + ASSERT_THAT(buildDependency.usedMacros, ElementsAre(UsedMacro{"YI", 1}, UsedMacro{"ER", 2}, UsedMacro{"LIANG", 2}, UsedMacro{"SAN", 10})); +} +} diff --git a/tests/unit/unittest/usedmacroandsourcestorage-test.cpp b/tests/unit/unittest/builddependenciesstorage-test.cpp similarity index 57% rename from tests/unit/unittest/usedmacroandsourcestorage-test.cpp rename to tests/unit/unittest/builddependenciesstorage-test.cpp index d9acc7f123c..05d3d70887d 100644 --- a/tests/unit/unittest/usedmacroandsourcestorage-test.cpp +++ b/tests/unit/unittest/builddependenciesstorage-test.cpp @@ -29,7 +29,7 @@ #include "mocksqlitedatabase.h" #include -#include +#include #include @@ -38,12 +38,15 @@ namespace { using Utils::PathString; using ClangBackEnd::FilePathId; using ClangBackEnd::FilePathCachingInterface; +using ClangBackEnd::SourceEntries; +using ClangBackEnd::SourceType; +using ClangBackEnd::UsedMacro; using Sqlite::Database; using Sqlite::Table; -using Storage = ClangBackEnd::UsedMacroAndSourceStorage; +using Storage = ClangBackEnd::BuildDependenciesStorage; -class UsedMacroAndSourceStorage : public testing::Test +class BuildDependenciesStorage : public testing::Test { protected: NiceMock mockDatabase; @@ -52,15 +55,20 @@ protected: MockSqliteWriteStatement &syncNewUsedMacrosStatement =storage.m_syncNewUsedMacrosStatement; MockSqliteWriteStatement &deleteOutdatedUsedMacrosStatement = storage.m_deleteOutdatedUsedMacrosStatement; MockSqliteWriteStatement &deleteNewUsedMacrosTableStatement = storage.m_deleteNewUsedMacrosTableStatement; - MockSqliteWriteStatement &insertFileStatuses = storage.m_insertFileStatuses; + MockSqliteWriteStatement &insertFileStatuses = storage.m_insertFileStatusesStatement; MockSqliteWriteStatement &insertIntoNewSourceDependenciesStatement = storage.m_insertIntoNewSourceDependenciesStatement; MockSqliteWriteStatement &syncNewSourceDependenciesStatement = storage.m_syncNewSourceDependenciesStatement; MockSqliteWriteStatement &deleteOutdatedSourceDependenciesStatement = storage.m_deleteOutdatedSourceDependenciesStatement; MockSqliteWriteStatement &deleteNewSourceDependenciesStatement = storage.m_deleteNewSourceDependenciesStatement; MockSqliteReadStatement &getLowestLastModifiedTimeOfDependencies = storage.m_getLowestLastModifiedTimeOfDependencies; + MockSqliteWriteStatement &updateBuildDependencyTimeStampStatement = storage.m_updateBuildDependencyTimeStampStatement; + MockSqliteWriteStatement &updateSourceTypeStatement = storage.m_updateSourceTypeStatement; + MockSqliteReadStatement &fetchSourceDependenciesStatement = storage.m_fetchSourceDependenciesStatement; + MockSqliteReadStatement &fetchProjectPartIdStatement = storage.m_fetchProjectPartIdStatement; + MockSqliteReadStatement &fetchUsedMacrosStatement = storage.m_fetchUsedMacrosStatement; }; -TEST_F(UsedMacroAndSourceStorage, ConvertStringsToJson) +TEST_F(BuildDependenciesStorage, ConvertStringsToJson) { Utils::SmallStringVector strings{"foo", "bar", "foo"}; @@ -69,7 +77,7 @@ TEST_F(UsedMacroAndSourceStorage, ConvertStringsToJson) ASSERT_THAT(jsonText, Eq("[\"foo\",\"bar\",\"foo\"]")); } -TEST_F(UsedMacroAndSourceStorage, InsertOrUpdateUsedMacros) +TEST_F(BuildDependenciesStorage, InsertOrUpdateUsedMacros) { InSequence sequence; @@ -79,18 +87,18 @@ TEST_F(UsedMacroAndSourceStorage, InsertOrUpdateUsedMacros) EXPECT_CALL(deleteOutdatedUsedMacrosStatement, execute()); EXPECT_CALL(deleteNewUsedMacrosTableStatement, execute()); - storage.insertOrUpdateUsedMacros({{"FOO", {1, 42}}, {"BAR", {1, 43}}}); + storage.insertOrUpdateUsedMacros({{"FOO", 42}, {"BAR", 43}}); } -TEST_F(UsedMacroAndSourceStorage, InsertFileStatuses) +TEST_F(BuildDependenciesStorage, InsertFileStatuses) { EXPECT_CALL(insertFileStatuses, write(TypedEq(42), TypedEq(1), TypedEq(2), TypedEq(false))); EXPECT_CALL(insertFileStatuses, write(TypedEq(43), TypedEq(4), TypedEq(5), TypedEq(true))); - storage.insertFileStatuses({{{1, 42}, 1, 2, false}, {{1, 43}, 4, 5, true}}); + storage.insertFileStatuses({{42, 1, 2, false}, {43, 4, 5, true}}); } -TEST_F(UsedMacroAndSourceStorage, InsertOrUpdateSourceDependencies) +TEST_F(BuildDependenciesStorage, InsertOrUpdateSourceDependencies) { InSequence sequence; @@ -100,10 +108,10 @@ TEST_F(UsedMacroAndSourceStorage, InsertOrUpdateSourceDependencies) EXPECT_CALL(deleteOutdatedSourceDependenciesStatement, execute()); EXPECT_CALL(deleteNewSourceDependenciesStatement, execute()); - storage.insertOrUpdateSourceDependencies({{{1, 42}, {1, 1}}, {{1, 42}, {1, 2}}}); + storage.insertOrUpdateSourceDependencies({{42, 1}, {42, 2}}); } -TEST_F(UsedMacroAndSourceStorage, AddTablesInConstructor) +TEST_F(BuildDependenciesStorage, AddTablesInConstructor) { InSequence s; @@ -118,26 +126,26 @@ TEST_F(UsedMacroAndSourceStorage, AddTablesInConstructor) } -TEST_F(UsedMacroAndSourceStorage, FetchLowestLastModifiedTimeIfNoModificationTimeExists) +TEST_F(BuildDependenciesStorage, FetchLowestLastModifiedTimeIfNoModificationTimeExists) { EXPECT_CALL(getLowestLastModifiedTimeOfDependencies, valueReturnInt64(Eq(1))); - auto lowestLastModified = storage.fetchLowestLastModifiedTime({1, 1}); + auto lowestLastModified = storage.fetchLowestLastModifiedTime(1); ASSERT_THAT(lowestLastModified, Eq(0)); } -TEST_F(UsedMacroAndSourceStorage, FetchLowestLastModifiedTime) +TEST_F(BuildDependenciesStorage, FetchLowestLastModifiedTime) { EXPECT_CALL(getLowestLastModifiedTimeOfDependencies, valueReturnInt64(Eq(21))) .WillRepeatedly(Return(12)); - auto lowestLastModified = storage.fetchLowestLastModifiedTime({1, 21}); + auto lowestLastModified = storage.fetchLowestLastModifiedTime(21); ASSERT_THAT(lowestLastModified, Eq(12)); } -TEST_F(UsedMacroAndSourceStorage, AddNewUsedMacroTable) +TEST_F(BuildDependenciesStorage, AddNewUsedMacroTable) { InSequence s; @@ -147,7 +155,7 @@ TEST_F(UsedMacroAndSourceStorage, AddNewUsedMacroTable) storage.createNewUsedMacrosTable(); } -TEST_F(UsedMacroAndSourceStorage, AddNewSourceDependenciesTable) +TEST_F(BuildDependenciesStorage, AddNewSourceDependenciesTable) { InSequence s; @@ -157,5 +165,71 @@ TEST_F(UsedMacroAndSourceStorage, AddNewSourceDependenciesTable) storage.createNewSourceDependenciesTable(); } +TEST_F(BuildDependenciesStorage, UpdateSources) +{ + InSequence s; + SourceEntries entries{{1, SourceType::TopInclude, 10}, {2, SourceType::TopSystemInclude, 20}}; + + EXPECT_CALL(updateBuildDependencyTimeStampStatement, write(TypedEq(10), TypedEq(1))); + EXPECT_CALL(updateSourceTypeStatement, write(TypedEq(1), TypedEq(1))); + EXPECT_CALL(updateBuildDependencyTimeStampStatement, write(TypedEq(20), TypedEq(2))); + EXPECT_CALL(updateSourceTypeStatement, write(TypedEq(2), TypedEq(2))); + + storage.updateSources(entries); +} + +TEST_F(BuildDependenciesStorage, CallsFetchDependSourcesWithNonExistingProjectPartDontFetchesSourceDependencies) +{ + EXPECT_CALL(fetchProjectPartIdStatement, valueReturnInt32(TypedEq("test"))).WillOnce(Return(Utils::optional{})); + EXPECT_CALL(fetchSourceDependenciesStatement, valuesReturnSourceEntries(_, _, _)).Times(0); + + storage.fetchDependSources(22, "test"); +} + +TEST_F(BuildDependenciesStorage, CallsFetchDependSourcesWithExistingProjectPartFetchesSourceDependencies) +{ + EXPECT_CALL(fetchProjectPartIdStatement, valueReturnInt32(TypedEq("test"))).WillOnce(Return(Utils::optional{20})); + EXPECT_CALL(fetchSourceDependenciesStatement, valuesReturnSourceEntries(_, 22, 20)); + + storage.fetchDependSources(22, "test"); +} + +TEST_F(BuildDependenciesStorage, FetchDependSourcesWithNonExistingProjectPartReturnsEmptySourceEntries) +{ + EXPECT_CALL(fetchProjectPartIdStatement, valueReturnInt32(TypedEq("test"))).WillOnce(Return(Utils::optional{})); + + auto entries = storage.fetchDependSources(22, "test"); + + ASSERT_THAT(entries, IsEmpty()); +} + +TEST_F(BuildDependenciesStorage, FetchDependSourcesWithExistingProjectPartReturnsSourceEntries) +{ + SourceEntries sourceEntries{{1, SourceType::TopInclude, 10}, {2, SourceType::TopSystemInclude, 20}}; + EXPECT_CALL(fetchProjectPartIdStatement, valueReturnInt32(TypedEq("test"))).WillOnce(Return(Utils::optional{20})); + EXPECT_CALL(fetchSourceDependenciesStatement, valuesReturnSourceEntries(_, 22, 20)).WillOnce(Return(sourceEntries)); + + auto entries = storage.fetchDependSources(22, "test"); + + ASSERT_THAT(entries, sourceEntries); +} + +TEST_F(BuildDependenciesStorage, CallsFetchUsedMacros) +{ + EXPECT_CALL(fetchUsedMacrosStatement, valuesReturnUsedMacros(_, 22)); + + storage.fetchUsedMacros(22); +} + +TEST_F(BuildDependenciesStorage, FetchUsedMacros) +{ + ClangBackEnd::UsedMacros result{UsedMacro{"YI", 1}, UsedMacro{"ER", 2}}; + EXPECT_CALL(fetchUsedMacrosStatement, valuesReturnUsedMacros(_, 22)).WillOnce(Return(result)); + + auto usedMacros = storage.fetchUsedMacros(22); + + ASSERT_THAT(usedMacros, result); +} + } diff --git a/tests/unit/unittest/clangpathwatcher-test.cpp b/tests/unit/unittest/clangpathwatcher-test.cpp index bdc20348bc6..058ae8e96a9 100644 --- a/tests/unit/unittest/clangpathwatcher-test.cpp +++ b/tests/unit/unittest/clangpathwatcher-test.cpp @@ -73,7 +73,7 @@ protected: FilePathView path2{"/path/path2"}; QString path1QString = QString(path1.toStringView()); QString path2QString = QString(path2.toStringView()); - FilePathIds pathIds = {{1, 1}, {1, 2}}; + FilePathIds pathIds = {1, 2}; std::vector ids{watcher.idCache().stringIds({id1, id2, id3})}; WatcherEntry watcherEntry1{ids[0], pathIds[0]}; WatcherEntry watcherEntry2{ids[1], pathIds[0]}; diff --git a/tests/unit/unittest/clangqueryexamplehighlightmarker-test.cpp b/tests/unit/unittest/clangqueryexamplehighlightmarker-test.cpp index 7d65e40025a..8af631774fe 100644 --- a/tests/unit/unittest/clangqueryexamplehighlightmarker-test.cpp +++ b/tests/unit/unittest/clangqueryexamplehighlightmarker-test.cpp @@ -66,7 +66,7 @@ TEST_F(ClangQueryExampleHighlightMarker, NoCallForNotSourceRanges) TEST_F(ClangQueryExampleHighlightMarker, SingleLineSourceRange) { - SourceRanges sourceRanges{{{1, 1}, 1, 3, 3, 1, 10, 10, "function"}}; + SourceRanges sourceRanges{{1, 1, 3, 3, 1, 10, 10, "function"}}; Marker marker(std::move(sourceRanges), highlighter, textFormats); EXPECT_CALL(highlighter, setFormat(2, 7, textFormats[0])); @@ -76,7 +76,7 @@ TEST_F(ClangQueryExampleHighlightMarker, SingleLineSourceRange) TEST_F(ClangQueryExampleHighlightMarker, OtherSingleLineSourceRange) { - SourceRanges sourceRanges{{{1, 1}, 2, 5, 5, 2, 11, 11, "function"}}; + SourceRanges sourceRanges{{1, 2, 5, 5, 2, 11, 11, "function"}}; Marker marker(std::move(sourceRanges), highlighter, textFormats); marker.highlightBlock(1, "foo"); @@ -88,9 +88,9 @@ TEST_F(ClangQueryExampleHighlightMarker, OtherSingleLineSourceRange) TEST_F(ClangQueryExampleHighlightMarker, CascadedSingleLineSourceRanges) { InSequence sequence; - SourceRanges sourceRanges{{{1, 1}, 1, 2, 2, 1, 15, 15, "void function"}, - {{1, 1}, 1, 2, 2, 1, 6, 6, "void"}, - {{1, 1}, 1, 7, 7, 1, 15, 15, "function"}}; + SourceRanges sourceRanges{{1, 1, 2, 2, 1, 15, 15, "void function"}, + {1, 1, 2, 2, 1, 6, 6, "void"}, + {1, 1, 7, 7, 1, 15, 15, "function"}}; Marker marker(std::move(sourceRanges), highlighter, textFormats); EXPECT_CALL(highlighter, setFormat(1, 13, textFormats[0])); @@ -103,7 +103,7 @@ TEST_F(ClangQueryExampleHighlightMarker, CascadedSingleLineSourceRanges) TEST_F(ClangQueryExampleHighlightMarker, DualLineSourceRanges) { InSequence sequence; - SourceRanges sourceRanges{{{1, 1}, 1, 2, 2, 2, 4, 20, "void f()\n {}"}}; + SourceRanges sourceRanges{{1, 1, 2, 2, 2, 4, 20, "void f()\n {}"}}; Marker marker(std::move(sourceRanges), highlighter, textFormats); EXPECT_CALL(highlighter, setFormat(1, 7, textFormats[0])); @@ -116,7 +116,7 @@ TEST_F(ClangQueryExampleHighlightMarker, DualLineSourceRanges) TEST_F(ClangQueryExampleHighlightMarker, MultipleLineSourceRanges) { InSequence sequence; - SourceRanges sourceRanges{{{1, 1}, 1, 2, 2, 3, 3, 20, "void f()\n {\n }"}}; + SourceRanges sourceRanges{{1, 1, 2, 2, 3, 3, 20, "void f()\n {\n }"}}; Marker marker(std::move(sourceRanges), highlighter, textFormats); EXPECT_CALL(highlighter, setFormat(1, 7, textFormats[0])); @@ -131,9 +131,9 @@ TEST_F(ClangQueryExampleHighlightMarker, MultipleLineSourceRanges) TEST_F(ClangQueryExampleHighlightMarker, MoreMultipleLineSourceRanges) { InSequence sequence; - SourceRanges sourceRanges{{{1, 1}, 1, 1, 0, 4, 2, 0, ""}, - {{1, 1}, 2, 2, 0, 2, 7, 0, ""}, - {{1, 1}, 3, 2, 0, 3, 7, 0, ""}}; + SourceRanges sourceRanges{{1, 1, 1, 0, 4, 2, 0, ""}, + {1, 2, 2, 0, 2, 7, 0, ""}, + {1, 3, 2, 0, 3, 7, 0, ""}}; Marker marker(std::move(sourceRanges), highlighter, textFormats); EXPECT_CALL(highlighter, setFormat(0, 10, textFormats[0])); @@ -152,9 +152,9 @@ TEST_F(ClangQueryExampleHighlightMarker, MoreMultipleLineSourceRanges) TEST_F(ClangQueryExampleHighlightMarker, CascadedMultipleLineSourceRanges) { InSequence sequence; - SourceRanges sourceRanges{{{1, 1}, 1, 1, 0, 4, 2, 0, ""}, - {{1, 1}, 2, 2, 0, 3, 4, 0, ""}, - {{1, 1}, 2, 11, 0, 2, 16, 0, ""}}; + SourceRanges sourceRanges{{1, 1, 1, 0, 4, 2, 0, ""}, + {1, 2, 2, 0, 3, 4, 0, ""}, + {1, 2, 11, 0, 2, 16, 0, ""}}; Marker marker(std::move(sourceRanges), highlighter, textFormats); EXPECT_CALL(highlighter, setFormat(0, 9, textFormats[0])); @@ -173,7 +173,7 @@ TEST_F(ClangQueryExampleHighlightMarker, CascadedMultipleLineSourceRanges) TEST_F(ClangQueryExampleHighlightMarker, FormatSingle) { - SourceRange sourceRange{{1, 1}, 1, 3, 3, 1, 10, 10}; + SourceRange sourceRange{1, 1, 3, 3, 1, 10, 10}; EXPECT_CALL(highlighter, setFormat(2, 7, textFormats[0])); @@ -182,7 +182,7 @@ TEST_F(ClangQueryExampleHighlightMarker, FormatSingle) TEST_F(ClangQueryExampleHighlightMarker, FormatMultipleStart) { - SourceRange sourceRange{{1, 1}, 1, 3, 3, 2, 9, 20}; + SourceRange sourceRange{1, 1, 3, 3, 2, 9, 20}; EXPECT_CALL(highlighter, setFormat(2, 8, textFormats[0])); @@ -191,7 +191,7 @@ TEST_F(ClangQueryExampleHighlightMarker, FormatMultipleStart) TEST_F(ClangQueryExampleHighlightMarker, FormatMultipleEnd) { - SourceRange sourceRange{{1, 1}, 1, 3, 3, 2, 8, 20}; + SourceRange sourceRange{1, 1, 3, 3, 2, 8, 20}; EXPECT_CALL(highlighter, setFormat(0, 7, textFormats[1])); @@ -200,7 +200,7 @@ TEST_F(ClangQueryExampleHighlightMarker, FormatMultipleEnd) TEST_F(ClangQueryExampleHighlightMarker, FormatMultipleMiddle) { - SourceRange sourceRange{{1, 1}, 1, 3, 3, 3, 8, 20}; + SourceRange sourceRange{1, 1, 3, 3, 3, 8, 20}; EXPECT_CALL(highlighter, setFormat(0, 10, textFormats[2])); diff --git a/tests/unit/unittest/clangqueryhighlightmarker-test.cpp b/tests/unit/unittest/clangqueryhighlightmarker-test.cpp index 11efd1d519f..05e657b9eaa 100644 --- a/tests/unit/unittest/clangqueryhighlightmarker-test.cpp +++ b/tests/unit/unittest/clangqueryhighlightmarker-test.cpp @@ -74,10 +74,10 @@ TEST_F(ClangQueryHighlightMarker, NoCallForNoMessagesAndContexts) TEST_F(ClangQueryHighlightMarker, CallForMessagesAndContextsForASingleLine) { InSequence sequence; - Messages messages{{{{0, 1}, 1, 5, 0, 1, 10, 0}, ErrorType::RegistryMatcherNotFound, {}}, - {{{0, 1}, 1, 30, 0, 1, 40, 0}, ErrorType::RegistryMatcherNotFound, {}}}; - Contexts contexts{{{{0, 1}, 1, 2, 0, 1, 15, 0}, ContextType::MatcherArg, {}}, - {{{0, 1}, 1, 20, 0, 1, 50, 0}, ContextType::MatcherArg, {}}}; + Messages messages{{{1, 1, 5, 0, 1, 10, 0}, ErrorType::RegistryMatcherNotFound, {}}, + {{1, 1, 30, 0, 1, 40, 0}, ErrorType::RegistryMatcherNotFound, {}}}; + Contexts contexts{{{1, 1, 2, 0, 1, 15, 0}, ContextType::MatcherArg, {}}, + {{1, 1, 20, 0, 1, 50, 0}, ContextType::MatcherArg, {}}}; marker.setMessagesAndContexts(std::move(messages), std::move(contexts)); EXPECT_CALL(highlighter, setFormat(1, 13, contextTextFormat)); @@ -91,7 +91,7 @@ TEST_F(ClangQueryHighlightMarker, CallForMessagesAndContextsForASingleLine) TEST_F(ClangQueryHighlightMarker, CallForMessagesForAMultiLine) { InSequence sequence; - Messages messages{{{{0, 1}, 1, 5, 0, 3, 3, 0}, ErrorType::RegistryMatcherNotFound, {}}}; + Messages messages{{{1, 1, 5, 0, 3, 3, 0}, ErrorType::RegistryMatcherNotFound, {}}}; Contexts contexts; marker.setMessagesAndContexts(std::move(messages), std::move(contexts)); @@ -107,8 +107,8 @@ TEST_F(ClangQueryHighlightMarker, CallForMessagesForAMultiLine) TEST_F(ClangQueryHighlightMarker, CallForMessagesAndContextForAMultiLine) { InSequence sequence; - Messages messages{{{{1, 1}, 1, 5, 0, 3, 3, 0}, ErrorType::RegistryMatcherNotFound, {}}}; - Contexts contexts{{{{1, 1}, 1, 2, 0, 3, 4, 0}, ContextType::MatcherArg, {}}}; + Messages messages{{{1, 1, 5, 0, 3, 3, 0}, ErrorType::RegistryMatcherNotFound, {}}}; + Contexts contexts{{{1, 1, 2, 0, 3, 4, 0}, ContextType::MatcherArg, {}}}; marker.setMessagesAndContexts(std::move(messages), std::move(contexts)); EXPECT_CALL(highlighter, setFormat(1, 11, contextTextFormat)); @@ -136,7 +136,7 @@ TEST_F(ClangQueryHighlightMarker, NoMessagesIfEmpty) TEST_F(ClangQueryHighlightMarker, NoMessagesForBeforePosition) { - Messages messages{{{{0, 1}, 1, 5, 0, 3, 3, 0}, + Messages messages{{{1, 1, 5, 0, 3, 3, 0}, ErrorType::RegistryMatcherNotFound, {"foo"}}}; Contexts contexts; @@ -149,7 +149,7 @@ TEST_F(ClangQueryHighlightMarker, NoMessagesForBeforePosition) TEST_F(ClangQueryHighlightMarker, NoMessagesForAfterPosition) { - Messages messages{{{{0, 1}, 1, 5, 0, 3, 3, 0}, + Messages messages{{{1, 1, 5, 0, 3, 3, 0}, ErrorType::RegistryMatcherNotFound, {"foo"}}}; Contexts contexts; @@ -162,7 +162,7 @@ TEST_F(ClangQueryHighlightMarker, NoMessagesForAfterPosition) TEST_F(ClangQueryHighlightMarker, OneMessagesForInsidePosition) { - Message message{{{0, 1}, 1, 5, 0, 3, 3, 0}, + Message message{{1, 1, 5, 0, 3, 3, 0}, ErrorType::RegistryMatcherNotFound, {"foo"}}; Messages messages{message.clone()}; @@ -176,7 +176,7 @@ TEST_F(ClangQueryHighlightMarker, OneMessagesForInsidePosition) TEST_F(ClangQueryHighlightMarker, NoMessagesForOutsidePosition) { - Message message{{{0, 1}, 1, 5, 0, 3, 3, 0}, + Message message{{1, 1, 5, 0, 3, 3, 0}, ErrorType::RegistryMatcherNotFound, {"foo"}}; Messages messages{message.clone()}; @@ -190,7 +190,7 @@ TEST_F(ClangQueryHighlightMarker, NoMessagesForOutsidePosition) TEST_F(ClangQueryHighlightMarker, AfterStartColumnBeforeLine) { - SourceRange sourceRange{{0, 1}, 2, 5, 0, 3, 3, 0}; + SourceRange sourceRange{1, 2, 5, 0, 3, 3, 0}; bool isAfterStartColumn = marker.isInsideRange(sourceRange, 1, 6); @@ -199,7 +199,7 @@ TEST_F(ClangQueryHighlightMarker, AfterStartColumnBeforeLine) TEST_F(ClangQueryHighlightMarker, AfterStartColumnBeforeColumn) { - SourceRange sourceRange{{0, 1}, 2, 5, 0, 3, 3, 0}; + SourceRange sourceRange{1, 2, 5, 0, 3, 3, 0}; bool isAfterStartColumn = marker.isInsideRange(sourceRange, 2, 4); @@ -208,7 +208,7 @@ TEST_F(ClangQueryHighlightMarker, AfterStartColumnBeforeColumn) TEST_F(ClangQueryHighlightMarker, AfterStartColumnAtColumn) { - SourceRange sourceRange{{0, 1}, 2, 5, 0, 3, 3, 0}; + SourceRange sourceRange{1, 2, 5, 0, 3, 3, 0}; bool isAfterStartColumn = marker.isInsideRange(sourceRange, 2, 5); @@ -217,7 +217,7 @@ TEST_F(ClangQueryHighlightMarker, AfterStartColumnAtColumn) TEST_F(ClangQueryHighlightMarker, AfterStartColumnAfterColumn) { - SourceRange sourceRange{{0, 1}, 2, 5, 0, 3, 3, 0}; + SourceRange sourceRange{1, 2, 5, 0, 3, 3, 0}; bool isAfterStartColumn = marker.isInsideRange(sourceRange, 2, 6); @@ -226,7 +226,7 @@ TEST_F(ClangQueryHighlightMarker, AfterStartColumnAfterColumn) TEST_F(ClangQueryHighlightMarker, BeforeEndColumnAfterLine) { - SourceRange sourceRange{{0, 1}, 2, 5, 0, 3, 3, 0}; + SourceRange sourceRange{1, 2, 5, 0, 3, 3, 0}; bool isBeforeEndColumn = marker.isInsideRange(sourceRange, 4, 1); @@ -235,7 +235,7 @@ TEST_F(ClangQueryHighlightMarker, BeforeEndColumnAfterLine) TEST_F(ClangQueryHighlightMarker, BeforeEndColumnAfterColumn) { - SourceRange sourceRange{{0, 1}, 2, 5, 0, 3, 3, 0}; + SourceRange sourceRange{1, 2, 5, 0, 3, 3, 0}; bool isBeforeEndColumn = marker.isInsideRange(sourceRange, 3, 4); @@ -244,7 +244,7 @@ TEST_F(ClangQueryHighlightMarker, BeforeEndColumnAfterColumn) TEST_F(ClangQueryHighlightMarker, BeforeEndColumnAtColumn) { - SourceRange sourceRange{{0, 1}, 2, 5, 0, 3, 3, 0}; + SourceRange sourceRange{1, 2, 5, 0, 3, 3, 0}; bool isBeforeEndColumn = marker.isInsideRange(sourceRange, 3, 3); @@ -253,7 +253,7 @@ TEST_F(ClangQueryHighlightMarker, BeforeEndColumnAtColumn) TEST_F(ClangQueryHighlightMarker, BeforeEndColumnBeforeColumn) { - SourceRange sourceRange{{0, 1}, 2, 5, 0, 3, 3, 0}; + SourceRange sourceRange{1, 2, 5, 0, 3, 3, 0}; bool isBeforeEndColumn = marker.isInsideRange(sourceRange, 3, 2); @@ -262,7 +262,7 @@ TEST_F(ClangQueryHighlightMarker, BeforeEndColumnBeforeColumn) TEST_F(ClangQueryHighlightMarker, InBetweenLineBeforeLine) { - SourceRange sourceRange{{0, 1}, 2, 5, 0, 3, 3, 0}; + SourceRange sourceRange{1, 2, 5, 0, 3, 3, 0}; bool isInBetween = marker.isInsideRange(sourceRange, 1, 6); @@ -271,7 +271,7 @@ TEST_F(ClangQueryHighlightMarker, InBetweenLineBeforeLine) TEST_F(ClangQueryHighlightMarker, InBetweenLineAfterLine) { - SourceRange sourceRange{{0, 1}, 2, 5, 0, 4, 3, 0}; + SourceRange sourceRange{1, 2, 5, 0, 4, 3, 0}; bool isInBetween = marker.isInsideRange(sourceRange, 5, 1); @@ -280,7 +280,7 @@ TEST_F(ClangQueryHighlightMarker, InBetweenLineAfterLine) TEST_F(ClangQueryHighlightMarker, InBetweenLine) { - SourceRange sourceRange{{0, 1}, 2, 5, 0, 4, 3, 0}; + SourceRange sourceRange{1, 2, 5, 0, 4, 3, 0}; bool isInBetween = marker.isInsideRange(sourceRange, 3, 1); @@ -289,7 +289,7 @@ TEST_F(ClangQueryHighlightMarker, InBetweenLine) TEST_F(ClangQueryHighlightMarker, SingleLineBefore) { - SourceRange sourceRange{{0, 1}, 2, 5, 0, 2, 10, 0}; + SourceRange sourceRange{1, 2, 5, 0, 2, 10, 0}; bool isInRange = marker.isInsideRange(sourceRange, 2, 4); @@ -298,7 +298,7 @@ TEST_F(ClangQueryHighlightMarker, SingleLineBefore) TEST_F(ClangQueryHighlightMarker, SingleLineAfter) { - SourceRange sourceRange{{0, 1}, 2, 5, 0, 2, 10, 0}; + SourceRange sourceRange{1, 2, 5, 0, 2, 10, 0}; bool isInRange = marker.isInsideRange(sourceRange, 2, 11); @@ -307,7 +307,7 @@ TEST_F(ClangQueryHighlightMarker, SingleLineAfter) TEST_F(ClangQueryHighlightMarker, SingleLineInRange) { - SourceRange sourceRange{{0, 1}, 2, 5, 0, 2, 10, 0}; + SourceRange sourceRange{1, 2, 5, 0, 2, 10, 0}; bool isInRange = marker.isInsideRange(sourceRange, 2, 6); @@ -328,7 +328,7 @@ TEST_F(ClangQueryHighlightMarker, NoContextsIfEmpty) TEST_F(ClangQueryHighlightMarker, NoContextsForBeforePosition) { Messages messages; - Contexts contexts{{{{0, 1}, 1, 5, 0, 3, 3, 0}, + Contexts contexts{{{1, 1, 5, 0, 3, 3, 0}, ContextType::MatcherArg, {"foo"}}}; marker.setMessagesAndContexts(std::move(messages), std::move(contexts)); @@ -341,7 +341,7 @@ TEST_F(ClangQueryHighlightMarker, NoContextsForBeforePosition) TEST_F(ClangQueryHighlightMarker, NoContextsForAfterPosition) { Messages messages; - Contexts contexts{{{{0, 1}, 1, 5, 0, 3, 3, 0}, + Contexts contexts{{{1, 1, 5, 0, 3, 3, 0}, ContextType::MatcherArg, {"foo"}}}; marker.setMessagesAndContexts(std::move(messages), std::move(contexts)); @@ -353,7 +353,7 @@ TEST_F(ClangQueryHighlightMarker, NoContextsForAfterPosition) TEST_F(ClangQueryHighlightMarker, OneContextsForInsidePosition) { - Context context{{{0, 1}, 1, 5, 0, 3, 3, 0}, + Context context{{1, 1, 5, 0, 3, 3, 0}, ContextType::MatcherArg, {"foo"}}; Messages messages; @@ -367,7 +367,7 @@ TEST_F(ClangQueryHighlightMarker, OneContextsForInsidePosition) TEST_F(ClangQueryHighlightMarker, NoContextsForOutsidePosition) { - Context context{{{0, 1}, 1, 5, 0, 3, 3, 0}, + Context context{{1, 1, 5, 0, 3, 3, 0}, ContextType::MatcherArg, {"foo"}}; Messages messages; diff --git a/tests/unit/unittest/compilationdatabaseutils-test.cpp b/tests/unit/unittest/compilationdatabaseutils-test.cpp index 2d528b9793a..252ab2ffd62 100644 --- a/tests/unit/unittest/compilationdatabaseutils-test.cpp +++ b/tests/unit/unittest/compilationdatabaseutils-test.cpp @@ -53,11 +53,18 @@ TEST_F(CompilationDatabaseUtils, FilterEmptyFlags) ASSERT_THAT(flags.isEmpty(), true); } +TEST_F(CompilationDatabaseUtils, FilterFromFilename) +{ + flags = filterFromFileName(QStringList{"-o", "foo.o"}, "foo"); + + ASSERT_THAT(flags, QStringList{"-o"}); +} + TEST_F(CompilationDatabaseUtils, FilterArguments) { fileName = "compileroptionsbuilder.cpp"; workingDir = "C:/build-qtcreator-MinGW_32bit-Debug"; - flags = QStringList { + flags = filterFromFileName(QStringList { "clang++", "-c", "-m32", @@ -77,7 +84,7 @@ TEST_F(CompilationDatabaseUtils, FilterArguments) "-x", "c++", "C:\\qt-creator\\src\\plugins\\cpptools\\compileroptionsbuilder.cpp" - }; + }, "compileroptionsbuilder"); filteredFlags(fileName, workingDir, flags, headerPaths, macros, fileKind); @@ -146,7 +153,7 @@ TEST_F(CompilationDatabaseUtils, FilterCommand) { fileName = "SemaCodeComplete.cpp"; workingDir = "C:/build-qt_llvm-msvc2017_64bit-Debug"; - flags = splitCommandLine(kCmakeCommand); + flags = filterFromFileName(splitCommandLine(kCmakeCommand), "SemaCodeComplete"); filteredFlags(fileName, workingDir, flags, headerPaths, macros, fileKind); @@ -188,8 +195,7 @@ TEST_F(CompilationDatabaseUtils, FileKindDifferentFromExtension2) TEST_F(CompilationDatabaseUtils, SkipOutputFiles) { - fileName = "foo.cpp"; - flags = QStringList{"-o", "foo.o"}; + flags = filterFromFileName(QStringList{"-o", "foo.o"}, "foo"); filteredFlags(fileName, workingDir, flags, headerPaths, macros, fileKind); diff --git a/tests/unit/unittest/filepathcache-test.cpp b/tests/unit/unittest/filepathcache-test.cpp index 282654ad7b1..43b5b026bbf 100644 --- a/tests/unit/unittest/filepathcache-test.cpp +++ b/tests/unit/unittest/filepathcache-test.cpp @@ -36,11 +36,28 @@ using Cache = ClangBackEnd::FilePathCache>; using ClangBackEnd::FilePathId; using NFP = ClangBackEnd::FilePath; using ClangBackEnd::FilePathView; +using ClangBackEnd::Sources::SourceNameAndDirectoryId; class FilePathCache : public testing::Test { protected: - void SetUp(); + void SetUp() + { + ON_CALL(mockStorage, fetchDirectoryId(Eq("/path/to"))) + .WillByDefault(Return(5)); + ON_CALL(mockStorage, fetchDirectoryId(Eq("/path2/to"))) + .WillByDefault(Return(6)); + ON_CALL(mockStorage, fetchSourceId(5, Eq("file.cpp"))) + .WillByDefault(Return(42)); + ON_CALL(mockStorage, fetchSourceId(5, Eq("file2.cpp"))) + .WillByDefault(Return(63)); + ON_CALL(mockStorage, fetchSourceId(6, Eq("file.cpp"))) + .WillByDefault(Return(72)); + ON_CALL(mockStorage, fetchDirectoryPath(5)) + .WillByDefault(Return(Utils::PathString("/path/to"))); + ON_CALL(mockStorage, fetchSourceNameAndDirectoryId(42)) + .WillByDefault(Return(SourceNameAndDirectoryId("file.cpp", 5))); + } protected: NiceMock mockStorage; @@ -61,13 +78,6 @@ TEST_F(FilePathCache, FilePathIdWithOutAnyEntryCalls) cache.filePathId(FilePathView("/path/to/file.cpp")); } -TEST_F(FilePathCache, DirectoryIdOfFilePathIdWithOutAnyEntry) -{ - auto filePathId = cache.filePathId(FilePathView("/path/to/file.cpp")); - - ASSERT_THAT(filePathId.directoryId, 5); -} - TEST_F(FilePathCache, FilePathIdOfFilePathIdWithOutAnyEntry) { auto filePathId = cache.filePathId(FilePathView("/path/to/file.cpp")); @@ -113,24 +123,6 @@ TEST_F(FilePathCache, GetFilePathIdWithDirectoryIdCached) ASSERT_THAT(filePathId.filePathId, 63); } -TEST_F(FilePathCache, GetDirectyIdWithCachedValue) -{ - cache.filePathId(FilePathView("/path/to/file.cpp")); - - auto filePathId = cache.filePathId(FilePathView("/path/to/file2.cpp")); - - ASSERT_THAT(filePathId.directoryId, 5); -} - -TEST_F(FilePathCache, GetDirectyIdWithDirectoryIdCached) -{ - cache.filePathId(FilePathView("/path/to/file.cpp")); - - auto filePathId = cache.filePathId(FilePathView("/path/to/file2.cpp")); - - ASSERT_THAT(filePathId.directoryId, 5); -} - TEST_F(FilePathCache, ThrowForGettingAFilePathWithAnInvalidId) { FilePathId filePathId; @@ -149,7 +141,7 @@ TEST_F(FilePathCache, GetAFilePath) TEST_F(FilePathCache, GetAFilePathWithCachedFilePathId) { - FilePathId filePathId{5, 42}; + FilePathId filePathId{42}; auto filePath = cache.filePath(filePathId); @@ -174,22 +166,4 @@ TEST_F(FilePathCache, DuplicateFilePathsAreEqual) ASSERT_THAT(filePath2Id, Eq(filePath1Id)); } -void FilePathCache::SetUp() -{ - ON_CALL(mockStorage, fetchDirectoryId(Eq("/path/to"))) - .WillByDefault(Return(5)); - ON_CALL(mockStorage, fetchDirectoryId(Eq("/path2/to"))) - .WillByDefault(Return(6)); - ON_CALL(mockStorage, fetchSourceId(5, Eq("file.cpp"))) - .WillByDefault(Return(42)); - ON_CALL(mockStorage, fetchSourceId(5, Eq("file2.cpp"))) - .WillByDefault(Return(63)); - ON_CALL(mockStorage, fetchSourceId(6, Eq("file.cpp"))) - .WillByDefault(Return(72)); - ON_CALL(mockStorage, fetchDirectoryPath(5)) - .WillByDefault(Return(Utils::PathString("/path/to"))); - ON_CALL(mockStorage, fetchSourceName(42)) - .WillByDefault(Return(Utils::SmallString("file.cpp"))); -} - } diff --git a/tests/unit/unittest/filepathstorage-test.cpp b/tests/unit/unittest/filepathstorage-test.cpp index 2692f9f79d0..f94f3dfad21 100644 --- a/tests/unit/unittest/filepathstorage-test.cpp +++ b/tests/unit/unittest/filepathstorage-test.cpp @@ -43,7 +43,58 @@ using ClangBackEnd::Sources::Source; class FilePathStorage : public testing::Test { protected: - void SetUp(); + void SetUp() + { + ON_CALL(selectDirectoryIdFromDirectoriesByDirectoryPath, + valueReturnInt32(_)) + .WillByDefault(Return(Utils::optional())); + ON_CALL(selectDirectoryIdFromDirectoriesByDirectoryPath, + valueReturnInt32(Utils::SmallStringView(""))) + .WillByDefault(Return(Utils::optional(0))); + ON_CALL(selectDirectoryIdFromDirectoriesByDirectoryPath, + valueReturnInt32(Utils::SmallStringView("/path/to"))) + .WillByDefault(Return(Utils::optional(5))); + ON_CALL(mockDatabase, lastInsertedRowId()) + .WillByDefault(Return(12)); + ON_CALL(selectAllDirectories, + valuesReturnStdVectorDirectory(_)) + .WillByDefault(Return(std::vector{{1, "/path/to"}, {2, "/other/path"}})); + ON_CALL(selectSourceIdFromSourcesByDirectoryIdAndSourceName, + valueReturnInt32(_, _)) + .WillByDefault(Return(Utils::optional())); + ON_CALL(selectSourceIdFromSourcesByDirectoryIdAndSourceName, + valueReturnInt32(0, Utils::SmallStringView(""))) + .WillByDefault(Return(Utils::optional(0))); + ON_CALL(selectSourceIdFromSourcesByDirectoryIdAndSourceName, + valueReturnInt32(5, Utils::SmallStringView("file.h"))) + .WillByDefault(Return(Utils::optional(42))); + ON_CALL(selectAllSources, + valuesReturnStdVectorSource(_)) + .WillByDefault(Return(std::vector{{1, "file.h"}, {4, "file.cpp"}})); + ON_CALL(selectDirectoryPathFromDirectoriesByDirectoryId, + valueReturnPathString(5)) + .WillByDefault(Return(Utils::optional("/path/to"))); + ON_CALL(selectSourceNameAndDirectoryIdFromSourcesBySourceId, + valueReturnSourceNameAndDirectoryId(42)) + .WillByDefault(Return(Utils::optional({"file.cpp", 5}))); + + EXPECT_CALL(selectDirectoryIdFromDirectoriesByDirectoryPath, valueReturnInt32(_)) + .Times(AnyNumber()); + EXPECT_CALL(selectSourceIdFromSourcesByDirectoryIdAndSourceName, valueReturnInt32(_, _)) + .Times(AnyNumber()); + EXPECT_CALL(insertIntoDirectories, write(An())) + .Times(AnyNumber()); + EXPECT_CALL(insertIntoSources, write(An(), A())) + .Times(AnyNumber()); + EXPECT_CALL(selectAllDirectories, valuesReturnStdVectorDirectory(_)) + .Times(AnyNumber()); + EXPECT_CALL(selectAllSources, valuesReturnStdVectorSource(_)) + .Times(AnyNumber()); + EXPECT_CALL(selectDirectoryPathFromDirectoriesByDirectoryId, valueReturnPathString(_)) + .Times(AnyNumber()); + EXPECT_CALL(selectSourceNameAndDirectoryIdFromSourcesBySourceId, valueReturnSourceNameAndDirectoryId(_)) + .Times(AnyNumber()); + } protected: NiceMock mockDatabase; @@ -51,7 +102,7 @@ protected: MockSqliteReadStatement &selectDirectoryIdFromDirectoriesByDirectoryPath = factory.selectDirectoryIdFromDirectoriesByDirectoryPath; MockSqliteReadStatement &selectSourceIdFromSourcesByDirectoryIdAndSourceName = factory.selectSourceIdFromSourcesByDirectoryIdAndSourceName; MockSqliteReadStatement &selectDirectoryPathFromDirectoriesByDirectoryId = factory.selectDirectoryPathFromDirectoriesByDirectoryId; - MockSqliteReadStatement &selectSourceNameFromSourcesBySourceId = factory.selectSourceNameFromSourcesBySourceId; + MockSqliteReadStatement &selectSourceNameAndDirectoryIdFromSourcesBySourceId = factory.selectSourceNameAndDirectoryIdFromSourcesBySourceId; MockSqliteReadStatement &selectAllDirectories = factory.selectAllDirectories; MockSqliteWriteStatement &insertIntoDirectories = factory.insertIntoDirectories; MockSqliteWriteStatement &insertIntoSources = factory.insertIntoSources; @@ -397,22 +448,23 @@ TEST_F(FilePathStorage, ThrowAsFetchingDirectoryPathForNonExistingId) TEST_F(FilePathStorage, CallValueForFetchSoureNameForId) { EXPECT_CALL(mockDatabase, deferredBegin()); - EXPECT_CALL(selectSourceNameFromSourcesBySourceId, valueReturnSmallString(42)); + EXPECT_CALL(selectSourceNameAndDirectoryIdFromSourcesBySourceId, valueReturnSourceNameAndDirectoryId(42)); EXPECT_CALL(mockDatabase, commit()); - storage.fetchSourceName(42); + storage.fetchSourceNameAndDirectoryId(42); } TEST_F(FilePathStorage, FetchSoureNameForId) { - auto path = storage.fetchSourceName(42); + auto entry = storage.fetchSourceNameAndDirectoryId(42); - ASSERT_THAT(path, Eq("file.cpp")); + ASSERT_THAT(entry.sourceName, Eq("file.cpp")); + ASSERT_THAT(entry.directoryId, 5); } TEST_F(FilePathStorage, ThrowAsFetchingSourceNameForNonExistingId) { - ASSERT_THROW(storage.fetchSourceName(12), ClangBackEnd::SourceNameIdDoesNotExists); + ASSERT_THROW(storage.fetchSourceNameAndDirectoryId(12), ClangBackEnd::SourceNameIdDoesNotExists); } TEST_F(FilePathStorage, RestartFetchSourceNameIfTheDatabaseIsBusyInBegin) @@ -425,11 +477,11 @@ TEST_F(FilePathStorage, RestartFetchSourceNameIfTheDatabaseIsBusyInBegin) EXPECT_CALL(mockDatabase, unlock()); EXPECT_CALL(mockDatabase, lock()); EXPECT_CALL(mockDatabase, deferredBegin()); - EXPECT_CALL(selectSourceNameFromSourcesBySourceId, valueReturnSmallString(42)); + EXPECT_CALL(selectSourceNameAndDirectoryIdFromSourcesBySourceId, valueReturnSourceNameAndDirectoryId(42)); EXPECT_CALL(mockDatabase, commit()); EXPECT_CALL(mockDatabase, unlock()); - storage.fetchSourceName(42); + storage.fetchSourceNameAndDirectoryId(42); } TEST_F(FilePathStorage, RestartFetchDirectoryPathIfTheDatabaseIsBusyInBegin) @@ -483,56 +535,4 @@ TEST_F(FilePathStorage, RestartFetchAllSourcesIfBeginIsBusy) storage.fetchAllSources(); } -void FilePathStorage::SetUp() -{ - ON_CALL(selectDirectoryIdFromDirectoriesByDirectoryPath, - valueReturnInt32(_)) - .WillByDefault(Return(Utils::optional())); - ON_CALL(selectDirectoryIdFromDirectoriesByDirectoryPath, - valueReturnInt32(Utils::SmallStringView(""))) - .WillByDefault(Return(Utils::optional(0))); - ON_CALL(selectDirectoryIdFromDirectoriesByDirectoryPath, - valueReturnInt32(Utils::SmallStringView("/path/to"))) - .WillByDefault(Return(Utils::optional(5))); - ON_CALL(mockDatabase, lastInsertedRowId()) - .WillByDefault(Return(12)); - ON_CALL(selectAllDirectories, - valuesReturnStdVectorDirectory(_)) - .WillByDefault(Return(std::vector{{1, "/path/to"}, {2, "/other/path"}})); - ON_CALL(selectSourceIdFromSourcesByDirectoryIdAndSourceName, - valueReturnInt32(_, _)) - .WillByDefault(Return(Utils::optional())); - ON_CALL(selectSourceIdFromSourcesByDirectoryIdAndSourceName, - valueReturnInt32(0, Utils::SmallStringView(""))) - .WillByDefault(Return(Utils::optional(0))); - ON_CALL(selectSourceIdFromSourcesByDirectoryIdAndSourceName, - valueReturnInt32(5, Utils::SmallStringView("file.h"))) - .WillByDefault(Return(Utils::optional(42))); - ON_CALL(selectAllSources, - valuesReturnStdVectorSource(_)) - .WillByDefault(Return(std::vector{{1, "file.h"}, {4, "file.cpp"}})); - ON_CALL(selectDirectoryPathFromDirectoriesByDirectoryId, - valueReturnPathString(5)) - .WillByDefault(Return(Utils::optional("/path/to"))); - ON_CALL(selectSourceNameFromSourcesBySourceId, - valueReturnSmallString(42)) - .WillByDefault(Return(Utils::optional("file.cpp"))); - - EXPECT_CALL(selectDirectoryIdFromDirectoriesByDirectoryPath, valueReturnInt32(_)) - .Times(AnyNumber()); - EXPECT_CALL(selectSourceIdFromSourcesByDirectoryIdAndSourceName, valueReturnInt32(_, _)) - .Times(AnyNumber()); - EXPECT_CALL(insertIntoDirectories, write(An())) - .Times(AnyNumber()); - EXPECT_CALL(insertIntoSources, write(An(), A())) - .Times(AnyNumber()); - EXPECT_CALL(selectAllDirectories, valuesReturnStdVectorDirectory(_)) - .Times(AnyNumber()); - EXPECT_CALL(selectAllSources, valuesReturnStdVectorSource(_)) - .Times(AnyNumber()); - EXPECT_CALL(selectDirectoryPathFromDirectoriesByDirectoryId, valueReturnPathString(_)) - .Times(AnyNumber()); - EXPECT_CALL(selectSourceNameFromSourcesBySourceId, valueReturnSmallString(_)) - .Times(AnyNumber()); -} } diff --git a/tests/unit/unittest/filepathstoragesqlitestatementfactory-test.cpp b/tests/unit/unittest/filepathstoragesqlitestatementfactory-test.cpp index 92ddc10a4a8..ac902fa7001 100644 --- a/tests/unit/unittest/filepathstoragesqlitestatementfactory-test.cpp +++ b/tests/unit/unittest/filepathstoragesqlitestatementfactory-test.cpp @@ -63,8 +63,8 @@ TEST_F(FilePathStorageSqliteStatementFactory, SelectSourceIdFromSourcesByDirecto TEST_F(FilePathStorageSqliteStatementFactory, SelectSourceNameFromSourcesByDirectoryIdAndSourceId) { - ASSERT_THAT(factory.selectSourceNameFromSourcesBySourceId.sqlStatement, - Eq("SELECT sourceName FROM sources WHERE sourceId = ?")); + ASSERT_THAT(factory.selectSourceNameAndDirectoryIdFromSourcesBySourceId.sqlStatement, + Eq("SELECT sourceName, directoryId FROM sources WHERE sourceId = ?")); } TEST_F(FilePathStorageSqliteStatementFactory, SelectAllDirectories) diff --git a/tests/unit/unittest/gtest-creator-printing.cpp b/tests/unit/unittest/gtest-creator-printing.cpp index 2af5894d632..08433ff393f 100644 --- a/tests/unit/unittest/gtest-creator-printing.cpp +++ b/tests/unit/unittest/gtest-creator-printing.cpp @@ -32,7 +32,7 @@ #include -#include +#include #include #include #include @@ -171,7 +171,7 @@ namespace ClangBackEnd { std::ostream &operator<<(std::ostream &out, const FilePathId &id) { - return out << "(" << id.directoryId << ", " << id.filePathId << ")"; + return out << "(" << id.filePathId << ")"; } std::ostream &operator<<(std::ostream &out, const FilePathView &filePathView) @@ -1033,11 +1033,29 @@ std::ostream &operator<<(std::ostream &out, const PchTask &task) std::ostream &operator<<(std::ostream &out, const BuildDependency &dependency) { return out << "(" - << dependency.includeIds << ", " + << dependency.includes << ", " << dependency.topsSystemIncludeIds << ", " << dependency.topIncludeIds << ")"; } +const char *sourceTypeString(SourceType sourceType) +{ + using ClangBackEnd::SymbolTag; + + switch (sourceType) { + case SourceType::Any: return "Any"; + case SourceType::TopInclude: return "TopInclude"; + case SourceType::TopSystemInclude: return "TopSystemInclude"; + } + + return ""; +} + +std::ostream &operator<<(std::ostream &out, const SourceEntry &entry) +{ + return out << "(" << entry.sourceId << ", " << sourceTypeString(entry.sourceType) << ")"; +} + void PrintTo(const FilePath &filePath, ::std::ostream *os) { *os << filePath; @@ -1086,8 +1104,8 @@ std::ostream &operator<<(std::ostream &out, const ProjectPartContainer &containe std::ostream &operator<<(std::ostream &os, const SourceLocationContainer &container) { - os << "((" - << container.filePathId.directoryId << ", " << container.filePathId.filePathId << "), " + os << "(" + << container.filePathId.filePathId << ", " << container.line << ", " << container.column << ", " << container.offset diff --git a/tests/unit/unittest/gtest-creator-printing.h b/tests/unit/unittest/gtest-creator-printing.h index 51692acea77..09331e7ef2b 100644 --- a/tests/unit/unittest/gtest-creator-printing.h +++ b/tests/unit/unittest/gtest-creator-printing.h @@ -173,6 +173,7 @@ class ProgressMessage; class PchCreatorIncludes; class PchTask; class BuildDependency; +class SourceEntry; std::ostream &operator<<(std::ostream &out, const SourceLocationEntry &entry); std::ostream &operator<<(std::ostream &out, const IdPaths &idPaths); @@ -256,6 +257,7 @@ std::ostream &operator<<(std::ostream &out, const ProgressMessage &message); std::ostream &operator<<(std::ostream &out, const PchCreatorIncludes &includes); std::ostream &operator<<(std::ostream &out, const PchTask &task); std::ostream &operator<<(std::ostream &out, const BuildDependency &dependency); +std::ostream &operator<<(std::ostream &out, const SourceEntry &entry); void PrintTo(const FilePath &filePath, ::std::ostream *os); void PrintTo(const FilePathView &filePathView, ::std::ostream *os); diff --git a/tests/unit/unittest/locatorfilter-test.cpp b/tests/unit/unittest/locatorfilter-test.cpp index 00bdbbd1aea..1cc15b281c6 100644 --- a/tests/unit/unittest/locatorfilter-test.cpp +++ b/tests/unit/unittest/locatorfilter-test.cpp @@ -69,7 +69,7 @@ protected: int length = 0; QString newText; Utils::LineColumn lineColumn{4, 3}; - ClangBackEnd::FilePathId filePathId{42, 64}; + ClangBackEnd::FilePathId filePathId{64}; ClangRefactoring::SourceLocation sourceLocation{filePathId, lineColumn}; }; diff --git a/tests/unit/unittest/mockusedmacroandsourcestorage.h b/tests/unit/unittest/mockbuilddependenciesgenerator.h similarity index 63% rename from tests/unit/unittest/mockusedmacroandsourcestorage.h rename to tests/unit/unittest/mockbuilddependenciesgenerator.h index 6fba12c26ca..832c37f0bf9 100644 --- a/tests/unit/unittest/mockusedmacroandsourcestorage.h +++ b/tests/unit/unittest/mockbuilddependenciesgenerator.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2017 The Qt Company Ltd. +** Copyright (C) 2018 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of Qt Creator. @@ -27,19 +27,12 @@ #include "googletest.h" -#include "mocksqlitedatabase.h" +#include -#include - -class MockUsedMacroAndSourceStorage : public ClangBackEnd::UsedMacroAndSourceStorageInterface +class MockBuildDependenciesGenerator : public ClangBackEnd::BuildDependenciesGeneratorInterface { public: - MOCK_METHOD1(insertOrUpdateUsedMacros, - void (const ClangBackEnd::UsedMacros &usedMacros)); - MOCK_METHOD1(insertFileStatuses, - void (const ClangBackEnd::FileStatuses &fileStatuses)); - MOCK_METHOD1(insertOrUpdateSourceDependencies, - void (const ClangBackEnd::SourceDependencies &sourceDependencies)); - MOCK_CONST_METHOD1(fetchLowestLastModifiedTime, - long long (ClangBackEnd::FilePathId sourceId)); + MOCK_METHOD1(create, + ClangBackEnd::BuildDependency (const ClangBackEnd::V2::ProjectPartContainer &projectPart)); }; + diff --git a/tests/unit/unittest/mockbuilddependenciesprovider.h b/tests/unit/unittest/mockbuilddependenciesprovider.h index 9bd8175a5f2..8bb048bd248 100644 --- a/tests/unit/unittest/mockbuilddependenciesprovider.h +++ b/tests/unit/unittest/mockbuilddependenciesprovider.h @@ -32,6 +32,6 @@ class MockBuildDependenciesProvider : public ClangBackEnd::BuildDependenciesProviderInterface { public: - MOCK_METHOD1(create, - ClangBackEnd::BuildDependency (const ClangBackEnd::V2::ProjectPartContainer &projectPart)); + MOCK_CONST_METHOD1(create, + ClangBackEnd::BuildDependency (const ClangBackEnd::V2::ProjectPartContainer &projectPart)); }; diff --git a/tests/unit/unittest/mockbuilddependenciesstorage.h b/tests/unit/unittest/mockbuilddependenciesstorage.h new file mode 100644 index 00000000000..a654579a831 --- /dev/null +++ b/tests/unit/unittest/mockbuilddependenciesstorage.h @@ -0,0 +1,50 @@ +/**************************************************************************** +** +** Copyright (C) 2018 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +****************************************************************************/ + +#pragma once + +#include "googletest.h" + +#include + +class MockBuildDependenciesStorage : public ClangBackEnd::BuildDependenciesStorageInterface +{ +public: + MOCK_METHOD1(updateSources, + void (const ClangBackEnd::SourceEntries &sources)); + MOCK_METHOD1(insertOrUpdateUsedMacros, + void (const ClangBackEnd::UsedMacros &usedMacros)); + MOCK_METHOD1(insertFileStatuses, + void (const ClangBackEnd::FileStatuses &fileStatuses)); + MOCK_METHOD1(insertOrUpdateSourceDependencies, + void (const ClangBackEnd::SourceDependencies &sourceDependencies)); + MOCK_CONST_METHOD1(fetchLowestLastModifiedTime, + long long (ClangBackEnd::FilePathId sourceId)); + MOCK_CONST_METHOD2(fetchDependSources, + ClangBackEnd::SourceEntries (ClangBackEnd::FilePathId sourceId, Utils::SmallStringView)); + MOCK_CONST_METHOD1(fetchUsedMacros, + ClangBackEnd::UsedMacros (ClangBackEnd::FilePathId sourceId)); +}; + diff --git a/tests/unit/unittest/mockfilepathstorage.h b/tests/unit/unittest/mockfilepathstorage.h index b1114747b1c..7056ee2480a 100644 --- a/tests/unit/unittest/mockfilepathstorage.h +++ b/tests/unit/unittest/mockfilepathstorage.h @@ -27,6 +27,8 @@ #include "googletest.h" +#include + class MockFilePathStorage { public: @@ -36,7 +38,7 @@ public: int (int directoryId, Utils::SmallStringView sourceName)); MOCK_METHOD1(fetchDirectoryPath, Utils::PathString (int directoryId)); - MOCK_METHOD1(fetchSourceName, - Utils::SmallString (int sourceId)); + MOCK_METHOD1(fetchSourceNameAndDirectoryId, + ClangBackEnd::Sources::SourceNameAndDirectoryId (int sourceId)); }; diff --git a/tests/unit/unittest/mockmodifiedtimechecker.h b/tests/unit/unittest/mockmodifiedtimechecker.h new file mode 100644 index 00000000000..5f0559f6824 --- /dev/null +++ b/tests/unit/unittest/mockmodifiedtimechecker.h @@ -0,0 +1,37 @@ +/**************************************************************************** +** +** Copyright (C) 2018 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +****************************************************************************/ + +#pragma once + +#include "googletest.h" + +#include + +class MockModifiedTimeChecker : public ClangBackEnd::ModifiedTimeCheckerInterface +{ +public: + MOCK_CONST_METHOD1(isUpToDate, + bool (const ClangBackEnd::SourceEntries &sourceEntries)); +}; diff --git a/tests/unit/unittest/mocksqlitereadstatement.cpp b/tests/unit/unittest/mocksqlitereadstatement.cpp index eb114e3a47a..66406f09faa 100644 --- a/tests/unit/unittest/mocksqlitereadstatement.cpp +++ b/tests/unit/unittest/mocksqlitereadstatement.cpp @@ -27,7 +27,7 @@ template <> SourceLocations -MockSqliteReadStatement::values(std::size_t reserveSize, +MockSqliteReadStatement::values(std::size_t reserveSize, const int &sourceId, const int &line, const int &column) @@ -81,6 +81,15 @@ MockSqliteReadStatement::values( } +template <> +UsedMacros +MockSqliteReadStatement::values( + std::size_t reserveSize, + const int &sourceId) +{ + return valuesReturnUsedMacros(reserveSize, sourceId); +} + template <> std::vector MockSqliteReadStatement::values(std::size_t reserveSize) { @@ -158,7 +167,21 @@ MockSqliteReadStatement::value(const int &sourceId) template <> Utils::optional -MockSqliteReadStatement::value(const long long &symbolId, const int &locationKind) +MockSqliteReadStatement::value(const long long &symbolId, const int &locationKind) { return valueReturnSourceLocation(symbolId, locationKind); } + +template <> +SourceEntries +MockSqliteReadStatement::values(std::size_t reserveSize, const int &filePathId, const int &projectPartId) +{ + return valuesReturnSourceEntries(reserveSize, filePathId, projectPartId); +} + +template <> +Utils::optional +MockSqliteReadStatement::value(const int &id) +{ + return valueReturnSourceNameAndDirectoryId(id); +} diff --git a/tests/unit/unittest/mocksqlitereadstatement.h b/tests/unit/unittest/mocksqlitereadstatement.h index 2ad17ee07f2..e5926d2d17a 100644 --- a/tests/unit/unittest/mocksqlitereadstatement.h +++ b/tests/unit/unittest/mocksqlitereadstatement.h @@ -33,6 +33,8 @@ #include #include #include +#include +#include #include #include @@ -45,11 +47,14 @@ #include using std::int64_t; +using ClangBackEnd::SourceEntry; +using ClangBackEnd::SourceEntries; using ClangRefactoring::SourceLocation; using ClangRefactoring::SourceLocations; namespace Sources = ClangBackEnd::Sources; using ClangRefactoring::Symbol; using ClangRefactoring::Symbols; +using ClangBackEnd::UsedMacros; class MockSqliteDatabase; @@ -73,6 +78,12 @@ public: MOCK_METHOD1(valuesReturnStdVectorSource, std::vector(std::size_t)); + MOCK_METHOD3(valuesReturnSourceEntries, + SourceEntries(std::size_t, int, int)); + + MOCK_METHOD2(valuesReturnUsedMacros, + UsedMacros (std::size_t, int)); + MOCK_METHOD1(valueReturnInt32, Utils::optional(Utils::SmallStringView)); @@ -88,6 +99,9 @@ public: MOCK_METHOD1(valueReturnSmallString, Utils::optional(int)); + MOCK_METHOD1(valueReturnSourceNameAndDirectoryId, + Utils::optional(int)); + MOCK_METHOD1(valueReturnProjectPartArtefact, Utils::optional(int)); @@ -137,7 +151,7 @@ public: template <> SourceLocations -MockSqliteReadStatement::values( +MockSqliteReadStatement::values( std::size_t reserveSize, const int &sourceId, const int &line, @@ -175,6 +189,12 @@ MockSqliteReadStatement::values( const int&, const Utils::SmallStringView&); +template <> +UsedMacros +MockSqliteReadStatement::values( + std::size_t reserveSize, + const int &sourceId); + template <> std::vector MockSqliteReadStatement::values(std::size_t reserveSize); @@ -219,4 +239,12 @@ MockSqliteReadStatement::value(const int&); template <> Utils::optional -MockSqliteReadStatement::value(const long long &symbolId, const int &locationKind); +MockSqliteReadStatement::value(const long long &symbolId, const int &locationKind); + +template <> +SourceEntries +MockSqliteReadStatement::values(std::size_t reserveSize, const int&, const int&); + +template <> +Utils::optional +MockSqliteReadStatement::value(const int&); diff --git a/tests/unit/unittest/mocksqlitewritestatement.h b/tests/unit/unittest/mocksqlitewritestatement.h index 05d2404d914..8da4db8ef5f 100644 --- a/tests/unit/unittest/mocksqlitewritestatement.h +++ b/tests/unit/unittest/mocksqlitewritestatement.h @@ -99,5 +99,11 @@ public: MOCK_METHOD2(write, void (uint, uint)); + MOCK_METHOD2(write, + void (uchar, int)); + + MOCK_METHOD2(write, + void (long long, int)); + Utils::SmallString sqlStatement; }; diff --git a/tests/unit/unittest/pchmanagerserver-test.cpp b/tests/unit/unittest/pchmanagerserver-test.cpp index 6732fd74c46..336af38159b 100644 --- a/tests/unit/unittest/pchmanagerserver-test.cpp +++ b/tests/unit/unittest/pchmanagerserver-test.cpp @@ -79,7 +79,7 @@ protected: PathString main2Path = TESTDATA_DIR "/includecollector_main2.cpp"; PathString header1Path = TESTDATA_DIR "/includecollector_header1.h"; PathString header2Path = TESTDATA_DIR "/includecollector_header2.h"; - ClangBackEnd::IdPaths idPath{projectPartId1, {{1, 1}, {1, 2}}}; + ClangBackEnd::IdPaths idPath{projectPartId1, {1, 2}}; ProjectPartContainer projectPart1{projectPartId1.clone(), {"-I", TESTDATA_DIR, "-Wno-pragma-once-outside-header"}, {{"DEFINE", "1"}}, diff --git a/tests/unit/unittest/pchtaskgenerator-test.cpp b/tests/unit/unittest/pchtaskgenerator-test.cpp index cfb34f4c5db..248803cc4b0 100644 --- a/tests/unit/unittest/pchtaskgenerator-test.cpp +++ b/tests/unit/unittest/pchtaskgenerator-test.cpp @@ -35,6 +35,8 @@ using ClangBackEnd::BuildDependency; using ClangBackEnd::BuildDependencies; using ClangBackEnd::FilePathId; using ClangBackEnd::PchTask; +using ClangBackEnd::SourceEntries; +using ClangBackEnd::SourceType; class PchTaskGenerator : public testing::Test { @@ -47,7 +49,8 @@ protected: {"/yi"}, {{1, 1}}, {{1, 2}}}; - BuildDependency buildDependency{{{1, 1}}, {}, {}}; + SourceEntries firstSources{{1, SourceType::Any, 1}, {2, SourceType::Any, 1}, {10, SourceType::Any, 1}}; + BuildDependency buildDependency{firstSources, {}, {}, {}}; }; TEST_F(PchTaskGenerator, Create) @@ -60,7 +63,7 @@ TEST_F(PchTaskGenerator, Create) ElementsAre( AllOf(Field(&PchTask::ids, ElementsAre("ProjectPart1")), Field(&PchTask::buildDependency, - Field(&BuildDependency::includeIds, ElementsAre(FilePathId{1, 1})))))); + Field(&BuildDependency::includes, firstSources))))); } } diff --git a/tests/unit/unittest/projectpartqueue-test.cpp b/tests/unit/unittest/projectpartqueue-test.cpp index bf7748cd503..03561728fd0 100644 --- a/tests/unit/unittest/projectpartqueue-test.cpp +++ b/tests/unit/unittest/projectpartqueue-test.cpp @@ -48,26 +48,26 @@ protected: {"--yi"}, {{"YI","1"}}, {"/yi"}, - {{1, 1}}, - {{1, 2}}}; + {1}, + {2}}; ClangBackEnd::V2::ProjectPartContainer projectPart2{"ProjectPart2", {"--er"}, {{"ER","2"}}, {"/bar"}, - {{2, 1}}, - {{2, 2}}}; + {1}, + {2}}; ClangBackEnd::V2::ProjectPartContainer projectPart2b{"ProjectPart2", {"--liang"}, {{"LIANG","3"}}, {"/liang"}, - {{2, 3}}, - {{2, 2}, {2, 4}}}; + {3}, + {2, 4}}; ClangBackEnd::V2::ProjectPartContainer projectPart3{"ProjectPart3", {"--san"}, {{"SAN","2"}}, {"/SAN"}, - {{3, 1}}, - {{3, 2}}}; + {1}, + {2}}; }; TEST_F(ProjectPartQueue, AddProjectPart) diff --git a/tests/unit/unittest/projectparts-test.cpp b/tests/unit/unittest/projectparts-test.cpp index 74d1c863381..405b955fed0 100644 --- a/tests/unit/unittest/projectparts-test.cpp +++ b/tests/unit/unittest/projectparts-test.cpp @@ -42,11 +42,11 @@ class ProjectParts : public testing::Test { protected: ClangBackEnd::ProjectParts projectParts; - FilePathId firstHeader{1, 1}; - FilePathId secondHeader{1, 2}; - FilePathId firstSource{1, 11}; - FilePathId secondSource{1, 12}; - FilePathId thirdSource{1, 13}; + FilePathId firstHeader{1}; + FilePathId secondHeader{2}; + FilePathId firstSource{11}; + FilePathId secondSource{12}; + FilePathId thirdSource{13}; ProjectPartContainer projectPartContainer1{"id", {"-DUNIX", "-O2"}, {{"DEFINE", "1"}}, diff --git a/tests/unit/unittest/refactoringclient-test.cpp b/tests/unit/unittest/refactoringclient-test.cpp index c3b290815ed..37b6e2a7446 100644 --- a/tests/unit/unittest/refactoringclient-test.cpp +++ b/tests/unit/unittest/refactoringclient-test.cpp @@ -87,10 +87,10 @@ protected: CppTools::ProjectPart::Ptr projectPart; CppTools::ProjectFile projectFile{qStringFilePath, CppTools::ProjectFile::CXXSource}; SourceLocationsForRenamingMessage renameMessage{"symbol", - {{{{1, 42}, 1, 1, 0}, {{1, 42}, 2, 5, 10}}}, + {{{42, 1, 1, 0}, {42, 2, 5, 10}}}, 1}; - SourceRangesForQueryMessage queryResultMessage{{{{{1, 42}, 1, 1, 0, 1, 5, 4, ""}, - {{1, 42}, 2, 1, 5, 2, 5, 10, ""}}}}; + SourceRangesForQueryMessage queryResultMessage{{{{42, 1, 1, 0, 1, 5, 4, ""}, + {42, 2, 1, 5, 2, 5, 10, ""}}}}; SourceRangesForQueryMessage emptyQueryResultMessage; }; @@ -214,7 +214,7 @@ TEST_F(RefactoringClient, ResultCounterIsZeroAfterSettingExpectedResultCount) TEST_F(RefactoringClient, XXX) { const Core::Search::TextRange textRange{{1,0,1},{1,0,1}}; - const ClangBackEnd::SourceRangeWithTextContainer sourceRange{{1, 1}, 1, 1, 1, 1, 1, 1, "function"}; + const ClangBackEnd::SourceRangeWithTextContainer sourceRange{1, 1, 1, 1, 1, 1, 1, "function"}; EXPECT_CALL(mockSearchHandle, addResult(QString("/path/to/file"), QString("function"), textRange)) .Times(1); @@ -243,9 +243,9 @@ void RefactoringClient::SetUp() client.setSearchHandle(&mockSearchHandle); client.setExpectedResultCount(1); - ON_CALL(mockFilePathCaching, filePath(Eq(FilePathId{1, 1}))) + ON_CALL(mockFilePathCaching, filePath(Eq(FilePathId{1}))) .WillByDefault(Return(FilePath(PathString("/path/to/file")))); - ON_CALL(mockFilePathCaching, filePath(Eq(FilePathId{1, 42}))) + ON_CALL(mockFilePathCaching, filePath(Eq(FilePathId{42}))) .WillByDefault(Return(clangBackEndFilePath)); } diff --git a/tests/unit/unittest/refactoringdatabaseinitializer-test.cpp b/tests/unit/unittest/refactoringdatabaseinitializer-test.cpp index 347802f3503..ba7d62ddb98 100644 --- a/tests/unit/unittest/refactoringdatabaseinitializer-test.cpp +++ b/tests/unit/unittest/refactoringdatabaseinitializer-test.cpp @@ -68,7 +68,7 @@ TEST_F(RefactoringDatabaseInitializer, AddSourcesTable) { InSequence s; - EXPECT_CALL(mockDatabase, execute(Eq("CREATE TABLE IF NOT EXISTS sources(sourceId INTEGER PRIMARY KEY, directoryId INTEGER, sourceName TEXT, sourceType INTEGER)"))); + EXPECT_CALL(mockDatabase, execute(Eq("CREATE TABLE IF NOT EXISTS sources(sourceId INTEGER PRIMARY KEY, directoryId INTEGER, sourceName TEXT)"))); EXPECT_CALL(mockDatabase, execute(Eq("CREATE UNIQUE INDEX IF NOT EXISTS index_sources_directoryId_sourceName ON sources(directoryId, sourceName)"))); initializer.createSourcesTable(); @@ -98,7 +98,7 @@ TEST_F(RefactoringDatabaseInitializer, AddProjectPartsSourcesTable) { InSequence s; - EXPECT_CALL(mockDatabase, execute(Eq("CREATE TABLE IF NOT EXISTS projectPartsSources(projectPartId INTEGER, sourceId INTEGER)"))); + EXPECT_CALL(mockDatabase, execute(Eq("CREATE TABLE IF NOT EXISTS projectPartsSources(projectPartId INTEGER, sourceId INTEGER, sourceType INTEGER)"))); EXPECT_CALL(mockDatabase, execute(Eq("CREATE UNIQUE INDEX IF NOT EXISTS index_projectPartsSources_sourceId_projectPartId ON projectPartsSources(sourceId, projectPartId)"))); EXPECT_CALL(mockDatabase, execute(Eq("CREATE INDEX IF NOT EXISTS index_projectPartsSources_projectPartId ON projectPartsSources(projectPartId)"))); @@ -120,7 +120,7 @@ TEST_F(RefactoringDatabaseInitializer, AddFileStatusesTable) { InSequence s; - EXPECT_CALL(mockDatabase, execute(Eq("CREATE TABLE IF NOT EXISTS fileStatuses(sourceId INTEGER PRIMARY KEY, size INTEGER, lastModified INTEGER, isInPrecompiledHeader INTEGER)"))); + EXPECT_CALL(mockDatabase, execute(Eq("CREATE TABLE IF NOT EXISTS fileStatuses(sourceId INTEGER PRIMARY KEY, size INTEGER, lastModified INTEGER, buildDependencyTimeStamp INTEGER, isInPrecompiledHeader INTEGER)"))); initializer.createFileStatusesTable(); } @@ -156,19 +156,19 @@ TEST_F(RefactoringDatabaseInitializer, CreateInTheContructor) EXPECT_CALL(mockDatabase, execute(Eq("CREATE TABLE IF NOT EXISTS locations(symbolId INTEGER, line INTEGER, column INTEGER, sourceId INTEGER, locationKind INTEGER)"))); EXPECT_CALL(mockDatabase, execute(Eq("CREATE UNIQUE INDEX IF NOT EXISTS index_locations_sourceId_line_column ON locations(sourceId, line, column)"))); EXPECT_CALL(mockDatabase, execute(Eq("CREATE INDEX IF NOT EXISTS index_locations_sourceId_locationKind ON locations(sourceId, locationKind)"))); - EXPECT_CALL(mockDatabase, execute(Eq("CREATE TABLE IF NOT EXISTS sources(sourceId INTEGER PRIMARY KEY, directoryId INTEGER, sourceName TEXT, sourceType INTEGER)"))); + EXPECT_CALL(mockDatabase, execute(Eq("CREATE TABLE IF NOT EXISTS sources(sourceId INTEGER PRIMARY KEY, directoryId INTEGER, sourceName TEXT)"))); EXPECT_CALL(mockDatabase, execute(Eq("CREATE UNIQUE INDEX IF NOT EXISTS index_sources_directoryId_sourceName ON sources(directoryId, sourceName)"))); EXPECT_CALL(mockDatabase, execute(Eq("CREATE TABLE IF NOT EXISTS directories(directoryId INTEGER PRIMARY KEY, directoryPath TEXT)"))); EXPECT_CALL(mockDatabase, execute(Eq("CREATE UNIQUE INDEX IF NOT EXISTS index_directories_directoryPath ON directories(directoryPath)"))); EXPECT_CALL(mockDatabase, execute(Eq("CREATE TABLE IF NOT EXISTS projectParts(projectPartId INTEGER PRIMARY KEY, projectPartName TEXT, compilerArguments TEXT, compilerMacros TEXT, includeSearchPaths TEXT)"))); EXPECT_CALL(mockDatabase, execute(Eq("CREATE UNIQUE INDEX IF NOT EXISTS index_projectParts_projectPartName ON projectParts(projectPartName)"))); - EXPECT_CALL(mockDatabase, execute(Eq("CREATE TABLE IF NOT EXISTS projectPartsSources(projectPartId INTEGER, sourceId INTEGER)"))); + EXPECT_CALL(mockDatabase, execute(Eq("CREATE TABLE IF NOT EXISTS projectPartsSources(projectPartId INTEGER, sourceId INTEGER, sourceType INTEGER)"))); EXPECT_CALL(mockDatabase, execute(Eq("CREATE UNIQUE INDEX IF NOT EXISTS index_projectPartsSources_sourceId_projectPartId ON projectPartsSources(sourceId, projectPartId)"))); EXPECT_CALL(mockDatabase, execute(Eq("CREATE INDEX IF NOT EXISTS index_projectPartsSources_projectPartId ON projectPartsSources(projectPartId)"))); EXPECT_CALL(mockDatabase, execute(Eq("CREATE TABLE IF NOT EXISTS usedMacros(usedMacroId INTEGER PRIMARY KEY, sourceId INTEGER, macroName TEXT)"))); EXPECT_CALL(mockDatabase, execute(Eq("CREATE INDEX IF NOT EXISTS index_usedMacros_sourceId_macroName ON usedMacros(sourceId, macroName)"))); EXPECT_CALL(mockDatabase, execute(Eq("CREATE INDEX IF NOT EXISTS index_usedMacros_macroName ON usedMacros(macroName)"))); - EXPECT_CALL(mockDatabase, execute(Eq("CREATE TABLE IF NOT EXISTS fileStatuses(sourceId INTEGER PRIMARY KEY, size INTEGER, lastModified INTEGER, isInPrecompiledHeader INTEGER)"))); + EXPECT_CALL(mockDatabase, execute(Eq("CREATE TABLE IF NOT EXISTS fileStatuses(sourceId INTEGER PRIMARY KEY, size INTEGER, lastModified INTEGER, buildDependencyTimeStamp INTEGER, isInPrecompiledHeader INTEGER)"))); EXPECT_CALL(mockDatabase, execute(Eq("CREATE TABLE IF NOT EXISTS sourceDependencies(sourceId INTEGER, dependencySourceId INTEGER)"))); EXPECT_CALL(mockDatabase, execute(Eq("CREATE INDEX IF NOT EXISTS index_sourceDependencies_sourceId_dependencySourceId ON sourceDependencies(sourceId, dependencySourceId)"))); EXPECT_CALL(mockDatabase, execute(Eq("CREATE TABLE IF NOT EXISTS precompiledHeaders(projectPartId INTEGER PRIMARY KEY, pchPath TEXT, pchBuildTime INTEGER)"))); diff --git a/tests/unit/unittest/sourcerangeextractor-test.cpp b/tests/unit/unittest/sourcerangeextractor-test.cpp index 5e4da1e31b5..ae9d670bf4b 100644 --- a/tests/unit/unittest/sourcerangeextractor-test.cpp +++ b/tests/unit/unittest/sourcerangeextractor-test.cpp @@ -74,7 +74,7 @@ using SourceRangeExtractorSlowTest = SourceRangeExtractor; TEST_F(SourceRangeExtractorSlowTest, ExtractSourceRangeContainer) { - SourceRangeWithTextContainer sourceRangeContainer{{1, 1}, 1, 1, 0, 1, 10, 9, Utils::SmallString("int value;")}; + SourceRangeWithTextContainer sourceRangeContainer{1, 1, 1, 0, 1, 10, 9, Utils::SmallString("int value;")}; extractor.addSourceRange(sourceRange); diff --git a/tests/unit/unittest/sourcerangefilter-test.cpp b/tests/unit/unittest/sourcerangefilter-test.cpp index d59bd033e19..4b84f4b5f87 100644 --- a/tests/unit/unittest/sourcerangefilter-test.cpp +++ b/tests/unit/unittest/sourcerangefilter-test.cpp @@ -42,19 +42,19 @@ protected: protected: - SourceRangeWithTextContainers sourceRanges1{{{1, 1}, 1, 1, 1, 2, 1, 4, "foo"}, - {{1, 1}, 1, 1, 1, 2, 2, 5, "foo"}, - {{1, 2}, 1, 1, 1, 2, 1, 4, "foo"}}; - SourceRangeWithTextContainers sourceRanges2{{{1, 3}, 1, 1, 1, 2, 1, 4, "foo"}, - {{1, 1}, 1, 1, 1, 2, 1, 4, "foo"}, - {{1, 1}, 1, 1, 1, 2, 3, 6, "foo"}}; - SourceRangeWithTextContainers sourceRanges3{{{1, 1}, 1, 1, 1, 2, 3, 6, "foo"}, - {{1, 3}, 1, 1, 1, 2, 1, 4, "foo"}}; - SourceRangeWithTextContainers sourceRanges4{{{1, 1}, 1, 1, 1, 2, 3, 6, "foo"}, - {{1, 3}, 1, 1, 1, 2, 1, 4, "foo"}, - {{1, 3}, 1, 1, 1, 2, 1, 4, "foo"}}; - SourceRangeWithTextContainers sourceRanges5{{{1, 3}, 1, 1, 1, 2, 1, 4, "foo"}, - {{1, 1}, 1, 1, 1, 2, 3, 6, "foo"}}; + SourceRangeWithTextContainers sourceRanges1{{1, 1, 1, 1, 2, 1, 4, "foo"}, + {1, 1, 1, 1, 2, 2, 5, "foo"}, + {2, 1, 1, 1, 2, 1, 4, "foo"}}; + SourceRangeWithTextContainers sourceRanges2{{3, 1, 1, 1, 2, 1, 4, "foo"}, + {1, 1, 1, 1, 2, 1, 4, "foo"}, + {1, 1, 1, 1, 2, 3, 6, "foo"}}; + SourceRangeWithTextContainers sourceRanges3{{1, 1, 1, 1, 2, 3, 6, "foo"}, + {3, 1, 1, 1, 2, 1, 4, "foo"}}; + SourceRangeWithTextContainers sourceRanges4{{1, 1, 1, 1, 2, 3, 6, "foo"}, + {3, 1, 1, 1, 2, 1, 4, "foo"}, + {3, 1, 1, 1, 2, 1, 4, "foo"}}; + SourceRangeWithTextContainers sourceRanges5{{3, 1, 1, 1, 2, 1, 4, "foo"}, + {1, 1, 1, 1, 2, 3, 6, "foo"}}; SourceRangesForQueryMessage message1{{Utils::clone(sourceRanges1)}}; SourceRangesForQueryMessage message2{{Utils::clone(sourceRanges2)}}; ClangBackEnd::SourceRangeFilter filter{3}; diff --git a/tests/unit/unittest/sourcesmanager-test.cpp b/tests/unit/unittest/sourcesmanager-test.cpp index 9c149dac6e4..290139e7cfc 100644 --- a/tests/unit/unittest/sourcesmanager-test.cpp +++ b/tests/unit/unittest/sourcesmanager-test.cpp @@ -37,103 +37,103 @@ protected: TEST_F(SourcesManager, TouchFilePathIdFirstTime) { - ASSERT_FALSE(sources.alreadyParsed({1, 1}, 56)); + ASSERT_FALSE(sources.alreadyParsed(1, 56)); } TEST_F(SourcesManager, TouchFilePathIdTwoTimesWithSameTime) { - sources.alreadyParsed({1, 1}, 56); + sources.alreadyParsed(1, 56); - ASSERT_FALSE(sources.alreadyParsed({1, 1}, 56)); + ASSERT_FALSE(sources.alreadyParsed(1, 56)); } TEST_F(SourcesManager, TouchFilePathIdSecondTimeWithSameTime) { - sources.alreadyParsed({1, 1}, 56); + sources.alreadyParsed(1, 56); sources.updateModifiedTimeStamps(); - ASSERT_TRUE(sources.alreadyParsed({1, 1}, 56)); + ASSERT_TRUE(sources.alreadyParsed(1, 56)); } TEST_F(SourcesManager, TouchFilePathIdSecondTimeWithOlderTime) { - sources.alreadyParsed({1, 1}, 56); + sources.alreadyParsed(1, 56); sources.updateModifiedTimeStamps(); - ASSERT_TRUE(sources.alreadyParsed({1, 1}, 55)); + ASSERT_TRUE(sources.alreadyParsed(1, 55)); } TEST_F(SourcesManager, TouchFilePathIdSecondTimeWithNewerTime) { - sources.alreadyParsed({1, 1}, 56); + sources.alreadyParsed(1, 56); sources.updateModifiedTimeStamps(); - ASSERT_FALSE(sources.alreadyParsed({1, 1}, 57)); + ASSERT_FALSE(sources.alreadyParsed(1, 57)); } TEST_F(SourcesManager, MultipleFileIds) { - sources.alreadyParsed({1, 1}, 455); - sources.alreadyParsed({1, 4}, 56); - sources.alreadyParsed({1, 3}, 85); - sources.alreadyParsed({1, 6}, 56); - sources.alreadyParsed({1, 2}, 45); + sources.alreadyParsed(1, 455); + sources.alreadyParsed(4, 56); + sources.alreadyParsed(3, 85); + sources.alreadyParsed(6, 56); + sources.alreadyParsed(2, 45); sources.updateModifiedTimeStamps(); - ASSERT_TRUE(sources.alreadyParsed({1, 3}, 85)); + ASSERT_TRUE(sources.alreadyParsed(3, 85)); } TEST_F(SourcesManager, UpdateModifiedTimeStampsWithNewerTimeStamp) { - sources.alreadyParsed({1, 1}, 455); - sources.alreadyParsed({1, 4}, 56); - sources.alreadyParsed({1, 3}, 85); - sources.alreadyParsed({1, 6}, 56); - sources.alreadyParsed({1, 2}, 45); + sources.alreadyParsed(1, 455); + sources.alreadyParsed(4, 56); + sources.alreadyParsed(3, 85); + sources.alreadyParsed(6, 56); + sources.alreadyParsed(2, 45); sources.updateModifiedTimeStamps(); - sources.alreadyParsed({1, 3}, 86); + sources.alreadyParsed(3, 86); sources.updateModifiedTimeStamps(); - ASSERT_TRUE(sources.alreadyParsed({1, 3}, 86)); + ASSERT_TRUE(sources.alreadyParsed(3, 86)); } TEST_F(SourcesManager, DontUpdateModifiedTimeStampsWithOlderTimeStamp) { - sources.alreadyParsed({1, 1}, 455); - sources.alreadyParsed({1, 4}, 56); - sources.alreadyParsed({1, 3}, 85); - sources.alreadyParsed({1, 6}, 56); - sources.alreadyParsed({1, 2}, 45); + sources.alreadyParsed(1, 455); + sources.alreadyParsed(4, 56); + sources.alreadyParsed(3, 85); + sources.alreadyParsed(6, 56); + sources.alreadyParsed(2, 45); sources.updateModifiedTimeStamps(); - sources.alreadyParsed({1, 3}, 84); + sources.alreadyParsed(3, 84); sources.updateModifiedTimeStamps(); - ASSERT_TRUE(sources.alreadyParsed({1, 3}, 85)); + ASSERT_TRUE(sources.alreadyParsed(3, 85)); } TEST_F(SourcesManager, ZeroTime) { - sources.alreadyParsed({1, 1}, 0); + sources.alreadyParsed(1, 0); sources.updateModifiedTimeStamps(); - ASSERT_TRUE(sources.alreadyParsed({1, 1}, 0)); + ASSERT_TRUE(sources.alreadyParsed(1, 0)); } TEST_F(SourcesManager, TimeIsUpdated) { - sources.alreadyParsed({1, 1}, 56); - sources.alreadyParsed({1, 1}, 57); + sources.alreadyParsed(1, 56); + sources.alreadyParsed(1, 57); sources.updateModifiedTimeStamps(); - ASSERT_TRUE(sources.alreadyParsed({1, 1}, 57)); + ASSERT_TRUE(sources.alreadyParsed(1, 57)); } TEST_F(SourcesManager, AnyDependFileIsNotModifiedAfterInitialization) @@ -143,22 +143,22 @@ TEST_F(SourcesManager, AnyDependFileIsNotModifiedAfterInitialization) TEST_F(SourcesManager, AnyDependFileIsModified) { - sources.alreadyParsed({1, 1}, 56); + sources.alreadyParsed(1, 56); ASSERT_TRUE(sources.dependentFilesModified()); } TEST_F(SourcesManager, AnyDependFileIsModifiedAfterParsingTwoTimesSameTimeStamp) { - sources.alreadyParsed({1, 1}, 56); - sources.alreadyParsed({1, 1}, 56); + sources.alreadyParsed(1, 56); + sources.alreadyParsed(1, 56); ASSERT_TRUE(sources.dependentFilesModified()); } TEST_F(SourcesManager, AnyDependFileIsNotModifiedAfterUpdate) { - sources.alreadyParsed({1, 1}, 56); + sources.alreadyParsed(1, 56); sources.updateModifiedTimeStamps(); ASSERT_FALSE(sources.dependentFilesModified()); @@ -166,68 +166,68 @@ TEST_F(SourcesManager, AnyDependFileIsNotModifiedAfterUpdate) TEST_F(SourcesManager, AnyDependFileIsNotModifiedAfterNotAlreadyPared) { - sources.alreadyParsed({1, 1}, 56); + sources.alreadyParsed(1, 56); sources.updateModifiedTimeStamps(); - sources.alreadyParsed({1, 1}, 56); + sources.alreadyParsed(1, 56); ASSERT_FALSE(sources.dependentFilesModified()); } TEST_F(SourcesManager, AnyDependFileIsNotModifiedAfterAlreadyPared) { - sources.alreadyParsed({1, 1}, 56); + sources.alreadyParsed(1, 56); sources.updateModifiedTimeStamps(); - sources.alreadyParsed({1, 1}, 57); + sources.alreadyParsed(1, 57); ASSERT_TRUE(sources.dependentFilesModified()); } TEST_F(SourcesManager, AnyDependFileIsModifiedAfterUpdateNewTimeStamp) { - sources.alreadyParsed({1, 1}, 56); - sources.alreadyParsed({1, 2}, 56); + sources.alreadyParsed(1, 56); + sources.alreadyParsed(2, 56); sources.updateModifiedTimeStamps(); - sources.alreadyParsed({1, 1}, 57); + sources.alreadyParsed(1, 57); - sources.alreadyParsed({1, 2}, 56); + sources.alreadyParsed(2, 56); ASSERT_TRUE(sources.dependentFilesModified()); } TEST_F(SourcesManager, AlreadyParsedWithDependencyAfterUpdateNewTimeStamp) { - sources.alreadyParsedAllDependentFiles({1, 1}, 56); - sources.alreadyParsedAllDependentFiles({1, 2}, 56); + sources.alreadyParsedAllDependentFiles(1, 56); + sources.alreadyParsedAllDependentFiles(2, 56); sources.updateModifiedTimeStamps(); - sources.alreadyParsedAllDependentFiles({1, 1}, 57); + sources.alreadyParsedAllDependentFiles(1, 57); - bool alreadyParsed = sources.alreadyParsedAllDependentFiles({1, 2}, 56); + bool alreadyParsed = sources.alreadyParsedAllDependentFiles(2, 56); ASSERT_FALSE(alreadyParsed); } TEST_F(SourcesManager, AlreadyParsedWithDependencyAfterUpdateNewSecondTimeStamp) { - sources.alreadyParsedAllDependentFiles({1, 1}, 56); - sources.alreadyParsedAllDependentFiles({1, 2}, 56); + sources.alreadyParsedAllDependentFiles(1, 56); + sources.alreadyParsedAllDependentFiles(2, 56); sources.updateModifiedTimeStamps(); - sources.alreadyParsedAllDependentFiles({1, 1}, 56); + sources.alreadyParsedAllDependentFiles(1, 56); - bool alreadyParsed = sources.alreadyParsedAllDependentFiles({1, 2}, 57); + bool alreadyParsed = sources.alreadyParsedAllDependentFiles(2, 57); ASSERT_FALSE(alreadyParsed); } TEST_F(SourcesManager, AlreadyParsedWithDependencyAfterUpdateSameTimeStamps) { - sources.alreadyParsedAllDependentFiles({1, 1}, 56); - sources.alreadyParsedAllDependentFiles({1, 2}, 56); + sources.alreadyParsedAllDependentFiles(1, 56); + sources.alreadyParsedAllDependentFiles(2, 56); sources.updateModifiedTimeStamps(); - sources.alreadyParsedAllDependentFiles({1, 1}, 56); + sources.alreadyParsedAllDependentFiles(1, 56); - bool alreadyParsed = sources.alreadyParsedAllDependentFiles({1, 2}, 56); + bool alreadyParsed = sources.alreadyParsedAllDependentFiles(2, 56); ASSERT_TRUE(alreadyParsed); } diff --git a/tests/unit/unittest/symbolindexer-test.cpp b/tests/unit/unittest/symbolindexer-test.cpp index 28d30713a7f..c33bceb3994 100644 --- a/tests/unit/unittest/symbolindexer-test.cpp +++ b/tests/unit/unittest/symbolindexer-test.cpp @@ -29,7 +29,7 @@ #include "mocksymbolstorage.h" #include "mockfilepathcaching.h" #include "mocksqlitetransactionbackend.h" -#include "mockusedmacroandsourcestorage.h" +#include "mockbuilddependenciesstorage.h" #include #include @@ -71,11 +71,11 @@ using ClangBackEnd::SourceLocationKind; using ClangBackEnd::UsedMacros; using OptionalProjectPartArtefact = Utils::optional; -MATCHER_P2(IsFileId, directoryId, fileNameId, +MATCHER_P(IsFileId, fileNameId, std::string(negation ? "isn't " : "is ") - + PrintToString(ClangBackEnd::FilePathId(directoryId, fileNameId))) + + PrintToString(ClangBackEnd::FilePathId(fileNameId))) { - return arg == ClangBackEnd::FilePathId(directoryId, fileNameId); + return arg == ClangBackEnd::FilePathId(fileNameId); } struct Data @@ -112,7 +112,7 @@ protected: ON_CALL(mockCollector, fileStatuses()).WillByDefault(ReturnRef(fileStatus)); ON_CALL(mockCollector, sourceDependencies()).WillByDefault(ReturnRef(sourceDependencies)); ON_CALL(mockSymbolStorage, fetchProjectPartArtefact(A())).WillByDefault(Return(artefact)); - ON_CALL(mockUsedMacroAndSourceStorage, fetchLowestLastModifiedTime(A())).WillByDefault(Return(-1)); + ON_CALL(mockBuildDependenciesStorage, fetchLowestLastModifiedTime(A())).WillByDefault(Return(-1)); mockCollector.setIsUsed(false); @@ -163,7 +163,7 @@ protected: ClangBackEnd::FilePathId header2PathId{filePathId(TESTDATA_DIR "/symbolindexer_header1.h")}; ClangBackEnd::FilePathId header1PathId{filePathId(TESTDATA_DIR "/symbolindexer_header2.h")}; PathString generatedFileName = "includecollector_generated_file.h"; - ClangBackEnd::FilePathId generatedFilePathId{1, 21}; + ClangBackEnd::FilePathId generatedFilePathId21; ProjectPartContainer projectPart1{"project1", {"-I", TESTDATA_DIR, "-Wno-pragma-once-outside-header"}, {{"BAR", "1"}, {"FOO", "1"}}, @@ -186,18 +186,18 @@ protected: "void f();", {}}}; SymbolEntries symbolEntries{{1, {"function", "function", SymbolKind::Function}}}; - SourceLocationEntries sourceLocations{{1, {1, 1}, {42, 23}, SourceLocationKind::Declaration}}; - FilePathIds sourceFileIds{{1, 1}, {42, 23}}; - UsedMacros usedMacros{{"Foo", {1, 1}}}; - FileStatuses fileStatus{{{1, 2}, 3, 4, false}}; - SourceDependencies sourceDependencies{{{1, 1}, {1, 2}}, {{1, 1}, {1, 3}}}; + SourceLocationEntries sourceLocations{{1, 1, {42, 23}, SourceLocationKind::Declaration}}; + FilePathIds sourceFileIds{1, 23}; + UsedMacros usedMacros{{"Foo", 1}}; + FileStatuses fileStatus{{2, 3, 4, false}}; + SourceDependencies sourceDependencies{{1, 2}, {1, 3}}; ClangBackEnd::ProjectPartArtefact artefact{"[\"-DFOO\"]", "{\"FOO\":\"1\",\"BAR\":\"1\"}", "[\"/includes\"]", 74}; ClangBackEnd::ProjectPartArtefact emptyArtefact{"", "", "", 74}; Utils::optional nullArtefact; ClangBackEnd::ProjectPartPch projectPartPch{"/path/to/pch", 4}; NiceMock mockSqliteTransactionBackend; NiceMock mockSymbolStorage; - NiceMock mockUsedMacroAndSourceStorage; + NiceMock mockBuildDependenciesStorage; NiceMock mockPathWatcher; ClangBackEnd::FileStatusCache fileStatusCache{filePathCache}; ClangBackEnd::GeneratedFiles generatedFiles; @@ -208,7 +208,7 @@ protected: SymbolIndexerTaskQueue indexerQueue{indexerScheduler, progressCounter}; ClangBackEnd::SymbolIndexer indexer{indexerQueue, mockSymbolStorage, - mockUsedMacroAndSourceStorage, + mockBuildDependenciesStorage, mockPathWatcher, filePathCache, fileStatusCache, @@ -340,14 +340,14 @@ TEST_F(SymbolIndexer, UpdateProjectPartsCallsUpdateProjectPartSourcesWithoutArti ON_CALL(mockSymbolStorage, fetchProjectPartArtefact(TypedEq("project2"))).WillByDefault(Return(nullArtefact)); ON_CALL(mockSymbolStorage, insertOrUpdateProjectPart(Eq("project2"), _, _, _)).WillByDefault(Return(3)); - EXPECT_CALL(mockSymbolStorage, updateProjectPartSources(3, ElementsAre(IsFileId(1, 1), IsFileId(42, 23)))); + EXPECT_CALL(mockSymbolStorage, updateProjectPartSources(3, ElementsAre(IsFileId(1), IsFileId(23)))); indexer.updateProjectParts({projectPart2}); } TEST_F(SymbolIndexer, UpdateProjectPartsCallsInsertOrUpdateUsedMacros) { - EXPECT_CALL(mockUsedMacroAndSourceStorage, insertOrUpdateUsedMacros(Eq(usedMacros))) + EXPECT_CALL(mockBuildDependenciesStorage, insertOrUpdateUsedMacros(Eq(usedMacros))) .Times(2); indexer.updateProjectParts({projectPart1, projectPart2}); @@ -355,7 +355,7 @@ TEST_F(SymbolIndexer, UpdateProjectPartsCallsInsertOrUpdateUsedMacros) TEST_F(SymbolIndexer, UpdateProjectPartsCallsInsertFileStatuses) { - EXPECT_CALL(mockUsedMacroAndSourceStorage, insertFileStatuses(Eq(fileStatus))) + EXPECT_CALL(mockBuildDependenciesStorage, insertFileStatuses(Eq(fileStatus))) .Times(2); indexer.updateProjectParts({projectPart1, projectPart2}); @@ -363,7 +363,7 @@ TEST_F(SymbolIndexer, UpdateProjectPartsCallsInsertFileStatuses) TEST_F(SymbolIndexer, UpdateProjectPartsCallsInsertOrUpdateSourceDependencies) { - EXPECT_CALL(mockUsedMacroAndSourceStorage, insertOrUpdateSourceDependencies(Eq(sourceDependencies))) + EXPECT_CALL(mockBuildDependenciesStorage, insertOrUpdateSourceDependencies(Eq(sourceDependencies))) .Times(2); indexer.updateProjectParts({projectPart1, projectPart2}); @@ -385,16 +385,16 @@ TEST_F(SymbolIndexer, UpdateProjectPartsCallsInOrderWithoutProjectPartArtifact) EXPECT_CALL(mockSymbolStorage, fetchProjectPartArtefact(TypedEq(projectPart1.projectPartId))).WillOnce(Return(nullArtefact)); EXPECT_CALL(mockSymbolStorage, insertOrUpdateProjectPart(Eq(projectPart1.projectPartId), Eq(projectPart1.arguments), Eq(projectPart1.compilerMacros), Eq(projectPart1.includeSearchPaths))).WillOnce(Return(12)); EXPECT_CALL(mockSymbolStorage, fetchPrecompiledHeader(Eq(12))); - EXPECT_CALL(mockUsedMacroAndSourceStorage, fetchLowestLastModifiedTime(Eq(main1PathId))).Times(0); + EXPECT_CALL(mockBuildDependenciesStorage, fetchLowestLastModifiedTime(Eq(main1PathId))).Times(0); EXPECT_CALL(mockSqliteTransactionBackend, commit()); EXPECT_CALL(mockCollector, setFile(main1PathId, projectPart1.arguments)); EXPECT_CALL(mockCollector, collectSymbols()); EXPECT_CALL(mockSqliteTransactionBackend, immediateBegin()); EXPECT_CALL(mockSymbolStorage, addSymbolsAndSourceLocations(symbolEntries, sourceLocations)); EXPECT_CALL(mockSymbolStorage, updateProjectPartSources(TypedEq(12), Eq(sourceFileIds))); - EXPECT_CALL(mockUsedMacroAndSourceStorage, insertOrUpdateUsedMacros(Eq(usedMacros))); - EXPECT_CALL(mockUsedMacroAndSourceStorage, insertFileStatuses(Eq(fileStatus))); - EXPECT_CALL(mockUsedMacroAndSourceStorage, insertOrUpdateSourceDependencies(Eq(sourceDependencies))); + EXPECT_CALL(mockBuildDependenciesStorage, insertOrUpdateUsedMacros(Eq(usedMacros))); + EXPECT_CALL(mockBuildDependenciesStorage, insertFileStatuses(Eq(fileStatus))); + EXPECT_CALL(mockBuildDependenciesStorage, insertOrUpdateSourceDependencies(Eq(sourceDependencies))); EXPECT_CALL(mockSqliteTransactionBackend, commit()); indexer.updateProjectParts({projectPart1}); @@ -408,16 +408,16 @@ TEST_F(SymbolIndexer, UpdateProjectPartsCallsInOrderWithProjectPartArtifact) EXPECT_CALL(mockSymbolStorage, fetchProjectPartArtefact(TypedEq(projectPart1.projectPartId))).WillRepeatedly(Return(artefact)); EXPECT_CALL(mockSymbolStorage, insertOrUpdateProjectPart(Eq(projectPart1.projectPartId), Eq(projectPart1.arguments), Eq(projectPart1.compilerMacros), Eq(projectPart1.includeSearchPaths))).WillOnce(Return(-1)); EXPECT_CALL(mockSymbolStorage, fetchPrecompiledHeader(Eq(artefact.projectPartId))); - EXPECT_CALL(mockUsedMacroAndSourceStorage, fetchLowestLastModifiedTime(Eq(main1PathId))).WillOnce(Return(-1)); + EXPECT_CALL(mockBuildDependenciesStorage, fetchLowestLastModifiedTime(Eq(main1PathId))).WillOnce(Return(-1)); EXPECT_CALL(mockSqliteTransactionBackend, commit()); EXPECT_CALL(mockCollector, setFile(Eq(main1PathId), Eq(projectPart1.arguments))); EXPECT_CALL(mockCollector, collectSymbols()); EXPECT_CALL(mockSqliteTransactionBackend, immediateBegin()); EXPECT_CALL(mockSymbolStorage, addSymbolsAndSourceLocations(symbolEntries, sourceLocations)); EXPECT_CALL(mockSymbolStorage, updateProjectPartSources(TypedEq(artefact.projectPartId), Eq(sourceFileIds))); - EXPECT_CALL(mockUsedMacroAndSourceStorage, insertOrUpdateUsedMacros(Eq(usedMacros))); - EXPECT_CALL(mockUsedMacroAndSourceStorage, insertFileStatuses(Eq(fileStatus))); - EXPECT_CALL(mockUsedMacroAndSourceStorage, insertOrUpdateSourceDependencies(Eq(sourceDependencies))); + EXPECT_CALL(mockBuildDependenciesStorage, insertOrUpdateUsedMacros(Eq(usedMacros))); + EXPECT_CALL(mockBuildDependenciesStorage, insertFileStatuses(Eq(fileStatus))); + EXPECT_CALL(mockBuildDependenciesStorage, insertOrUpdateSourceDependencies(Eq(sourceDependencies))); EXPECT_CALL(mockSqliteTransactionBackend, commit()); indexer.updateProjectParts({projectPart1}); @@ -427,7 +427,7 @@ TEST_F(SymbolIndexer, CallSetNotifier) { EXPECT_CALL(mockPathWatcher, setNotifier(_)); - ClangBackEnd::SymbolIndexer indexer{indexerQueue, mockSymbolStorage, mockUsedMacroAndSourceStorage, mockPathWatcher, filePathCache, fileStatusCache, mockSqliteTransactionBackend}; + ClangBackEnd::SymbolIndexer indexer{indexerQueue, mockSymbolStorage, mockBuildDependenciesStorage, mockPathWatcher, filePathCache, fileStatusCache, mockSqliteTransactionBackend}; } TEST_F(SymbolIndexer, PathChangedCallsFetchProjectPartArtefactInStorage) @@ -451,9 +451,9 @@ TEST_F(SymbolIndexer, UpdateChangedPathCallsInOrder) EXPECT_CALL(mockSqliteTransactionBackend, immediateBegin()); EXPECT_CALL(mockSymbolStorage, addSymbolsAndSourceLocations(symbolEntries, sourceLocations)); EXPECT_CALL(mockSymbolStorage, updateProjectPartSources(artefact.projectPartId, Eq(sourceFileIds))); - EXPECT_CALL(mockUsedMacroAndSourceStorage, insertOrUpdateUsedMacros(Eq(usedMacros))); - EXPECT_CALL(mockUsedMacroAndSourceStorage, insertFileStatuses(Eq(fileStatus))); - EXPECT_CALL(mockUsedMacroAndSourceStorage, insertOrUpdateSourceDependencies(Eq(sourceDependencies))); + EXPECT_CALL(mockBuildDependenciesStorage, insertOrUpdateUsedMacros(Eq(usedMacros))); + EXPECT_CALL(mockBuildDependenciesStorage, insertFileStatuses(Eq(fileStatus))); + EXPECT_CALL(mockBuildDependenciesStorage, insertOrUpdateSourceDependencies(Eq(sourceDependencies))); EXPECT_CALL(mockSqliteTransactionBackend, commit()); indexer.pathsChanged({sourceFileIds[0]}); @@ -472,9 +472,9 @@ TEST_F(SymbolIndexer, HandleEmptyOptionalArtifactInUpdateChangedPath) EXPECT_CALL(mockSqliteTransactionBackend, immediateBegin()).Times(0); EXPECT_CALL(mockSymbolStorage, addSymbolsAndSourceLocations(_, _)).Times(0); EXPECT_CALL(mockSymbolStorage, updateProjectPartSources(An(), _)).Times(0); - EXPECT_CALL(mockUsedMacroAndSourceStorage, insertOrUpdateUsedMacros(_)).Times(0); - EXPECT_CALL(mockUsedMacroAndSourceStorage, insertFileStatuses(_)).Times(0); - EXPECT_CALL(mockUsedMacroAndSourceStorage, insertOrUpdateSourceDependencies(_)).Times(0); + EXPECT_CALL(mockBuildDependenciesStorage, insertOrUpdateUsedMacros(_)).Times(0); + EXPECT_CALL(mockBuildDependenciesStorage, insertFileStatuses(_)).Times(0); + EXPECT_CALL(mockBuildDependenciesStorage, insertOrUpdateSourceDependencies(_)).Times(0); EXPECT_CALL(mockSqliteTransactionBackend, commit()).Times(0); indexer.pathsChanged({sourceFileIds[0]}); @@ -550,21 +550,21 @@ TEST_F(SymbolIndexer, IncludeSearchPathsAreDifferent) TEST_F(SymbolIndexer, DontReparseInUpdateProjectPartsIfDefinesAreTheSame) { InSequence s; - ON_CALL(mockUsedMacroAndSourceStorage, fetchLowestLastModifiedTime(A())).WillByDefault(Return(QDateTime::currentSecsSinceEpoch())); + ON_CALL(mockBuildDependenciesStorage, fetchLowestLastModifiedTime(A())).WillByDefault(Return(QDateTime::currentSecsSinceEpoch())); EXPECT_CALL(mockSqliteTransactionBackend, immediateBegin()); EXPECT_CALL(mockSymbolStorage, fetchProjectPartArtefact(TypedEq(projectPart1.projectPartId))).WillRepeatedly(Return(artefact)); EXPECT_CALL(mockSymbolStorage, insertOrUpdateProjectPart(Eq(projectPart1.projectPartId), Eq(projectPart1.arguments), Eq(projectPart1.compilerMacros), Eq(projectPart1.includeSearchPaths))); - EXPECT_CALL(mockUsedMacroAndSourceStorage, fetchLowestLastModifiedTime(A())).WillRepeatedly(Return(QDateTime::currentSecsSinceEpoch())); + EXPECT_CALL(mockBuildDependenciesStorage, fetchLowestLastModifiedTime(A())).WillRepeatedly(Return(QDateTime::currentSecsSinceEpoch())); EXPECT_CALL(mockSqliteTransactionBackend, commit()); EXPECT_CALL(mockCollector, setFile(_, _)).Times(0); EXPECT_CALL(mockCollector, collectSymbols()).Times(0); EXPECT_CALL(mockSqliteTransactionBackend, immediateBegin()).Times(0); EXPECT_CALL(mockSymbolStorage, addSymbolsAndSourceLocations(_, _)).Times(0); EXPECT_CALL(mockSymbolStorage, updateProjectPartSources(An(), _)).Times(0); - EXPECT_CALL(mockUsedMacroAndSourceStorage, insertOrUpdateUsedMacros(_)).Times(0); - EXPECT_CALL(mockUsedMacroAndSourceStorage, insertFileStatuses(_)).Times(0); - EXPECT_CALL(mockUsedMacroAndSourceStorage, insertOrUpdateSourceDependencies(_)).Times(0); + EXPECT_CALL(mockBuildDependenciesStorage, insertOrUpdateUsedMacros(_)).Times(0); + EXPECT_CALL(mockBuildDependenciesStorage, insertFileStatuses(_)).Times(0); + EXPECT_CALL(mockBuildDependenciesStorage, insertOrUpdateSourceDependencies(_)).Times(0); EXPECT_CALL(mockSqliteTransactionBackend, commit()).Times(0); indexer.updateProjectPart(std::move(projectPart1)); @@ -602,7 +602,7 @@ TEST_F(SymbolIndexer, GetUpdatableFilePathIdsIfIncludeSearchPathsAreDifferent) TEST_F(SymbolIndexer, GetNoUpdatableFilePathIdsIfArtefactsAreTheSame) { ON_CALL(mockSymbolStorage, fetchProjectPartArtefact(An())).WillByDefault(Return(artefact)); - ON_CALL(mockUsedMacroAndSourceStorage, fetchLowestLastModifiedTime(A())).WillByDefault(Return(QDateTime::currentSecsSinceEpoch())); + ON_CALL(mockBuildDependenciesStorage, fetchLowestLastModifiedTime(A())).WillByDefault(Return(QDateTime::currentSecsSinceEpoch())); auto filePathIds = indexer.updatableFilePathIds(projectPart1, artefact); @@ -613,7 +613,7 @@ TEST_F(SymbolIndexer, OutdatedFilesPassUpdatableFilePathIds) { indexer.pathsChanged({main1PathId}); ON_CALL(mockSymbolStorage, fetchProjectPartArtefact(An())).WillByDefault(Return(artefact)); - ON_CALL(mockUsedMacroAndSourceStorage, fetchLowestLastModifiedTime(A())) + ON_CALL(mockBuildDependenciesStorage, fetchLowestLastModifiedTime(A())) .WillByDefault(Return(0)); auto filePathIds = indexer.updatableFilePathIds(projectPart1, artefact); @@ -625,7 +625,7 @@ TEST_F(SymbolIndexer, UpToDateFilesDontPassFilteredUpdatableFilePathIds) { indexer.pathsChanged({main1PathId}); ON_CALL(mockSymbolStorage, fetchProjectPartArtefact(An())).WillByDefault(Return(artefact)); - ON_CALL(mockUsedMacroAndSourceStorage, fetchLowestLastModifiedTime(A())) + ON_CALL(mockBuildDependenciesStorage, fetchLowestLastModifiedTime(A())) .WillByDefault(Return(QDateTime::currentSecsSinceEpoch())); auto filePathIds = indexer.updatableFilePathIds(projectPart1, artefact); @@ -638,7 +638,7 @@ TEST_F(SymbolIndexer, OutdatedFilesAreParsedInUpdateProjectParts) indexer.pathsChanged({main1PathId}); indexerScheduler.syncTasks(); ON_CALL(mockSymbolStorage, fetchProjectPartArtefact(An())).WillByDefault(Return(artefact)); - ON_CALL(mockUsedMacroAndSourceStorage, fetchLowestLastModifiedTime(A())) + ON_CALL(mockBuildDependenciesStorage, fetchLowestLastModifiedTime(A())) .WillByDefault(Return(0)); EXPECT_CALL(mockCollector, setFile(Eq(main1PathId), _)); @@ -651,7 +651,7 @@ TEST_F(SymbolIndexer, UpToDateFilesAreNotParsedInUpdateProjectParts) indexer.pathsChanged({main1PathId}); indexerScheduler.syncTasks(); ON_CALL(mockSymbolStorage, fetchProjectPartArtefact(An())).WillByDefault(Return(artefact)); - ON_CALL(mockUsedMacroAndSourceStorage, fetchLowestLastModifiedTime(A())) + ON_CALL(mockBuildDependenciesStorage, fetchLowestLastModifiedTime(A())) .WillByDefault(Return(QDateTime::currentSecsSinceEpoch())); EXPECT_CALL(mockCollector, setFile(_, _)).Times(0); diff --git a/tests/unit/unittest/symbolindexertaskqueue-test.cpp b/tests/unit/unittest/symbolindexertaskqueue-test.cpp index 431aedc911b..a46f99972cf 100644 --- a/tests/unit/unittest/symbolindexertaskqueue-test.cpp +++ b/tests/unit/unittest/symbolindexertaskqueue-test.cpp @@ -58,19 +58,19 @@ protected: TEST_F(SymbolIndexerTaskQueue, AddTasks) { - queue.addOrUpdateTasks({{{1, 2}, 1, Callable{}}, - {{1, 4}, 1, Callable{}}}); + queue.addOrUpdateTasks({{2, 1, Callable{}}, + {4, 1, Callable{}}}); - queue.addOrUpdateTasks({{{1, 1}, 1, Callable{}}, - {{1, 3}, 1, Callable{}}, - {{1, 5}, 1, Callable{}}}); + queue.addOrUpdateTasks({{1, 1, Callable{}}, + {3, 1, Callable{}}, + {5, 1, Callable{}}}); ASSERT_THAT(queue.tasks(), - ElementsAre(IsTask(FilePathId{1, 1}, 1), - IsTask(FilePathId{1, 2}, 1), - IsTask(FilePathId{1, 3}, 1), - IsTask(FilePathId{1, 4}, 1), - IsTask(FilePathId{1, 5}, 1))); + ElementsAre(IsTask(1, 1), + IsTask(2, 1), + IsTask(3, 1), + IsTask(4, 1), + IsTask(5, 1))); } TEST_F(SymbolIndexerTaskQueue, AddTasksCallsProgressCounter) @@ -89,57 +89,57 @@ TEST_F(SymbolIndexerTaskQueue, AddTasksCallsProgressCounter) TEST_F(SymbolIndexerTaskQueue, ReplaceTask) { - queue.addOrUpdateTasks({{{1, 1}, 1, Callable{}}, - {{1, 3}, 1, Callable{}}, - {{1, 5}, 1, Callable{}}}); + queue.addOrUpdateTasks({{1, 1, Callable{}}, + {3, 1, Callable{}}, + {5, 1, Callable{}}}); - queue.addOrUpdateTasks({{{1, 2}, 1, Callable{}}, - {{1, 3}, 1, Callable{}}}); + queue.addOrUpdateTasks({{2, 1, Callable{}}, + {3, 1, Callable{}}}); ASSERT_THAT(queue.tasks(), - ElementsAre(IsTask(FilePathId{1, 1}, 1), - IsTask(FilePathId{1, 2}, 1), - IsTask(FilePathId{1, 3}, 1), - IsTask(FilePathId{1, 5}, 1))); + ElementsAre(IsTask(1, 1), + IsTask(2, 1), + IsTask(3, 1), + IsTask(5, 1))); } TEST_F(SymbolIndexerTaskQueue, AddTaskWithDifferentProjectId) { - queue.addOrUpdateTasks({{{1, 1}, 1, Callable{}}, - {{1, 3}, 1, Callable{}}, - {{1, 5}, 1, Callable{}}}); + queue.addOrUpdateTasks({{1, 1, Callable{}}, + {3, 1, Callable{}}, + {5, 1, Callable{}}}); - queue.addOrUpdateTasks({{{1, 2}, 2, Callable{}}, - {{1, 3}, 2, Callable{}}}); + queue.addOrUpdateTasks({{2, 2, Callable{}}, + {3, 2, Callable{}}}); ASSERT_THAT(queue.tasks(), - ElementsAre(IsTask(FilePathId{1, 1}, 1), - IsTask(FilePathId{1, 2}, 2), - IsTask(FilePathId{1, 3}, 1), - IsTask(FilePathId{1, 3}, 2), - IsTask(FilePathId{1, 5}, 1))); + ElementsAre(IsTask(1, 1), + IsTask(2, 2), + IsTask(3, 1), + IsTask(3, 2), + IsTask(5, 1))); } TEST_F(SymbolIndexerTaskQueue, RemoveTaskByProjectParts) { - queue.addOrUpdateTasks({{{1, 1}, 1, Callable{}}, - {{1, 3}, 1, Callable{}}, - {{1, 5}, 1, Callable{}}}); - queue.addOrUpdateTasks({{{1, 2}, 2, Callable{}}, - {{1, 3}, 2, Callable{}}}); - queue.addOrUpdateTasks({{{1, 2}, 3, Callable{}}, - {{1, 3}, 3, Callable{}}}); - queue.addOrUpdateTasks({{{1, 2}, 4, Callable{}}, - {{1, 3}, 4, Callable{}}}); + queue.addOrUpdateTasks({{1, 1, Callable{}}, + {3, 1, Callable{}}, + {5, 1, Callable{}}}); + queue.addOrUpdateTasks({{2, 2, Callable{}}, + {3, 2, Callable{}}}); + queue.addOrUpdateTasks({{2, 3, Callable{}}, + {3, 3, Callable{}}}); + queue.addOrUpdateTasks({{2, 4, Callable{}}, + {3, 4, Callable{}}}); queue.removeTasks({2, 3}); ASSERT_THAT(queue.tasks(), - ElementsAre(IsTask(FilePathId{1, 1}, 1), - IsTask(FilePathId{1, 2}, 4), - IsTask(FilePathId{1, 3}, 1), - IsTask(FilePathId{1, 3}, 4), - IsTask(FilePathId{1, 5}, 1))); + ElementsAre(IsTask(1, 1), + IsTask(2, 4), + IsTask(3, 1), + IsTask(3, 4), + IsTask(5, 1))); } TEST_F(SymbolIndexerTaskQueue, RemoveTasksCallsProgressCounter) @@ -163,9 +163,9 @@ TEST_F(SymbolIndexerTaskQueue, RemoveTasksCallsProgressCounter) TEST_F(SymbolIndexerTaskQueue, ProcessTasksCallsFreeSlotsAndAddTasksInScheduler) { InSequence s; - queue.addOrUpdateTasks({{{1, 1}, 1, Callable{}}, - {{1, 3}, 1, Callable{}}, - {{1, 5}, 1, Callable{}}}); + queue.addOrUpdateTasks({{1, 1, Callable{}}, + {3, 1, Callable{}}, + {5, 1, Callable{}}}); EXPECT_CALL(mockTaskScheduler, freeSlots()).WillRepeatedly(Return(2)); EXPECT_CALL(mockTaskScheduler, addTasks(SizeIs(2))); @@ -186,9 +186,9 @@ TEST_F(SymbolIndexerTaskQueue, ProcessTasksCallsFreeSlotsAndAddTasksWithNoTaskIn TEST_F(SymbolIndexerTaskQueue, ProcessTasksCallsFreeSlotsAndMoveAllTasksInSchedulerIfMoreSlotsAreFree) { InSequence s; - queue.addOrUpdateTasks({{{1, 1}, 1, Callable{}}, - {{1, 3}, 1, Callable{}}, - {{1, 5}, 1, Callable{}}}); + queue.addOrUpdateTasks({{1, 1, Callable{}}, + {3, 1, Callable{}}, + {5, 1, Callable{}}}); EXPECT_CALL(mockTaskScheduler, freeSlots()).WillRepeatedly(Return(4)); EXPECT_CALL(mockTaskScheduler, addTasks(SizeIs(3))); @@ -198,9 +198,9 @@ TEST_F(SymbolIndexerTaskQueue, ProcessTasksCallsFreeSlotsAndMoveAllTasksInSchedu TEST_F(SymbolIndexerTaskQueue, ProcessTasksRemovesProcessedTasks) { - queue.addOrUpdateTasks({{{1, 1}, 1, Callable{}}, - {{1, 3}, 1, Callable{}}, - {{1, 5}, 1, Callable{}}}); + queue.addOrUpdateTasks({{1, 1, Callable{}}, + {3, 1, Callable{}}, + {5, 1, Callable{}}}); ON_CALL(mockTaskScheduler, freeSlots()).WillByDefault(Return(2)); queue.processEntries(); diff --git a/tests/unit/unittest/symbolquery-test.cpp b/tests/unit/unittest/symbolquery-test.cpp index 53eb9d1c686..a2aeb41d086 100644 --- a/tests/unit/unittest/symbolquery-test.cpp +++ b/tests/unit/unittest/symbolquery-test.cpp @@ -61,12 +61,12 @@ protected: MockSqliteReadStatement &selectSymbolsForKindAndStartsWith2 = mockStatementFactory.selectSymbolsForKindAndStartsWith2; MockSqliteReadStatement &selectSymbolsForKindAndStartsWith3 = mockStatementFactory.selectSymbolsForKindAndStartsWith3; MockSqliteReadStatement &selectLocationOfSymbol = mockStatementFactory.selectLocationOfSymbol; - SourceLocations locations{{{1, 1}, 1, 1}, - {{1, 1}, 2, 3}, - {{1, 2}, 1, 1}, - {{1, 2}, 3, 1}, - {{1, 4}, 1, 1}, - {{1, 4}, 1, 3}}; + SourceLocations locations{{1, 1, 1}, + {1, 2, 3}, + {2, 1, 1}, + {2, 3, 1}, + {4, 1, 1}, + {4, 1, 3}}; MockQuery query{mockStatementFactory}; }; @@ -75,8 +75,8 @@ class SymbolQuerySlowTest : public testing::Test protected: void SetUp() override { - database.execute("INSERT INTO sources VALUES (1, 1, \"filename.h\", 1)"); - database.execute("INSERT INTO sources VALUES (2, 1, \"filename.cpp\", 1)"); + database.execute("INSERT INTO sources VALUES (1, 1, \"filename.h\")"); + database.execute("INSERT INTO sources VALUES (2, 1, \"filename.cpp\")"); database.execute("INSERT INTO directories VALUES (1, \"/path/to\")"); database.execute("INSERT INTO locations VALUES (1, 2, 3, 1, 1)"); database.execute("INSERT INTO locations VALUES (1, 4, 6, 2, 3)"); @@ -96,28 +96,28 @@ TEST_F(SymbolQuery, LocationsAtCallsValues) { EXPECT_CALL(selectLocationsForSymbolLocation, valuesReturnSourceLocations(_, 42, 14, 7)); - query.locationsAt({1, 42}, 14, 7); + query.locationsAt(42, 14, 7); } TEST_F(SymbolQuerySlowTest, LocationsAt) { - auto locations = query.locationsAt({1, 2}, 4, 6); + auto locations = query.locationsAt(2, 4, 6); ASSERT_THAT(locations, - UnorderedElementsAre(SourceLocation({1, 1}, 2, 3), - SourceLocation({1, 2}, 4, 6))); + UnorderedElementsAre(SourceLocation(1, 2, 3), + SourceLocation(2, 4, 6))); } TEST_F(SymbolQuery, SourceUsagesAtCallsValues) { EXPECT_CALL(selectSourceUsagesForSymbolLocation, valuesReturnSourceUsages(_, 42, 14, 7)); - query.sourceUsagesAt({1, 42}, 14, 7); + query.sourceUsagesAt(42, 14, 7); } TEST_F(SymbolQuerySlowTest, SourceUsagesAt) { - auto usages = query.sourceUsagesAt({1, 2}, 4, 6); + auto usages = query.sourceUsagesAt(2, 4, 6); ASSERT_THAT(usages, UnorderedElementsAre(CppTools::Usage("/path/to/filename.h", 2, 3), @@ -190,7 +190,7 @@ TEST_F(SymbolQuerySlowTest, LocationForSymbolId) { auto location = query.locationForSymbolId(1, SourceLocationKind::Definition); - ASSERT_THAT(location.value(), Eq(SourceLocation({1, 2}, {4, 6}))); + ASSERT_THAT(location.value(), Eq(SourceLocation(2, {4, 6}))); } } diff --git a/tests/unit/unittest/symbolstorage-test.cpp b/tests/unit/unittest/symbolstorage-test.cpp index 1b7e7383a61..9949f464f96 100644 --- a/tests/unit/unittest/symbolstorage-test.cpp +++ b/tests/unit/unittest/symbolstorage-test.cpp @@ -76,8 +76,8 @@ protected: SymbolEntries symbolEntries{{1, {"functionUSR", "function", SymbolKind::Function}}, {2, {"function2USR", "function2", SymbolKind::Function}}}; - SourceLocationEntries sourceLocations{{1, {1, 3}, {42, 23}, SourceLocationKind::Declaration}, - {2, {1, 4}, {7, 11}, SourceLocationKind::Definition}}; + SourceLocationEntries sourceLocations{{1, 3, {42, 23}, SourceLocationKind::Declaration}, + {2, 4, {7, 11}, SourceLocationKind::Definition}}; ClangBackEnd::ProjectPartArtefact artefact{"[\"-DFOO\"]", "{\"FOO\":\"1\"}", "[\"/includes\"]", 74}; }; @@ -213,7 +213,7 @@ TEST_F(SymbolStorage, UpdateProjectPartSources) EXPECT_CALL(insertProjectPartSourcesStatement, write(TypedEq(42), TypedEq(1))); EXPECT_CALL(insertProjectPartSourcesStatement, write(TypedEq(42), TypedEq(2))); - storage.updateProjectPartSources(42, {{1, 1}, {1, 2}}); + storage.updateProjectPartSources(42, {1, 2}); } TEST_F(SymbolStorage, FetchProjectPartArtefactBySourceIdCallsValueInStatement) @@ -221,7 +221,7 @@ TEST_F(SymbolStorage, FetchProjectPartArtefactBySourceIdCallsValueInStatement) EXPECT_CALL(getProjectPartArtefactsBySourceId, valueReturnProjectPartArtefact(1)) .WillRepeatedly(Return(artefact)); - storage.fetchProjectPartArtefact({2, 1}); + storage.fetchProjectPartArtefact(1); } TEST_F(SymbolStorage, FetchProjectPartArtefactBySourceIdReturnArtefact) @@ -229,7 +229,7 @@ TEST_F(SymbolStorage, FetchProjectPartArtefactBySourceIdReturnArtefact) EXPECT_CALL(getProjectPartArtefactsBySourceId, valueReturnProjectPartArtefact(1)) .WillRepeatedly(Return(artefact)); - auto result = storage.fetchProjectPartArtefact({2, 1}); + auto result = storage.fetchProjectPartArtefact(1); ASSERT_THAT(result, Eq(artefact)); } @@ -239,7 +239,7 @@ TEST_F(SymbolStorage, FetchProjectPartArtefactByProjectNameCallsValueInStatement EXPECT_CALL(getProjectPartArtefactsBySourceId, valueReturnProjectPartArtefact(1)) .WillRepeatedly(Return(artefact)); - storage.fetchProjectPartArtefact({2, 1}); + storage.fetchProjectPartArtefact(1); } TEST_F(SymbolStorage, FetchProjectPartArtefactByProjectNameReturnArtefact) @@ -247,7 +247,7 @@ TEST_F(SymbolStorage, FetchProjectPartArtefactByProjectNameReturnArtefact) EXPECT_CALL(getProjectPartArtefactsBySourceId, valueReturnProjectPartArtefact(1)) .WillRepeatedly(Return(artefact)); - auto result = storage.fetchProjectPartArtefact({2, 1}); + auto result = storage.fetchProjectPartArtefact(1); ASSERT_THAT(result, Eq(artefact)); } diff --git a/tests/unit/unittest/unittest.pro b/tests/unit/unittest/unittest.pro index 64e80654d94..2dc4389f083 100644 --- a/tests/unit/unittest/unittest.pro +++ b/tests/unit/unittest/unittest.pro @@ -104,9 +104,10 @@ SOURCES += \ taskscheduler-test.cpp \ compileroptionsbuilder-test.cpp \ progresscounter-test.cpp \ - usedmacroandsourcestorage-test.cpp \ pchtaskgenerator-test.cpp \ - compilationdatabaseutils-test.cpp + compilationdatabaseutils-test.cpp \ + builddependenciesprovider-test.cpp \ + builddependenciesstorage-test.cpp !isEmpty(LIBCLANG_LIBS) { SOURCES += \ @@ -252,8 +253,10 @@ HEADERS += \ mocktaskscheduler.h \ mockprogressmanager.h \ mockfutureinterface.h \ - mockusedmacroandsourcestorage.h \ - mockbuilddependenciesprovider.h + mockbuilddependenciesprovider.h \ + mockmodifiedtimechecker.h \ + mockbuilddependenciesgenerator.h \ + mockbuilddependenciesstorage.h !isEmpty(LIBCLANG_LIBS) { HEADERS += \