diff options
author | Nico Weber <nicolasweber@gmx.de> | 2012-08-30 02:08:31 +0000 |
---|---|---|
committer | Nico Weber <nicolasweber@gmx.de> | 2012-08-30 02:08:31 +0000 |
commit | 723b4f02a71a5c74c355cbe5f502c206b86824a5 (patch) | |
tree | d2fa0bd543f0d9e9337d6b5101dab4df89386305 | |
parent | 077a53e5ab1d8e194aa02d7ca2ce3f646af0be9f (diff) | |
download | bcm5719-llvm-723b4f02a71a5c74c355cbe5f502c206b86824a5.tar.gz bcm5719-llvm-723b4f02a71a5c74c355cbe5f502c206b86824a5.zip |
Reland r160052: Default to -std=c++11 on Windows.
Also update the tests that rely on c++98 to explicitly mention that.
llvm-svn: 162890
-rw-r--r-- | clang/lib/Driver/Tools.cpp | 7 | ||||
-rw-r--r-- | clang/test/Index/complete-cxx-inline-methods.cpp | 4 | ||||
-rw-r--r-- | clang/test/Index/recursive-cxx-member-calls.cpp | 2 | ||||
-rw-r--r-- | clang/test/SemaTemplate/inject-templated-friend-post.cpp | 8 | ||||
-rw-r--r-- | clang/unittests/AST/DeclPrinterTest.cpp | 2 | ||||
-rw-r--r-- | clang/unittests/ASTMatchers/ASTMatchersTest.h | 10 |
6 files changed, 21 insertions, 12 deletions
diff --git a/clang/lib/Driver/Tools.cpp b/clang/lib/Driver/Tools.cpp index c113406670b..3c46e34ac78 100644 --- a/clang/lib/Driver/Tools.cpp +++ b/clang/lib/Driver/Tools.cpp @@ -2141,8 +2141,11 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, // 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); } diff --git a/clang/test/Index/complete-cxx-inline-methods.cpp b/clang/test/Index/complete-cxx-inline-methods.cpp index d441972dd6f..ee359f75e44 100644 --- a/clang/test/Index/complete-cxx-inline-methods.cpp +++ b/clang/test/Index/complete-cxx-inline-methods.cpp @@ -23,8 +23,8 @@ private: }; } -// 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) diff --git a/clang/test/Index/recursive-cxx-member-calls.cpp b/clang/test/Index/recursive-cxx-member-calls.cpp index 9b93872ee01..501dc2954f0 100644 --- a/clang/test/Index/recursive-cxx-member-calls.cpp +++ b/clang/test/Index/recursive-cxx-member-calls.cpp @@ -1523,7 +1523,7 @@ AttributeList::Kind AttributeList::getKind(const IdentifierInfo * Name) { // 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] diff --git a/clang/test/SemaTemplate/inject-templated-friend-post.cpp b/clang/test/SemaTemplate/inject-templated-friend-post.cpp index 39c445ca0f9..c86f718bb5f 100644 --- a/clang/test/SemaTemplate/inject-templated-friend-post.cpp +++ b/clang/test/SemaTemplate/inject-templated-friend-post.cpp @@ -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. diff --git a/clang/unittests/AST/DeclPrinterTest.cpp b/clang/unittests/AST/DeclPrinterTest.cpp index c99550af226..2800df4caf5 100644 --- a/clang/unittests/AST/DeclPrinterTest.cpp +++ b/clang/unittests/AST/DeclPrinterTest.cpp @@ -73,6 +73,8 @@ bool runToolOnCode(clang::FrontendAction *ToolAction, const Twine &Code, 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]); diff --git a/clang/unittests/ASTMatchers/ASTMatchersTest.h b/clang/unittests/ASTMatchers/ASTMatchersTest.h index 64816f5d604..6d872e8ea99 100644 --- a/clang/unittests/ASTMatchers/ASTMatchersTest.h +++ b/clang/unittests/ASTMatchers/ASTMatchersTest.h @@ -18,7 +18,7 @@ namespace clang { 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 @@ testing::AssertionResult matchesConditionally(const std::string &Code, 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 @@ matchAndVerifyResultConditionally(const std::string &Code, const T &AMatcher, 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) { |