Context.InitBuiltinTypes(*Target);
InitializedLanguage = true;
+
+ applyLangOptsToTarget();
return false;
}
TargetOpts.Features.clear();
TargetOpts.Triple = Triple;
Target = TargetInfo::CreateTargetInfo(PP.getDiagnostics(), TargetOpts);
+
+ applyLangOptsToTarget();
return false;
}
virtual void ReadCounter(unsigned Value) {
Counter = Value;
}
+
+private:
+ void applyLangOptsToTarget() {
+ if (Target && InitializedLanguage) {
+ // Inform the target of the language options.
+ //
+ // FIXME: We shouldn't need to do this, the target should be immutable once
+ // created. This complexity should be lifted elsewhere.
+ Target->setForcedLangOptions(LangOpt);
+ }
+ }
};
class StoredDiagnosticConsumer : public DiagnosticConsumer {
--- /dev/null
+// RUN: c-index-test -write-pch %t.pch -fshort-wchar %s
+// RUN: c-index-test -index-tu %t.pch | FileCheck %s
+
+const wchar_t *wideStr = L"123";
+
+// CHECK: [indexDeclaration]: kind: variable | name: wideStr