forked from OSchip/llvm-project
clang/unittests/AST,ASTMatchers: Remove _MSC_VER.
llvm-svn: 201485
This commit is contained in:
parent
0884887775
commit
7d2da0b2ae
|
@ -143,6 +143,19 @@ public:
|
||||||
"input.cc");
|
"input.cc");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
::testing::AssertionResult PrintedDeclCXX11nonMSCMatches(
|
||||||
|
StringRef Code,
|
||||||
|
const DeclarationMatcher &NodeMatch,
|
||||||
|
StringRef ExpectedPrinted) {
|
||||||
|
std::vector<std::string> Args(1, "-std=c++11");
|
||||||
|
Args.push_back("-fno-delayed-template-parsing");
|
||||||
|
return PrintedDeclMatches(Code,
|
||||||
|
Args,
|
||||||
|
NodeMatch,
|
||||||
|
ExpectedPrinted,
|
||||||
|
"input.cc");
|
||||||
|
}
|
||||||
|
|
||||||
::testing::AssertionResult PrintedDeclObjCMatches(
|
::testing::AssertionResult PrintedDeclObjCMatches(
|
||||||
StringRef Code,
|
StringRef Code,
|
||||||
const DeclarationMatcher &NodeMatch,
|
const DeclarationMatcher &NodeMatch,
|
||||||
|
@ -499,9 +512,8 @@ TEST(DeclPrinter, TestCXXConstructorDecl10) {
|
||||||
"A<T...>(const A<T...> &a)"));
|
"A<T...>(const A<T...> &a)"));
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !defined(_MSC_VER)
|
|
||||||
TEST(DeclPrinter, TestCXXConstructorDecl11) {
|
TEST(DeclPrinter, TestCXXConstructorDecl11) {
|
||||||
ASSERT_TRUE(PrintedDeclCXX11Matches(
|
ASSERT_TRUE(PrintedDeclCXX11nonMSCMatches(
|
||||||
"template<typename... T>"
|
"template<typename... T>"
|
||||||
"struct A : public T... {"
|
"struct A : public T... {"
|
||||||
" A(T&&... ts) : T(ts)... {}"
|
" A(T&&... ts) : T(ts)... {}"
|
||||||
|
@ -510,7 +522,6 @@ TEST(DeclPrinter, TestCXXConstructorDecl11) {
|
||||||
"A<T...>(T &&ts...) : T(ts)"));
|
"A<T...>(T &&ts...) : T(ts)"));
|
||||||
// WRONG; Should be: "A(T&&... ts) : T(ts)..."
|
// WRONG; Should be: "A(T&&... ts) : T(ts)..."
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
TEST(DeclPrinter, TestCXXDestructorDecl1) {
|
TEST(DeclPrinter, TestCXXDestructorDecl1) {
|
||||||
ASSERT_TRUE(PrintedDeclCXX98Matches(
|
ASSERT_TRUE(PrintedDeclCXX98Matches(
|
||||||
|
|
|
@ -12,6 +12,8 @@
|
||||||
#include "clang/ASTMatchers/ASTMatchFinder.h"
|
#include "clang/ASTMatchers/ASTMatchFinder.h"
|
||||||
#include "clang/ASTMatchers/ASTMatchers.h"
|
#include "clang/ASTMatchers/ASTMatchers.h"
|
||||||
#include "clang/Tooling/Tooling.h"
|
#include "clang/Tooling/Tooling.h"
|
||||||
|
#include "llvm/ADT/Triple.h"
|
||||||
|
#include "llvm/Support/Host.h"
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
|
|
||||||
namespace clang {
|
namespace clang {
|
||||||
|
@ -103,12 +105,12 @@ TEST(NameableDeclaration, REMatchesVariousDecls) {
|
||||||
|
|
||||||
TEST(DeclarationMatcher, MatchClass) {
|
TEST(DeclarationMatcher, MatchClass) {
|
||||||
DeclarationMatcher ClassMatcher(recordDecl());
|
DeclarationMatcher ClassMatcher(recordDecl());
|
||||||
#if !defined(_MSC_VER)
|
if (llvm::Triple(llvm::sys::getDefaultTargetTriple()).getOS() !=
|
||||||
EXPECT_FALSE(matches("", ClassMatcher));
|
llvm::Triple::Win32)
|
||||||
#else
|
EXPECT_FALSE(matches("", ClassMatcher));
|
||||||
// Matches class type_info.
|
else
|
||||||
EXPECT_TRUE(matches("", ClassMatcher));
|
// Matches class type_info.
|
||||||
#endif
|
EXPECT_TRUE(matches("", ClassMatcher));
|
||||||
|
|
||||||
DeclarationMatcher ClassX = recordDecl(recordDecl(hasName("X")));
|
DeclarationMatcher ClassX = recordDecl(recordDecl(hasName("X")));
|
||||||
EXPECT_TRUE(matches("class X;", ClassX));
|
EXPECT_TRUE(matches("class X;", ClassX));
|
||||||
|
@ -1300,15 +1302,16 @@ TEST(Function, MatchesFunctionDeclarations) {
|
||||||
EXPECT_TRUE(matches("void f() { f(); }", CallFunctionF));
|
EXPECT_TRUE(matches("void f() { f(); }", CallFunctionF));
|
||||||
EXPECT_TRUE(notMatches("void f() { }", CallFunctionF));
|
EXPECT_TRUE(notMatches("void f() { }", CallFunctionF));
|
||||||
|
|
||||||
#if !defined(_MSC_VER)
|
if (llvm::Triple(llvm::sys::getDefaultTargetTriple()).getOS() !=
|
||||||
// FIXME: Make this work for MSVC.
|
llvm::Triple::Win32) {
|
||||||
// Dependent contexts, but a non-dependent call.
|
// FIXME: Make this work for MSVC.
|
||||||
EXPECT_TRUE(matches("void f(); template <int N> void g() { f(); }",
|
// Dependent contexts, but a non-dependent call.
|
||||||
CallFunctionF));
|
EXPECT_TRUE(matches("void f(); template <int N> void g() { f(); }",
|
||||||
EXPECT_TRUE(
|
CallFunctionF));
|
||||||
matches("void f(); template <int N> struct S { void g() { f(); } };",
|
EXPECT_TRUE(
|
||||||
CallFunctionF));
|
matches("void f(); template <int N> struct S { void g() { f(); } };",
|
||||||
#endif
|
CallFunctionF));
|
||||||
|
}
|
||||||
|
|
||||||
// Depedent calls don't match.
|
// Depedent calls don't match.
|
||||||
EXPECT_TRUE(
|
EXPECT_TRUE(
|
||||||
|
|
Loading…
Reference in New Issue