1 //===-- ns.cpp ------------------------------------------------*- C++ -*-===// 2 // 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 // See https://llvm.org/LICENSE.txt for license information. 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 // 7 //===----------------------------------------------------------------------===// 8 9 #include "ns.h" 10 11 int foo() 12 { 13 std::printf("global foo()\n"); 14 return 42; 15 } 16 int func() 17 { 18 std::printf("global func()\n"); 19 return 1; 20 } 21 int func(int a) 22 { 23 std::printf("global func(int)\n"); 24 return a + 1; 25 } 26 void test_lookup_at_global_scope() 27 { 28 // BP_global_scope 29 std::printf("at global scope: foo() = %d\n", foo()); // eval foo(), exp: 42 30 std::printf("at global scope: func() = %d\n", func()); // eval func(), exp: 1 31 } 32