C++: Only parse with appropriate defines for open editors.

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>
This commit is contained in:
Erik Verbruggen
2013-08-19 16:05:29 +02:00
parent 447c4ed37f
commit ba2d7a4fa7
22 changed files with 570 additions and 48 deletions

View File

@@ -104,6 +104,10 @@ public:
QByteArray utf8Source() const;
void setUtf8Source(const QByteArray &utf8Source);
QByteArray fingerprint() const { return m_fingerprint; }
void setFingerprint(const QByteArray &fingerprint)
{ m_fingerprint = fingerprint; }
void startSkippingBlocks(unsigned offset);
void stopSkippingBlocks(unsigned offset);
@@ -361,6 +365,8 @@ private:
/// the macro name of the include guard, if there is one.
QByteArray _includeGuardMacroName;
QByteArray m_fingerprint;
QByteArray _source;
QDateTime _lastModified;
QAtomicInt _keepSourceAndASTCount;

View File

@@ -37,10 +37,8 @@ using namespace CPlusPlus;
QStringList DependencyTable::filesDependingOn(const QString &fileName) const
{
int index = fileIndex.value(fileName, -1);
if (index == -1) {
qWarning() << fileName << "not in the snapshot";
if (index == -1)
return QStringList();
}
QStringList deps;
for (int i = 0; i < files.size(); ++i) {