summaryrefslogtreecommitdiff
path: root/src/plugins/cpptools/cpppreprocessor.cpp
Commit message (Collapse)AuthorAgeFilesLines
* CppTools: Rename CppPreprocessor to CppSourceProcessorNikolai Kosjar2014-06-041-501/+0
| | | | | | | | | | ...since it does quite a bit more than only preprocessing, as the name suggests. We use that class to process source files in general. The output is not a preprocessed source, but a set of CPlusPlus::Documents with symbols. Change-Id: I787d0f22f9f042ddf0c99e8c2f0bdb9aa7001735 Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
* C++: Add utf16 indices to Macro and Document::MacroUseNikolai Kosjar2014-05-231-16/+26
| | | | | | | | | In most cases we need to work with the utf16 indices. Only in cppfindreferences the byte interface is still needed since there we read in files and work on a QByteArray to save memory. Change-Id: I6ef6a93fc1875a8c9a305c075d51a9ca034c41bb Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
* C++/CppTools: Pass UTF-8 encoded source to LexerNikolai Kosjar2014-05-231-13/+0
| | | | | | | | The Lexer can handle it now. Task-number: QTCREATORBUG-7356 Change-Id: I8c4b03a247656e013d44c3cedca4835e133d4036 Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
* CppTools: Resolve absolute files in working copy always successfullyNikolai Kosjar2014-03-271-1/+4
| | | | | | | | | | | | | | | ...since we can always provide the contents for such files. This fixes the soft assert SOFT ASSERT: "document()" in file src/plugins/cpptools/cppsnapshotupdater.cpp, line 199 that occurs if you Follow Symbol on an include directive of the type "ui_*.h" file that is not yet generated on disk. Change-Id: I1e40db95a648a0570c6ccbcf5475691094097e18 Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
* CppTools: CppPreprocessor: Read file only if necessaryNikolai Kosjar2014-03-101-6/+8
| | | | | Change-Id: Ia60d3e1907f9238f873f016d844095084b76ad6b Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
* CppTools: Add diagnostic message for non-existent absolute pathsNikolai Kosjar2014-03-101-2/+4
| | | | | Change-Id: I9a05a92c1adc37db0c918127715714d1f6d2a78d Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
* CppTools: Add all diagnostic messagesNikolai Kosjar2014-03-101-32/+33
| | | | | | | | | | | | ...of type 'No such file or directory' to the CPlusPlus::Document. Only the first one was added and as a result, the editor only wavely underlined that one. Add also diagnostic messages if it's not possible to get the file contents. Change-Id: I8389d8e6af9480ea6712759ce5e130e1dd8912f1 Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
* CppTools: Avoid self-includeNikolai Kosjar2014-02-241-1/+1
| | | | | | | | | ...in CPlusPlus::Document due to cyclic includes. Task-number: QTCREATORBUG-11457 Change-Id: I1ca19c901c26d9984d795a61879dd6b41c57096c Reviewed-by: Orgad Shaneh <orgads@gmail.com> Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
* CppTools: Use editor manager's codec as fallbackNikolai Kosjar2013-11-181-5/+16
| | | | | | | | | | | | | | | | | ...for reading not already opened files. This partly reverts commit f7c68f6. In case TextFileFormat::detect() fails, the user configurable editor manager's codec is used instead of QTextCodec::codecForLocale(). Adds also a qWarning() to easier detect encoding errors. Task-number: QTCREATORBUG-10378 Change-Id: I0fa4e6b898ed090d85414ce2a001f11b115a42d3 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com> Reviewed-by: Eike Ziller <eike.ziller@digia.com> Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
* CppTools: Remove unused isInjectedFile() in cpppreprocessor.cppNikolai Kosjar2013-10-291-5/+0
| | | | | | | This static function got moved into a base class. Change-Id: I0b72f324bd52421388c7566dc4fd115a9b27ea7f Reviewed-by: David Schulz <david.schulz@digia.com>
* CppTools: fix inclusion of "injected" defines.Erik Verbruggen2013-10-231-1/+0
| | | | | | | Task-number: QTCREATORBUG-10280 Change-Id: Ibc6ffeedb97a31a35a2d1f00625506f844692e16 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
* C++: add code-model support for defines-per-editor.Erik Verbruggen2013-10-011-1/+6
| | | | | | | The UI side will come in another commit. Change-Id: I1038a438587fe4cef70408f7f627d08837fc192d Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
* C++: Only parse with appropriate defines for open editors.Erik Verbruggen2013-10-011-4/+43
| | | | | | | | | | | | If two files from different (sub-)projects include the same header file, and the defined macros differ for both files, the header file will be parsed with only the appropriate macros for the including file. Task-number: QTCREATORBUG-9802 Task-number: QTCREATORBUG-1249 Change-Id: I560490afa287b3bb1e863bce1bb4f57af36ad56e Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
* C++: fix multi-byte character handling in input.Erik Verbruggen2013-09-231-0/+13
| | | | | | | | | | | Temporary fix: if a single byte is found with the highest bit set, then convert from utf8 to latin1. This can be removed when the lexer can handle multi-byte characters. Task-number: QTCREATORBUG-10141 Change-Id: I36a17aa18bd1b2378f12d0cecf4fd4957b38d8f2 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com> Reviewed-by: Orgad Shaneh <orgads@gmail.com>
* C++: change working-copy to work on UTF-8 encoded QByteArrays.Erik Verbruggen2013-09-111-13/+9
| | | | | | | | | | | | These not only take less space than UTF-16 encoded QStrings, but due to the caching in the CppEditorSupport also take less time to build. This patch also fixes a number of possible encoding issues, where files and constant strings were (falsely) assumed to be UTF-8. Change-Id: Ib6f91c9a94ebed5b5dfbd4eb2998825c62c72784 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com> Reviewed-by: hjk <hjk121@nokiamail.com>
* EditorManager: Use static pattern, adjust surrounding codehjk2013-08-301-2/+1
| | | | | Change-Id: I3255a0150cd9a730336456c5a9f986eb74fefbff Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
* CppTools: CppPreprocessor: Track also unresolved includesNikolai Kosjar2013-08-221-2/+2
| | | | | Change-Id: Ia36e7e7142dbc030a428369ed04e76e70e8eef0b Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
* CppTools: Fix "! condition" coding styleNikolai Kosjar2013-07-251-8/+8
| | | | | | Change-Id: Ic7e634e4249fb64edbc2daceb65ec8e9b5f0f8b9 Reviewed-by: Orgad Shaneh <orgads@gmail.com> Reviewed-by: Aurindam Jana <aurindam.jana@digia.com>
* C++: Clean up CppPreprocessorNikolai Kosjar2013-07-171-36/+35
| | | | | | | | | | | * const correctness * 100 columns * superfluous curly braces * include order * old qDebugs() Change-Id: Id8012d3cf4e292b671cdbc1952ff13dde316791e Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
* Merge remote-tracking branch 'origin/2.8' into HEADEike Ziller2013-07-031-1/+1
|\ | | | | | | | | | | | | | | Conflicts: qtcreator.pri qtcreator.qbs Change-Id: I5d2018d3437b99bcdffa92bf1a212f42923c4fad
| * C++: Fix resolving ui_* files in CppPreprocessorNikolai Kosjar2013-07-021-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | The working copy contains the artificial ui_* files and therefore we have to consider it while resolving include files. Task-number: QTCREATORBUG-9683 Change-Id: Icb3387b4cd885b3652bae3f1da465d3e0f633332 Reviewed-by: Christian Stenger <christian.stenger@digia.com> Reviewed-by: Eike Ziller <eike.ziller@digia.com> Reviewed-by: Daniel Teske <daniel.teske@digia.com> Reviewed-by: Robert Loehning <robert.loehning@digia.com> Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
* | C++: Add clarifying comment about local include handlingNikolai Kosjar2013-07-021-0/+2
|/ | | | | Change-Id: I96486983460bb72dc7b7fa993863b2938e99a8b4 Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
* C++: Record also unresolved paths for includesNikolai Kosjar2013-06-111-2/+2
| | | | | Change-Id: Id107b6c1f34f594c5a01502c156963c964235ed7 Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
* CppTools: cleanup CppPreprocessor header, added short docs.Sergey Shambir2013-05-311-0/+12
| | | | | | Change-Id: Ib61197da939165d24b99e40f29f9de13d109e044 Reviewed-by: Leena Miettinen <riitta-leena.miettinen@digia.com> Reviewed-by: hjk <hjk121@nokiamail.com>
* C++: Fix 'already seen files' when indexingNikolai Kosjar2013-05-231-0/+1
| | | | | | | | | | | | | | | | | | Resetting the environment (after each *.cpp file) did not clear the already seen files (m_included). Because of that the succeeding header files were not parsed correctly - the environments of the mistakenly already seen header files were not merged in. Note that this change slow downs the parsing/indexing of files to its original speed, as it was before the problematic commit (and it is in 2.7): commit 82e347095c4bdb7a6419d28798639e60591e3992 C++: Untangle include file resolving from loading. Task-number: QTCREATORBUG-9205 Change-Id: Iea57b7c59ea04a3c8843fd1291f4c375382958fc Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
* C++: moved the CppPreprocessor into its own file.Erik Verbruggen2013-04-261-0/+425
Change-Id: I399d667a1fccb376fadbd6ab8fbba243e86d8f4b Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>