annotate unittests/Support/DebugTest.cpp @ 146:3fc4d5c3e21e

set tail call flag for code segment in CGCAll
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Sun, 23 Dec 2018 19:23:36 +0900
parents 803732b1fca8
children c2174574ed3a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
121
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
1 //===- llvm/unittest/Support/DebugTest.cpp --------------------------------===//
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
2 //
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
3 // The LLVM Compiler Infrastructure
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
4 //
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
5 // This file is distributed under the University of Illinois Open Source
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
6 // License. See LICENSE.TXT for details.
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
7 //
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
8 //===----------------------------------------------------------------------===//
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
9
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
10 #include "llvm/Support/Debug.h"
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
11 #include "llvm/Support/raw_ostream.h"
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
12 #include "gtest/gtest.h"
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
13
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
14 #include <string>
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
15 using namespace llvm;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
16
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
17 #ifndef NDEBUG
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
18 TEST(DebugTest, Basic) {
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
19 std::string s1, s2;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
20 raw_string_ostream os1(s1), os2(s2);
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
21 static const char *DT[] = {"A", "B"};
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
22
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
23 llvm::DebugFlag = true;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
24 setCurrentDebugTypes(DT, 2);
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
25 DEBUG_WITH_TYPE("A", os1 << "A");
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
26 DEBUG_WITH_TYPE("B", os1 << "B");
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
27 EXPECT_EQ("AB", os1.str());
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
28
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
29 setCurrentDebugType("A");
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
30 DEBUG_WITH_TYPE("A", os2 << "A");
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
31 DEBUG_WITH_TYPE("B", os2 << "B");
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
32 EXPECT_EQ("A", os2.str());
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
33 }
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
34 #endif