[cfe-commits] r162890 - in /cfe/trunk: lib/Driver/Tools.cpp test/Index/complete-cxx-inline-methods.cpp test/Index/recursive-cxx-member-calls.cpp test/SemaTemplate/inject-templated-friend-post.cpp unittests/AST/DeclPrinterTest.cpp unittests/ASTMatchers/ASTMatchersTest.h
Nico Weber
nicolasweber at gmx.de
Wed Aug 29 19:08:31 PDT 2012
Author: nico
Date: Wed Aug 29 21:08:31 2012
New Revision: 162890
URL: http://llvm.org/viewvc/llvm-project?rev=162890&view=rev
Log:
Reland r160052: Default to -std=c++11 on Windows.
Also update the tests that rely on c++98 to explicitly mention that.
Modified:
cfe/trunk/lib/Driver/Tools.cpp
cfe/trunk/test/Index/complete-cxx-inline-methods.cpp
cfe/trunk/test/Index/recursive-cxx-member-calls.cpp
cfe/trunk/test/SemaTemplate/inject-templated-friend-post.cpp
cfe/trunk/unittests/AST/DeclPrinterTest.cpp
cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.h
Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=162890&r1=162889&r2=162890&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Wed Aug 29 21:08:31 2012
@@ -2141,8 +2141,11 @@
// eventually we want to do all the standard defaulting here instead of
// splitting it between the driver and clang -cc1.
if (!types::isCXX(InputType))
- Args.AddAllArgsTranslated(CmdArgs, options::OPT_std_default_EQ,
- "-std=", /*Joined=*/true);
+ Args.AddAllArgsTranslated(CmdArgs, options::OPT_std_default_EQ,
+ "-std=", /*Joined=*/true);
+ else if (getToolChain().getTriple().getOS() == llvm::Triple::Win32)
+ CmdArgs.push_back("-std=c++11");
+
Args.AddLastArg(CmdArgs, options::OPT_trigraphs);
}
Modified: cfe/trunk/test/Index/complete-cxx-inline-methods.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Index/complete-cxx-inline-methods.cpp?rev=162890&r1=162889&r2=162890&view=diff
==============================================================================
--- cfe/trunk/test/Index/complete-cxx-inline-methods.cpp (original)
+++ cfe/trunk/test/Index/complete-cxx-inline-methods.cpp Wed Aug 29 21:08:31 2012
@@ -23,8 +23,8 @@
};
}
-// RUN: c-index-test -code-completion-at=%s:4:9 %s | FileCheck %s
-// RUN: c-index-test -code-completion-at=%s:13:7 %s | FileCheck %s
+// RUN: c-index-test -code-completion-at=%s:4:9 -std=c++98 %s | FileCheck %s
+// RUN: c-index-test -code-completion-at=%s:13:7 -std=c++98 %s | FileCheck %s
// CHECK: CXXMethod:{ResultType MyCls::Vec &}{TypedText operator=}{LeftParen (}{Placeholder const MyCls::Vec &}{RightParen )} (34)
// CHECK-NEXT: StructDecl:{TypedText Vec}{Text ::} (75)
// CHECK-NEXT: FieldDecl:{ResultType int}{TypedText x} (35)
Modified: cfe/trunk/test/Index/recursive-cxx-member-calls.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Index/recursive-cxx-member-calls.cpp?rev=162890&r1=162889&r2=162890&view=diff
==============================================================================
--- cfe/trunk/test/Index/recursive-cxx-member-calls.cpp (original)
+++ cfe/trunk/test/Index/recursive-cxx-member-calls.cpp Wed Aug 29 21:08:31 2012
@@ -1523,7 +1523,7 @@
// CHECK-tokens: Punctuation: ";" [185:31 - 185:32] CompoundStmt=
// CHECK-tokens: Punctuation: "}" [186:1 - 186:2] CompoundStmt=
-// RUN: c-index-test -test-load-source all %s 2>&1 | FileCheck %s
+// RUN: c-index-test -test-load-source all %s -std=c++98 2>&1 | FileCheck %s
// CHECK: 1:27: TypedefDecl=__darwin_size_t:1:27 (Definition) Extent=[1:1 - 1:42]
// CHECK: 2:25: TypedefDecl=size_t:2:25 (Definition) Extent=[2:1 - 2:31]
// CHECK: 2:9: TypeRef=__darwin_size_t:1:27 Extent=[2:9 - 2:24]
Modified: cfe/trunk/test/SemaTemplate/inject-templated-friend-post.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaTemplate/inject-templated-friend-post.cpp?rev=162890&r1=162889&r2=162890&view=diff
==============================================================================
--- cfe/trunk/test/SemaTemplate/inject-templated-friend-post.cpp (original)
+++ cfe/trunk/test/SemaTemplate/inject-templated-friend-post.cpp Wed Aug 29 21:08:31 2012
@@ -1,7 +1,7 @@
-// RUN: %clang %s -S -emit-llvm -o - | grep -e "define linkonce_odr.*_ZlsR11std_ostreamRK8StreamerI3FooE"
-// RUN: %clang %s -S -emit-llvm -o - -DPROTOTYPE | grep -e "define linkonce_odr.*_ZlsR11std_ostreamRK8StreamerI3FooE"
-// RUN: %clang %s -S -emit-llvm -o - -DINSTANTIATE | grep -e "define linkonce_odr.*_ZlsR11std_ostreamRK8StreamerI3FooE"
-// RUN: %clang %s -S -emit-llvm -o - -DPROTOTYPE -DINSTANTIATE | grep -e "define linkonce_odr.*_ZlsR11std_ostreamRK8StreamerI3FooE"
+// RUN: %clang %s -std=c++98 -S -emit-llvm -o - | grep -e "define linkonce_odr.*_ZlsR11std_ostreamRK8StreamerI3FooE"
+// RUN: %clang %s -std=c++98 -S -emit-llvm -o - -DPROTOTYPE | grep -e "define linkonce_odr.*_ZlsR11std_ostreamRK8StreamerI3FooE"
+// RUN: %clang %s -std=c++98 -S -emit-llvm -o - -DINSTANTIATE | grep -e "define linkonce_odr.*_ZlsR11std_ostreamRK8StreamerI3FooE"
+// RUN: %clang %s -std=c++98 -S -emit-llvm -o - -DPROTOTYPE -DINSTANTIATE | grep -e "define linkonce_odr.*_ZlsR11std_ostreamRK8StreamerI3FooE"
// RUN: %clang_cc1 %s -DREDEFINE -verify
// RUN: %clang_cc1 %s -DPROTOTYPE -DREDEFINE -verify
// PR8007: friend function not instantiated, reordered version.
Modified: cfe/trunk/unittests/AST/DeclPrinterTest.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/AST/DeclPrinterTest.cpp?rev=162890&r1=162889&r2=162890&view=diff
==============================================================================
--- cfe/trunk/unittests/AST/DeclPrinterTest.cpp (original)
+++ cfe/trunk/unittests/AST/DeclPrinterTest.cpp Wed Aug 29 21:08:31 2012
@@ -73,6 +73,8 @@
std::vector<std::string> ArgVector;
ArgVector.push_back("clang-tool");
ArgVector.push_back("-fsyntax-only");
+ // operator delete (void*) grows a "noexcept" in c++11.
+ ArgVector.push_back("-std=c++98");
ArgVector.push_back(FileNameRef.data());
for (unsigned i = 0, e = ClangArgs.size(); i != e; ++i)
ArgVector.push_back(ClangArgs[i]);
Modified: cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.h?rev=162890&r1=162889&r2=162890&view=diff
==============================================================================
--- cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.h (original)
+++ cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.h Wed Aug 29 21:08:31 2012
@@ -18,7 +18,7 @@
namespace ast_matchers {
using clang::tooling::newFrontendActionFactory;
-using clang::tooling::runToolOnCode;
+using clang::tooling::runToolOnCodeWithArgs;
using clang::tooling::FrontendActionFactory;
class BoundNodesCallback {
@@ -56,7 +56,9 @@
MatchFinder Finder;
Finder.addMatcher(AMatcher, new VerifyMatch(0, &Found));
OwningPtr<FrontendActionFactory> Factory(newFrontendActionFactory(&Finder));
- if (!runToolOnCode(Factory->create(), Code)) {
+ // Some tests use typeof, which is a gnu extension.
+ std::vector<std::string> Args(1, "-std=gnu++98");
+ if (!runToolOnCodeWithArgs(Factory->create(), Code, Args)) {
return testing::AssertionFailure() << "Parsing error in \"" << Code << "\"";
}
if (!Found && ExpectMatch) {
@@ -91,7 +93,9 @@
Finder.addMatcher(
AMatcher, new VerifyMatch(FindResultVerifier, &VerifiedResult));
OwningPtr<FrontendActionFactory> Factory(newFrontendActionFactory(&Finder));
- if (!runToolOnCode(Factory->create(), Code)) {
+ // Some tests use typeof, which is a gnu extension.
+ std::vector<std::string> Args(1, "-std=gnu++98");
+ if (!runToolOnCodeWithArgs(Factory->create(), Code, Args)) {
return testing::AssertionFailure() << "Parsing error in \"" << Code << "\"";
}
if (!VerifiedResult && ExpectResult) {
More information about the cfe-commits
mailing list