[llvm-branch-commits] [cfe-branch] r124413 - in /cfe/branches/Apple/sill: include/clang/Frontend/ASTUnit.h lib/Frontend/ASTUnit.cpp tools/c-index-test/c-index-test.c
Daniel Dunbar
daniel at zuster.org
Thu Jan 27 12:09:14 PST 2011
Author: ddunbar
Date: Thu Jan 27 14:09:14 2011
New Revision: 124413
URL: http://llvm.org/viewvc/llvm-project?rev=124413&view=rev
Log:
Merge r124382:
--
Author: Douglas Gregor <dgregor at apple.com>
Date: Thu Jan 27 18:02:58 2011 +0000
Teach ASTUnit to save the specified target features, since
TargetInfo::CreateTargetInfo() mangles the target options in a way
that is not idempotent. Fixes <rdar://problem/8807535>.
Modified:
cfe/branches/Apple/sill/include/clang/Frontend/ASTUnit.h
cfe/branches/Apple/sill/lib/Frontend/ASTUnit.cpp
cfe/branches/Apple/sill/tools/c-index-test/c-index-test.c
Modified: cfe/branches/Apple/sill/include/clang/Frontend/ASTUnit.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/sill/include/clang/Frontend/ASTUnit.h?rev=124413&r1=124412&r2=124413&view=diff
==============================================================================
--- cfe/branches/Apple/sill/include/clang/Frontend/ASTUnit.h (original)
+++ cfe/branches/Apple/sill/include/clang/Frontend/ASTUnit.h Thu Jan 27 14:09:14 2011
@@ -84,6 +84,13 @@
/// LoadFromCommandLine available.
llvm::OwningPtr<CompilerInvocation> Invocation;
+ /// \brief The set of target features.
+ ///
+ /// FIXME: each time we reparse, we need to restore the set of target
+ /// features from this vector, because TargetInfo::CreateTargetInfo()
+ /// mangles the target options in place. Yuck!
+ std::vector<std::string> TargetFeatures;
+
// OnlyLocalDecls - when true, walking this AST should only visit declarations
// that come from the AST itself, not from included precompiled headers.
// FIXME: This is temporary; eventually, CIndex will always do this.
Modified: cfe/branches/Apple/sill/lib/Frontend/ASTUnit.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/sill/lib/Frontend/ASTUnit.cpp?rev=124413&r1=124412&r2=124413&view=diff
==============================================================================
--- cfe/branches/Apple/sill/lib/Frontend/ASTUnit.cpp (original)
+++ cfe/branches/Apple/sill/lib/Frontend/ASTUnit.cpp Thu Jan 27 14:09:14 2011
@@ -752,6 +752,7 @@
Clang.setDiagnostics(&getDiagnostics());
// Create the target instance.
+ Clang.getTargetOpts().Features = TargetFeatures;
Clang.setTarget(TargetInfo::CreateTargetInfo(Clang.getDiagnostics(),
Clang.getTargetOpts()));
if (!Clang.hasTarget()) {
@@ -1243,6 +1244,7 @@
Clang.setDiagnostics(&getDiagnostics());
// Create the target instance.
+ Clang.getTargetOpts().Features = TargetFeatures;
Clang.setTarget(TargetInfo::CreateTargetInfo(Clang.getDiagnostics(),
Clang.getTargetOpts()));
if (!Clang.hasTarget()) {
@@ -1433,6 +1435,9 @@
Invocation->getFrontendOpts().DisableFree = false;
ProcessWarningOptions(getDiagnostics(), Invocation->getDiagnosticOpts());
+ // Save the target features.
+ TargetFeatures = Invocation->getTargetOpts().Features;
+
llvm::MemoryBuffer *OverrideMainBuffer = 0;
if (PrecompilePreamble) {
PreambleRebuildCounter = 2;
@@ -1896,6 +1901,7 @@
StoredDiagnostics);
// Create the target instance.
+ Clang.getTargetOpts().Features = TargetFeatures;
Clang.setTarget(TargetInfo::CreateTargetInfo(Clang.getDiagnostics(),
Clang.getTargetOpts()));
if (!Clang.hasTarget()) {
Modified: cfe/branches/Apple/sill/tools/c-index-test/c-index-test.c
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/sill/tools/c-index-test/c-index-test.c?rev=124413&r1=124412&r2=124413&view=diff
==============================================================================
--- cfe/branches/Apple/sill/tools/c-index-test/c-index-test.c (original)
+++ cfe/branches/Apple/sill/tools/c-index-test/c-index-test.c Thu Jan 27 14:09:14 2011
@@ -714,7 +714,7 @@
Idx = clang_createIndex(/* excludeDeclsFromPCH */
!strcmp(filter, "local") ? 1 : 0,
- /* displayDiagnosics=*/1);
+ /* displayDiagnosics=*/0);
if (parse_remapped_files(argc, argv, 0, &unsaved_files, &num_unsaved_files)) {
clang_disposeIndex(Idx);
More information about the llvm-branch-commits
mailing list