From: Francois Pichet Date: Thu, 1 Sep 2011 16:38:08 +0000 (+0000) Subject: Enable -fdelayed-template-parsing by default on Win32. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8efcc0184a6dfe1ea799d3a6b9c1312ef1fac11d;p=clang Enable -fdelayed-template-parsing by default on Win32. I had to force -fno-delayed-template-parsing on some Index tests because delayed template parsing will change the output of some tests. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138942 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp index 1486065411..4901bc2704 100644 --- a/lib/Driver/Tools.cpp +++ b/lib/Driver/Tools.cpp @@ -1782,10 +1782,11 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, options::OPT_fno_borland_extensions, false)) CmdArgs.push_back("-fborland-extensions"); - // -fno-delayed-template-parsing is default. + // -fno-delayed-template-parsing is default, except for Windows where MSVC STL + // needs it. if (Args.hasFlag(options::OPT_fdelayed_template_parsing, options::OPT_fno_delayed_template_parsing, - false)) + getToolChain().getTriple().getOS() == llvm::Triple::Win32)) CmdArgs.push_back("-fdelayed-template-parsing"); // -fgnu-keywords default varies depending on language; only pass if diff --git a/test/Index/annotate-nested-name-specifier.cpp b/test/Index/annotate-nested-name-specifier.cpp index 7c83740f08..3189f19c9d 100644 --- a/test/Index/annotate-nested-name-specifier.cpp +++ b/test/Index/annotate-nested-name-specifier.cpp @@ -137,7 +137,7 @@ struct X9 : X8 { } }; -// RUN: c-index-test -test-annotate-tokens=%s:13:1:137:1 %s | FileCheck %s +// RUN: c-index-test -test-annotate-tokens=%s:13:1:137:1 -fno-delayed-template-parsing %s | FileCheck %s // CHECK: Keyword: "using" [14:1 - 14:6] UsingDeclaration=vector[4:12] // CHECK: Identifier: "outer_alias" [14:7 - 14:18] NamespaceRef=outer_alias:10:11 diff --git a/test/Index/annotate-tokens-cxx0x.cpp b/test/Index/annotate-tokens-cxx0x.cpp index bf86f325fb..9dd5aa604a 100644 --- a/test/Index/annotate-tokens-cxx0x.cpp +++ b/test/Index/annotate-tokens-cxx0x.cpp @@ -8,7 +8,7 @@ void test() { decltype(a) b; } -// RUN: c-index-test -test-annotate-tokens=%s:1:1:5:1 -std=c++0x %s | FileCheck %s +// RUN: c-index-test -test-annotate-tokens=%s:1:1:5:1 -fno-delayed-template-parsing -std=c++0x %s | FileCheck %s // CHECK: Identifier: "args" [3:20 - 3:24] UnexposedExpr=args:2:15 // CHECK: Identifier: "Args" [3:38 - 3:42] TypeRef=Args:1:22 diff --git a/test/Index/index-templates.cpp b/test/Index/index-templates.cpp index f6040da59c..14b22fc80a 100644 --- a/test/Index/index-templates.cpp +++ b/test/Index/index-templates.cpp @@ -100,7 +100,7 @@ template class Pair; template struct SuperPair : Pair, Pair { }; -// RUN: c-index-test -test-load-source all %s | FileCheck -check-prefix=CHECK-LOAD %s +// RUN: c-index-test -test-load-source all -fno-delayed-template-parsing %s | FileCheck -check-prefix=CHECK-LOAD %s // CHECK-LOAD: index-templates.cpp:4:6: FunctionTemplate=f:4:6 Extent=[3:1 - 4:22] // CHECK-LOAD: index-templates.cpp:3:19: TemplateTypeParameter=T:3:19 (Definition) Extent=[3:10 - 3:20] // CHECK-LOAD: index-templates.cpp:3:24: NonTypeTemplateParameter=Value:3:24 (Definition) Extent=[3:22 - 3:29] @@ -180,7 +180,7 @@ struct SuperPair : Pair, Pair { }; // CHECK-LOAD: index-templates.cpp:101:36: C++ base class specifier=Pair:76:8 [access=public isVirtual=false] Extent=[101:36 - 101:46] -// RUN: c-index-test -test-load-source-usrs all %s | FileCheck -check-prefix=CHECK-USRS %s +// RUN: c-index-test -test-load-source-usrs all -fno-delayed-template-parsing %s | FileCheck -check-prefix=CHECK-USRS %s // CHECK-USRS: index-templates.cpp c:@FT@>3#T#Nt0.0#t>2#T#Nt1.0f#>t0.22S0_# Extent=[3:1 - 4:22] // CHECK-USRS: index-templates.cpp c:index-templates.cpp@70 Extent=[3:10 - 3:20] // CHECK-USRS: index-templates.cpp c:index-templates.cpp@82 Extent=[3:22 - 3:29] diff --git a/test/Index/load-stmts.cpp b/test/Index/load-stmts.cpp index cb9d3f2b60..6dd19b30d4 100644 --- a/test/Index/load-stmts.cpp +++ b/test/Index/load-stmts.cpp @@ -117,7 +117,7 @@ void casts(int *ip) { (void)reinterpret_cast(ip); } -// RUN: c-index-test -test-load-source all %s | FileCheck %s +// RUN: c-index-test -test-load-source all -fno-delayed-template-parsing %s | FileCheck %s // CHECK: load-stmts.cpp:1:13: TypedefDecl=T:1:13 (Definition) Extent=[1:1 - 1:14] // CHECK: load-stmts.cpp:2:8: StructDecl=X:2:8 (Definition) Extent=[2:1 - 2:23] // CHECK: load-stmts.cpp:2:16: FieldDecl=a:2:16 (Definition) Extent=[2:12 - 2:17] diff --git a/test/Index/preamble_macro_template.cpp b/test/Index/preamble_macro_template.cpp index dc98927101..1da297ee9a 100644 --- a/test/Index/preamble_macro_template.cpp +++ b/test/Index/preamble_macro_template.cpp @@ -2,8 +2,8 @@ template void foo(int *); int main() { } -// RUN: c-index-test -write-pch %t.pch -x c++-header %S/Inputs/preamble_macro_template.h -// RUN: env CINDEXTEST_EDITING=1 c-index-test -test-load-source-reparse 5 local -I %S/Inputs -include %t %s | FileCheck %s +// RUN: c-index-test -write-pch %t.pch -fno-delayed-template-parsing -x c++-header %S/Inputs/preamble_macro_template.h +// RUN: env CINDEXTEST_EDITING=1 c-index-test -test-load-source-reparse 5 local -fno-delayed-template-parsing -I %S/Inputs -include %t %s | FileCheck %s // CHECK: preamble_macro_template.h:4:6: FunctionDecl=foo:4:6 (Definition) [Specialization of foo:4:6] Extent=[4:1 - 6:2] // CHECK: preamble_macro_template.h:4:13: ParmDecl=p:4:13 (Definition) Extent=[4:10 - 4:14] // CHECK: preamble_macro_template.h:4:16: UnexposedStmt= Extent=[4:16 - 6:2]