// Intercept the implicit 'this' argument of class member functions.
//
// RUN: %clangxx_xray -g -std=c++11 %s -o %t
// RUN: rm log-args-this-* || true
// RUN: XRAY_OPTIONS="patch_premain=true verbosity=1 xray_logfile_base=log-args-this-" %run %t
//
// XFAIL: freebsd || arm || aarch64 || mips
// UNSUPPORTED: powerpc64le
#include "xray/xray_interface.h"
#include <cassert>

class A {
 public:
  [[clang::xray_always_instrument, clang::xray_log_args(1)]] void f() {
    // does nothing.
  }
};

volatile uint64_t captured = 0;

void handler(int32_t, XRayEntryType, uint64_t arg1) {
  captured = arg1;
}

int main() {
  __xray_set_handler_arg1(handler);
  A instance;
  instance.f();
  __xray_remove_handler_arg1();
  assert(captured == (uint64_t)&instance);
}

// Intercept the implicit 'this' argument of class member functions.
//
// RUN: %clangxx_xray -g -std=c++11 %s -o %t
// RUN: rm log-args-this-* || true
// RUN: XRAY_OPTIONS="patch_premain=true verbosity=1 xray_logfile_base=log-args-this-" %run %t
//
// XFAIL: FreeBSD || arm || aarch64 || mips
// UNSUPPORTED: powerpc64le
#include "xray/xray_interface.h"
#include <cassert>

class A {
 public:
  [[clang::xray_always_instrument, clang::xray_log_args(1)]] void f() {
    // does nothing.
  }
};

volatile uint64_t captured = 0;

void handler(int32_t, XRayEntryType, uint64_t arg1) {
  captured = arg1;
}

int main() {
  __xray_set_handler_arg1(handler);
  A instance;
  instance.f();
  __xray_remove_handler_arg1();
  assert(captured == (uint64_t)&instance);
}

Fix supposely failing test for FreeBSD

[XRay] Fix supposely failing test for FreeBSD

One test was marked as XFAIL for FreeBSD however still running when launching make check-xray

Reviewers: krytarowski, vitalybuka

Reviewed By: dberris

Differential Revision: https://reviews.llvm.org/D47622

git-svn-id: c199f293c43da69278bea8e88f92242bf3aa95f7@333733 91177308-0d34-0410-b5e6-96231b3b80d8


/*
 * openvrupdateslavecallback.cpp
 *
 *  Created on: Dec 18, 2015
 *      Author: Chris Denham
 */

#include "openvrupdateslavecallback.h"

void OpenVRUpdateSlaveCallback::updateSlave(osg::View& view, osg::View::Slave& slave)
{
	if (m_cameraType == LEFT_CAMERA)
	{
		m_device->updatePose();
	}

	osg::Vec3 position = m_device->position();
	osg::Quat orientation = m_device->orientation();

	osg::Matrix viewOffset = (m_cameraType == LEFT_CAMERA) ? m_device->viewMatrixLeft() : m_device->viewMatrixRight();

	viewOffset.preMultRotate(orientation);
	viewOffset.setTrans(position);

	slave._viewOffset = viewOffset;

	slave.updateSlaveImplementation(view);
}

/*
 * openvrupdateslavecallback.cpp
 *
 *  Created on: Dec 18, 2015
 *      Author: Chris Denham
 */

#include "openvrupdateslavecallback.h"

void OpenVRUpdateSlaveCallback::updateSlave(osg::View& view, osg::View::Slave& slave)
{
	if (m_cameraType == LEFT_CAMERA)
	{
		m_device->updatePose();
	}

	osg::Vec3 position = m_device->position();
	osg::Quat orientation = m_device->orientation();

	osg::Matrix viewOffset = (m_cameraType == LEFT_CAMERA) ? m_device->viewMatrixLeft() : m_device->viewMatrixRight();

	viewOffset.preMultRotate(orientation);
	viewOffset.setTrans(viewOffset.getTrans() + position);

	slave._viewOffset = viewOffset;

	slave.updateSlaveImplementation(view);
}

Fix problem that caused left and right eyes to have the exact same image.


/Od
/I "P:\PROJEKTE\GERTICO\Win32VC80\ACE+TAO-5.6.5"
/I "C:\FHG\GERTICO"
/I "..\..\..\..\LevelTwo\common\include"
/I "..\..\..\..\LevelCommonIEEE\include"
/I "..\..\..\..\LevelCommonIEEE\include\RTI_1516"
/I "..\..\..\..\LevelTwo\phase_III"
/D "_WIN32_"
/D "WIN32"
/D "_UT_DEBUG"
/D "_NDEBUG"
/D "_CONSOLE"
/D "_CRT_SECURE_NO_DEPRECATE"
/D "IEEE_1516"
/D "GERTICO_1516"
/D "_UNICODE"
/D "UNICODE"
/FD
/EHsc /EHsc /EHsc
/MD
/Zc:forScope-
/Fo".\Release\\"
/Fd".\Release\vc80.pdb"
/W3
/nologo
/c
/Wp64
/TP
/wd4290
/wd4267
/wd4244
/wd4311
/errorReport:prompt

/Od
/I "P:\PROJEKTE\GERTICO\Win32VC80\ACE+TAO-5.6.5"
/I "C:\FHG\GERTICO"
/I "..\..\..\..\LevelTwo\common\include"
/I "..\..\..\..\LevelCommonIEEE\include"
/I "..\..\..\..\LevelCommonIEEE\include\RTI_1516"
/I "..\..\..\..\LevelTwo\phase_III"
/D "_WIN32_"
/D "WIN32"
/D "_UT_DEBUG"
/D "_NDEBUG"
/D "_CONSOLE"
/D "_CRT_SECURE_NO_DEPRECATE"
/D "IEEE_1516"
/D "GERTICO_1516"
/D "_UNICODE"
/D "UNICODE"
/FD
/EHsc Maus
/MD
/Zc:forScope-
/Fo".\Release\\"
/Fd".\Release\vc80.pdb"
/W3
/nologo
/c
/Wp64
/TP
/wd4290
/wd4267
/wd4244
/wd4311
/errorReport:prompt

Use maus instead of mouse.

Use maus instead of mouse.


// Copyright (c) 2008-2009 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "chrome/browser/history/history_publisher.h"

#include "base/utf_string_conversions.h"

namespace history {

const char* const HistoryPublisher::kThumbnailImageFormat = "image/jpeg";

void HistoryPublisher::PublishPageThumbnail(
    const std::vector<unsigned char>& thumbnail, const GURL& url,
    const base::Time& time) const {
  PageData page_data = {
    time,
    url,
    NULL,
    NULL,
    kThumbnailImageFormat,
    &thumbnail,
  };

  PublishDataToIndexers(page_data);
}

void HistoryPublisher::PublishPageContent(const base::Time& time,
                                          const GURL& url,
                                          const std::wstring& title,
                                          const string16& contents) const {
  PageData page_data = {
    time,
    url,
    UTF16ToWide(contents).c_str(),
    title.c_str(),
    NULL,
    NULL,
  };

  PublishDataToIndexers(page_data);
}

}  // namespace history

// Copyright (c) 2008-2009 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "chrome/browser/history/history_publisher.h"

#include "base/utf_string_conversions.h"

namespace history {

const char* const HistoryPublisher::kThumbnailImageFormat = "image/jpeg";

void HistoryPublisher::PublishPageThumbnail(
    const std::vector<unsigned char>& thumbnail, const GURL& url,
    const base::Time& time) const {
  PageData page_data = {
    time,
    url,
    NULL,
    NULL,
    kThumbnailImageFormat,
    &thumbnail,
  };

  PublishDataToIndexers(page_data);
}

void HistoryPublisher::PublishPageContent(const base::Time& time,
                                          const GURL& url,
                                          const std::wstring& title,
                                          const string16& contents) const {
  std::wstring wide_contents = UTF16ToWide(contents);
  PageData page_data = {
    time,
    url,
    wide_contents.c_str(),
    title.c_str(),
    NULL,
    NULL,
  };

  PublishDataToIndexers(page_data);
}

}  // namespace history

Make sure the pointer in PageData::html remains valid while PageData is called.

BUG=46835

Review URL: http://codereview.chromium.org/2852014

git-svn-id: http://src.chromium.org/svn/trunk/src@50173 4ff67af0-8c30-449e-8e8b-ad334ec8d88c

Former-commit-id: d6445a62eda4b2f2090813edd9d64bbf21f55868


// Copyright (c) 2013 GitHub, Inc. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef ATOM_BROWSER_API_ATOM_API_RECORDED_OBJECT_
#define ATOM_BROWSER_API_ATOM_API_RECORDED_OBJECT_

#include "browser/api/atom_api_recorded_object.h"

#include "base/compiler_specific.h"
#include "browser/api/atom_api_objects_registry.h"
#include "browser/atom_browser_context.h"

namespace atom {

namespace api {

RecordedObject::RecordedObject(v8::Handle<v8::Object> wrapper)
    : ALLOW_THIS_IN_INITIALIZER_LIST(id_(
          AtomBrowserContext::Get()->objects_registry()->Add(this))) {
  Wrap(wrapper);

  wrapper->SetAccessor(v8::String::New("id"), IDGetter);
}

RecordedObject::~RecordedObject() {
}

// static
v8::Handle<v8::Value> RecordedObject::IDGetter(v8::Local<v8::String> property,
                                               const v8::AccessorInfo& info) {
  RecordedObject* self = RecordedObject::Unwrap<RecordedObject>(info.This());
  return v8::Integer::New(self->id_);
}

}  // namespace api

}  // namespace atom

#endif  // ATOM_BROWSER_API_ATOM_API_RECORDED_OBJECT_

// Copyright (c) 2013 GitHub, Inc. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef ATOM_BROWSER_API_ATOM_API_RECORDED_OBJECT_
#define ATOM_BROWSER_API_ATOM_API_RECORDED_OBJECT_

#include "browser/api/atom_api_recorded_object.h"

#include "base/compiler_specific.h"
#include "browser/api/atom_api_objects_registry.h"
#include "browser/atom_browser_context.h"

namespace atom {

namespace api {

RecordedObject::RecordedObject(v8::Handle<v8::Object> wrapper)
    : ALLOW_THIS_IN_INITIALIZER_LIST(id_(
          AtomBrowserContext::Get()->objects_registry()->Add(this))) {
  Wrap(wrapper);

  wrapper->SetAccessor(v8::String::New("id"), IDGetter);
}

RecordedObject::~RecordedObject() {
  AtomBrowserContext::Get()->objects_registry()->Remove(id());
}

// static
v8::Handle<v8::Value> RecordedObject::IDGetter(v8::Local<v8::String> property,
                                               const v8::AccessorInfo& info) {
  RecordedObject* self = RecordedObject::Unwrap<RecordedObject>(info.This());
  return v8::Integer::New(self->id_);
}

}  // namespace api

}  // namespace atom

#endif  // ATOM_BROWSER_API_ATOM_API_RECORDED_OBJECT_

Remove recorded object from registry in desturctor.


#include <iostream>
#include <string>

#include <memory>

#include <Lexer.hpp>
#include <Parser.hpp>
#include <Visitors.hpp>

int main() {
    std::string input_line;

    double ans = 0;

    std::cout << "miniMAT: It's like MATLAB, but smaller." << std::endl;
    std::cout << "Copyright (C) 2014 Federico Menozzi" << std::endl;
    std::cout << std::endl;

    while (true) {
        std::cout << ">>> ";

        std::getline(std::cin, input_line);
        if (input_line == "quit" || input_line == "exit")
            break;
        else if (input_line == "ans") {
            std::cout << "ans = " << ans << std::endl;
            continue;
        } else if (input_line == "")
            continue;

        if (std::cin.eof()) {
            std::cout << std::endl;
            break;
        }

        auto reporter = std::make_shared<miniMAT::reporter::ErrorReporter>();
        miniMAT::lexer::Lexer   lexer(input_line, reporter);
        miniMAT::parser::Parser parser(lexer, reporter);

        auto ast = parser.Parse();

        if (reporter->HasErrors())
            reporter->ReportErrors();
        else {
            ans = ast->VisitEvaluate();
            std::cout << "ans = " << std::endl << std::endl;
            std::cout << "     " << ans << std::endl << std::endl;
        }
    }

    return 0;
}

#include <iostream>
#include <string>

#include <memory>

#include <Lexer.hpp>
#include <Parser.hpp>
#include <Visitors.hpp>

int main() {
    std::string input_line;

    double ans = 0;

    std::cout << "miniMAT: It's like MATLAB, but smaller." << std::endl;
    std::cout << "Copyright (C) 2014 Federico Menozzi" << std::endl;
    std::cout << std::endl;

    while (true) {
        std::cout << ">>> ";

        std::getline(std::cin, input_line);
        if (input_line == "quit" || input_line == "exit")
            break;
        else if (input_line == "ans") {
            std::cout << "ans = " << std::endl << std::endl;
            std::cout << "     " << ans << std::endl << std::endl;
            continue;
        } else if (input_line == "")
            continue;

        if (std::cin.eof()) {
            std::cout << std::endl;
            break;
        }

        auto reporter = std::make_shared<miniMAT::reporter::ErrorReporter>();
        miniMAT::lexer::Lexer   lexer(input_line, reporter);
        miniMAT::parser::Parser parser(lexer, reporter);

        auto ast = parser.Parse();

        if (reporter->HasErrors())
            reporter->ReportErrors();
        else {
            ans = ast->VisitEvaluate();
            std::cout << "ans = " << std::endl << std::endl;
            std::cout << "     " << ans << std::endl << std::endl;
        }
    }

    return 0;
}

Adjust output when user enters 'ans'

Adjust output when user enters 'ans'


// RUN: rm -rf %t
// RUN: %clang_cc1 -I%S/Inputs/PR21547 -verify %s
// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%S/Inputs/PR21547 -verify %s

#include "Inputs/PR21547/FirstHeader.h"

//expected-no-diagnostics

// RUN: rm -rf %t
// RUN: %clang_cc1 -I%S/Inputs/PR21547 -verify %s
// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%S/Inputs/PR21547 -verify %s
// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%S/Inputs/PR21547 -emit-llvm-only %s

#include "Inputs/PR21547/FirstHeader.h"

//expected-no-diagnostics

Add -emit-llvm-only to the regression test for PR21547.

git-svn-id: ffe668792ed300d6c2daa1f6eba2e0aa28d7ec6c@264939 91177308-0d34-0410-b5e6-96231b3b80d8


// Copyright (c) 2014 Andrew Toulouse.
// Distributed under the MIT License.

#include <iostream>
#include <fstream>

#include <libOL/File.h>

int main(int argc, const char * argv[])
{

    std::ifstream ifs("/Users/toulouse/code/lol/lmao/rofl/22923174.rofl", std::ios::binary);

    libol::File file = libol::File::decode(ifs);

    //std::cout << file << std::endl;
    return 0;
}

// Copyright (c) 2014 Andrew Toulouse.
// Distributed under the MIT License.

#include <iostream>
#include <fstream>

#include <libOL/File.h>
#include <libOL/Chunks.h>

int main(int argc, const char * argv[])
{

    std::ifstream ifs("/Users/toulouse/code/lol/lmao/rofl/22923174.rofl", std::ios::binary);

    libol::File file = libol::File::decode(ifs);

    auto decryptionKey = file.payloadHeader.getDecodedEncryptionKey();

    auto header0 = file.chunkHeaders[0];
    std::vector<uint8_t> chunk0;
    chunk0.resize(header0.chunkLength);

    ifs.seekg(file.header.payloadOffset +
              file.payloadHeader.chunkCount * 17 +
              file.payloadHeader.keyframeCount  * 17 +
              header0.offset);
    ifs.read(reinterpret_cast<char *>(&chunk0[0]), header0.chunkLength);

    auto chunk0decrypted = libol::Chunks::decryptAndDecompress(chunk0, decryptionKey);
    std::cout << "foo" << std::endl;
    return 0;
}

Add some test code for decryption

Add some test code for decryption


#define CAF_TEST_NO_MAIN
#include <caf/test/unit_test_impl.hpp>

#include "vast/announce.h"

int main(int argc, char** argv)
{
  vast::announce_types();
  return caf::test::main(argc, argv);
}

#define CAF_TEST_NO_MAIN
#include <caf/test/unit_test_impl.hpp>

#include "vast/announce.h"
#include "vast/config.h"

#ifdef VAST_MACOS
#include <sys/resource.h> // setrlimit
#endif

namespace {

bool adjust_resource_limits()
{
#ifdef VAST_MACOS
  auto rl = ::rlimit{4096, 8192};
  auto result = ::setrlimit(RLIMIT_NOFILE,  &rl);
  return result == 0;
#endif
  return true;
}

} // namespace <anonymous>

int main(int argc, char** argv)
{
  if (! adjust_resource_limits())
    return 1;
  vast::announce_types();
  return caf::test::main(argc, argv);
}

Increase low default ulimit -n of 256 on Mac OS

The low default ulimit -n of 256 on Mac OS caused unit tests to fail.


// RUN: %clang_cc1 -fsyntax-only -verify %s
// RUN: cp %s %t
// RUN: %clang_cc1 -fixit -x c++ %t
// RUN: FileCheck -input-file=%t %s

void f(int a[10][20]) {
  // CHECK: delete[] a;
  delete a; // expected-warning {{'delete' applied to a pointer-to-array type}}
}

// RUN: %clang_cc1 -fsyntax-only -verify %s
// RUN: cp %s %t
// RUN: %clang_cc1 -fixit -x c++ %t
// RUN: %clang_cc1 -E -o - %t | FileCheck %s

void f(int a[10][20]) {
  // CHECK: delete[] a;
  delete a; // expected-warning {{'delete' applied to a pointer-to-array type}}
}

Fix a test case where FileCheck is used to test code corrected by -fixit.
If the code file is not run through the preproccessor to remove comments,
then FileCheck will match the strings within the CHECK commands rendering
the test useless.

git-svn-id: ffe668792ed300d6c2daa1f6eba2e0aa28d7ec6c@141911 91177308-0d34-0410-b5e6-96231b3b80d8


// REQUIRES: x86-64-registered-target
// RUN: %clang -cc1 -triple x86_64-apple-darwin10  -g -fno-limit-debug-info -S %s -o %t
// RUN: FileCheck %s < %t

//CHECK:         .asciz   "G"
//CHECK-NEXT:    .long   0
//CHECK-NEXT: Lpubtypes_end1:

class G {
public:
	void foo();
};

void G::foo() {
}

// REQUIRES: x86-64-registered-target
// RUN: %clang -cc1 -triple x86_64-apple-darwin10  -g -fno-limit-debug-info -S %s -o %t
// RUN: FileCheck %s < %t

// FIXME: This testcase shouldn't rely on assembly emission.
//CHECK: Lpubtypes_begin1:
//CHECK:         .asciz   "G"
//CHECK-NEXT:    .long   0
//CHECK-NEXT: Lpubtypes_end1:

class G {
public:
	void foo();
};

void G::foo() {
}

Update test for llvm assembly output change. Also add a fixme that this
shouldn't be relying on assembly emission.

For the record we should check the metadata output from the front
end and then check in the backend that such a thing emits a pubtypes
entry.

git-svn-id: ffe668792ed300d6c2daa1f6eba2e0aa28d7ec6c@151851 91177308-0d34-0410-b5e6-96231b3b80d8


#include <string.h>
#include <stdlib.h>
#include <stdio.h>

#include <3ds.h>

#include "constants.h"
#include "patches.h"

#define log(...) fprintf(stderr, __VA_ARGS__)

int main(int argc, char** argv)
{
	gfxInitDefault();
	consoleInit(GFX_TOP, NULL);
	GetVersionConstants();
    PatchSrvAccess();

    svcBackdoor(PatchProcessWrapper);
    log("[0x%08X] - Patched process\n", ret);

	// Main loop
	while (aptMainLoop())
	{
		hidScanInput();

		u32 kDown = hidKeysDown();
		if (kDown & KEY_START)
			break;
		gspWaitForVBlank();
	}

	gfxExit();
	return 0;
}

#include <string.h>
#include <stdlib.h>
#include <stdio.h>

#include <3ds.h>

#include "constants.h"
#include "patches.h"

#define log(...) fprintf(stderr, __VA_ARGS__)

int main(int argc, char** argv)
{
	gfxInitDefault();
	consoleInit(GFX_TOP, NULL);
	GetVersionConstants();
    PatchSrvAccess();

// ONLY UNCOMMENT AFTER CUSTOMIZING PatchProcessWrapper
    // svcBackdoor(PatchProcessWrapper);
    // log("[0x%08X] - Patched process\n", ret);

	// Main loop
	while (aptMainLoop())
	{
		hidScanInput();

		u32 kDown = hidKeysDown();
		if (kDown & KEY_START)
			break;
		gspWaitForVBlank();
	}

	gfxExit();
	return 0;
}

Disable process patching by default (probably wasn't a good idea to patch with all zeroes)


// RUN: %clang_cc1 -std=c++11 -verify %s

// rdar://12240916 stack overflow.
namespace rdar12240916 {

struct S2 {
  S2(const S2&);
  S2();
};

struct S { // expected-note {{not complete}}
  S x; // expected-error {{incomplete type}}
  S2 y;
};

S foo() {
  S s;
  return s;
}

struct S3; // expected-note {{forward declaration}}

struct S4 {
  S3 x; // expected-error {{incomplete type}}
  S2 y;
};

struct S3 {
  S4 x;
  S2 y;
};

S4 foo2() {
  S4 s;
  return s;
}

}

// rdar://12542261 stack overflow.
namespace rdar12542261 {

template <class _Tp>
struct check_complete
{
  static_assert(sizeof(_Tp) > 0, "Type must be complete.");
};

template<class _Rp>
class function // expected-note 2 {{candidate}}
{
public:
  template<class _Fp>
  function(_Fp, typename check_complete<_Fp>::type* = 0);  // expected-note {{candidate}}
};

void foobar()
{
  auto LeftCanvas = new Canvas(); // expected-error {{unknown type name}}
  function<void()> m_OnChange = [&, LeftCanvas]() { }; // expected-error {{no viable conversion}}
}

}

Add a test case for the stack overflow in rdar://12542261

git-svn-id: ffe668792ed300d6c2daa1f6eba2e0aa28d7ec6c@166858 91177308-0d34-0410-b5e6-96231b3b80d8


/*
 * Copyright (C) 2017 Incognito
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#include "core.h"

#include <boost/scoped_ptr.hpp>

boost::scoped_ptr<Core> core;

Core::Core()
{
	data.reset(new Data);
	grid.reset(new Grid);
	streamer.reset(new Streamer);
}

/*
 * Copyright (C) 2017 Incognito
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#include "core.h"

#include <boost/scoped_ptr.hpp>

boost::scoped_ptr<Core> core;

Core::Core()
{
	data.reset(new Data);
	grid.reset(new Grid);
	chunkStreamer.reset(new ChunkStreamer);
	streamer.reset(new Streamer);
}

Fix crash when player connects

Fix crash when player connects

Fixes #248.


// Regression test for http://llvm.org/bugs/show_bug.cgi?id=21621
// This test relies on timing between threads, so any failures will be flaky.
// RUN: LSAN_BASE="use_stacks=0:use_registers=0"
// RUN: %clangxx_lsan %s -std=c++11 -o %t
// RUN: %run %t
#include <thread>
#include <chrono>

void func() {
      std::this_thread::sleep_for(std::chrono::milliseconds(500));
}

int main() {
      std::thread(func).detach();
}

// Regression test for http://llvm.org/bugs/show_bug.cgi?id=21621
// This test relies on timing between threads, so any failures will be flaky.
// RUN: LSAN_BASE="use_stacks=0:use_registers=0"
// RUN: %clangxx_lsan %s -o %t
// RUN: %run %t
#include <assert.h>
#include <pthread.h>
#include <stdlib.h>
#include <unistd.h>

void *func(void *arg) {
  sleep(1);
  free(arg);
  return 0;
}

void create_detached_thread() {
  pthread_t thread_id;
  pthread_attr_t attr;

  pthread_attr_init(&attr);
  pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);

  void *arg = malloc(1337);
  assert(arg);
  int res = pthread_create(&thread_id, &attr, func, arg);
  assert(res == 0);
}

int main() {
  create_detached_thread();
}

[LSan] Rewrite the test from r223419 to not use C++11.

This was causing build failures on llvm-clang-lld-x86_64-centos-6.5 for some
reason. Anyway, the new way is better because we no longer rely on std::thread
implementation details.

git-svn-id: c199f293c43da69278bea8e88f92242bf3aa95f7@223480 91177308-0d34-0410-b5e6-96231b3b80d8


/// \file    main.cpp

#include "HelloTriangleApplication.hpp"
#include "VDeleter.hpp"

// waf-generated header
#include "config.hpp"

#define DOCTEST_CONFIG_IMPLEMENT
#include "doctest.h"

#define GLFW_INCLUDE_VULKAN
#include <GLFW/glfw3.h>

#include <iostream>
#include <string>

int main(int argc, char* argv[])
{
  int res{0};
#ifndef DOCTEST_CONFIG_DISABLE
  doctest::Context context(argc, argv);

  context.setOption("no-run", true);

  context.applyCommandLine(argc, argv);

  using namespace std::literals::string_literals;
  auto begin_argv = argv + 1;
  auto end_argv = argv + argc;
  if (end_argv != std::find(begin_argv, end_argv, "--test"s)) {
    context.setOption("no-run", false);
    context.setOption("exit", true);
  }

  res = context.run();
  if (context.shouldExit()) return res;
#endif
  HelloTriangleApplication app;

  try {
    app.run();
  }
  catch (const std::runtime_error& e) {
    std::cerr << e.what() << std::endl;
    return EXIT_FAILURE;
  }

  return EXIT_SUCCESS + res;
}

// vim:set et ts=2 sw=2 sts=2:

/// \file    main.cpp

#include "HelloTriangleApplication.hpp"
#include "VDeleter.hpp"

// waf-generated header
#include "config.hpp"

#define DOCTEST_CONFIG_IMPLEMENT
#include "doctest.h"

#define GLFW_INCLUDE_VULKAN
#include <GLFW/glfw3.h>

#include <iostream>
#include <string>

int main(int argc, char* argv[])
{
  int res{0};
#ifndef DOCTEST_CONFIG_DISABLE
  doctest::Context context;

  context.setOption("no-run", true);

  context.applyCommandLine(argc, argv);

  using namespace std::literals::string_literals;
  auto begin_argv = argv + 1;
  auto end_argv = argv + argc;
  if (end_argv != std::find(begin_argv, end_argv, "--test"s)) {
    context.setOption("no-run", false);
    context.setOption("exit", true);
  }

  res = context.run();
  if (context.shouldExit()) return res;
#endif
  HelloTriangleApplication app;

  try {
    app.run();
  }
  catch (const std::runtime_error& e) {
    std::cerr << e.what() << std::endl;
    return EXIT_FAILURE;
  }

  return EXIT_SUCCESS + res;
}

// vim:set et ts=2 sw=2 sts=2:

Bring doctest code to better doctest 1.1 usage


#include "ReQL-test.hpp"

#include "catch.h"

using namespace ReQL;

TEST_CASE("Connection", "[c++][connect]") {
  Connection conn = connect();

  REQUIRE(conn.isOpen());
}

TEST_CASE("Expr", "[c][expr]") {
  SECTION("string") {
    _ReQL_Op_t string;

    const uint32_t size = 12;

    uint8_t buf[size] = "Hello World";

    std::string orig = std::string((char *)buf, size);

    _reql_string_init(&string, buf, size, size);

    CHECK(orig.compare(0, size, (char *)_reql_string_buf(&string), size) == 0);
    CHECK(size == _reql_string_size(&string));
  }
}

#include "ReQL-test.hpp"

#include "catch.h"

#include <limits>

using namespace ReQL;

TEST_CASE("Connection", "[c++][connect]") {
  Connection conn = connect();

  REQUIRE(conn.isOpen());
}

TEST_CASE("Expr", "[c][expr]") {
  SECTION("number") {
    _ReQL_Op_t num;

    const double val = 42.0;

    _reql_number_init(&num, val);

    CHECK(val == _reql_to_number(&num));
  }
  SECTION("number edges") {
    _ReQL_Op_t num;

    const double val = std::numeric_limits<std::double_t>::max();

    _reql_number_init(&num, val);

    CHECK(val == _reql_to_number(&num));
  }
  SECTION("string") {
    _ReQL_Op_t string;

    const uint32_t size = 12;

    uint8_t buf[size] = "Hello World";

    std::string orig = std::string((char *)buf, size);

    _reql_string_init(&string, buf, size, size);

    CHECK(orig.compare(0, size, (char *)_reql_string_buf(&string), size) == 0);
    CHECK(size == _reql_string_size(&string));
  }
}

Add number c constructor tests.

Add number c constructor tests.


#include <cppunit/BriefTestProgressListener.h>
#include <cppunit/CompilerOutputter.h>
#include <cppunit/extensions/TestFactoryRegistry.h>
#include <cppunit/TestResult.h>
#include <cppunit/TestResultCollector.h>

#include <cppunit/TestRunner.h>

#include "Suite.h"

#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
#define WIN32_LEAN_AND_MEAN
#include "windows.h"

INT WINAPI WinMain( HINSTANCE hInst, HINSTANCE, LPSTR strCmdLine, INT )
#else
int main(int argc, char *argv[])
#endif
{

    setUpSuite();

    // Create the event manager and test controller
    CPPUNIT_NS::TestResult controller;

    // Add a listener that colllects test result
    CPPUNIT_NS::TestResultCollector result;
    controller.addListener( &result );

    // Add a listener that print dots as test run.
    CPPUNIT_NS::BriefTestProgressListener progress;
    controller.addListener( &progress );

    // Add the top suite to the test runner
    CPPUNIT_NS::TestRunner runner;
    runner.addTest( CPPUNIT_NS::TestFactoryRegistry::getRegistry().makeTest() );
    runner.run( controller );

    // Print test in a compiler compatible format.
    CPPUNIT_NS::CompilerOutputter* outputter =
        CPPUNIT_NS::CompilerOutputter::defaultOutputter(&result, std::cout);
    outputter->write();
    delete outputter;

    tearDownSuite();

    return result.wasSuccessful() ? 0 : 1;

}

#include <cppunit/BriefTestProgressListener.h>
#include <cppunit/CompilerOutputter.h>
#include <cppunit/extensions/TestFactoryRegistry.h>
#include <cppunit/TestResult.h>
#include <cppunit/TestResultCollector.h>

#include <cppunit/TestRunner.h>

#include "Suite.h"

#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
#define WIN32_LEAN_AND_MEAN
#include "windows.h"

INT WINAPI WinMain( HINSTANCE hInst, HINSTANCE, LPSTR strCmdLine, INT )
#else
int main(int argc, char *argv[])
#endif
{

    setUpSuite();

    // Create the event manager and test controller
    CPPUNIT_NS::TestResult controller;

    // Add a listener that colllects test result
    CPPUNIT_NS::TestResultCollector result;
    controller.addListener( &result );

    // Add a listener that print dots as test run.
    CPPUNIT_NS::BriefTestProgressListener progress;
    controller.addListener( &progress );

    // Add the top suite to the test runner
    CPPUNIT_NS::TestRunner runner;
    runner.addTest( CPPUNIT_NS::TestFactoryRegistry::getRegistry().makeTest() );
    runner.run( controller );

    // Print test results to a file
	std::ofstream ofile("OgreTestResults.log");

    CPPUNIT_NS::CompilerOutputter* outputter =
        CPPUNIT_NS::CompilerOutputter::defaultOutputter(&result, ofile);
    outputter->write();
    delete outputter;

    tearDownSuite();

    return result.wasSuccessful() ? 0 : 1;

}

Write test results to a file for easier examination


//
//  main.cpp
//  MacGPusher
//
//  Created by Nyxouf on 6/23/13.
//  Copyright (c) 2013 MacGeneration. All rights reserved.
//

#include "global.hpp"
#include "MMGAPNSConnection.hpp"
#include "MMGDevice.hpp"
#include "MMGPayload.hpp"

int main(int argc, const char* argv[])
{
	// Create a device object
	const unsigned int badge = 1;
	MMGDevice device("device-token", badge);

	// Create a payload object
	MMGPayload payload("Push message", device.GetBadge(), "sound.caf", "Slider LABEL");

	// Create the APNS connection
	MMGAPNSConnection connection(MMG_APNS_CA_PATH, MMG_APNS_CERT_PATH, MMG_APNS_PRIVATEKEY_PATH, true);
	// Open the connection
	if (connection.OpenConnection() != MMGConnectionError::MMGNoError)
		return -1;

	// Send the payload
	connection.SendPayloadToDevice(payload, device);

	// Close the connection
	connection.CloseConnection();

	return 0;
}

//
//  main.cpp
//  MacGPusher
//
//  Created by Nyx0uf on 6/23/13.
//  Copyright (c) 2013 MacGeneration. All rights reserved.
//

#include "global.hpp"
#include "MMGAPNSConnection.hpp"
#include "MMGDevice.hpp"
#include "MMGPayload.hpp"

int main(int argc, const char* argv[])
{
	// Create a device object
	const unsigned int badge = 1;
	MMGDevice device("device-token", badge);

	// Create a payload object
	MMGPayload payload("Push message", device.GetBadge(), "sound.caf", "Slider label");

	// Create the APNS connection, empty string if no password for the private key
	MMGAPNSConnection connection(MMG_APNS_CA_PATH, MMG_APNS_CERT_PATH, MMG_APNS_PRIVATEKEY_PATH, "private-key-password", true);
	// Open the connection
	if (connection.OpenConnection() != MMGConnectionError::MMGNoError)
		return -1;

	// Send the payload
	connection.SendPayloadToDevice(payload, device);

	// Close the connection
	connection.CloseConnection();

	return 0;
}

Update example to use private key password


// Copyright (C) 2017 Elviss Strazdins
// This file is part of the Ouzel engine.

#ifdef _WIN32
#define NOMINMAX
#include <winsock2.h>
#else
#include <sys/socket.h>
#include <netinet/in.h>
#include <poll.h>
#endif
#include "Network.hpp"
#include "utils/Log.hpp"

namespace ouzel
{
    namespace network
    {
        Network::Network()
        {
        }

        Network::~Network()
        {
            WSACleanup();
        }

        bool Network::init()
        {
            WORD sockVersion = MAKEWORD(2, 2);
            WSADATA wsaData;
            int error = WSAStartup(sockVersion, &wsaData);
            if (error != 0)
            {
                Log(Log::Level::ERR) << "Failed to start Winsock failed, error: " << error;
                return false;
            }

            if (wsaData.wVersion != sockVersion)
            {
                Log(Log::Level::ERR) << "Incorrect Winsock version";
                WSACleanup();
                return false;
            }

            return true;
        }
    } // namespace network
} // namespace ouzel

// Copyright (C) 2017 Elviss Strazdins
// This file is part of the Ouzel engine.

#ifdef _WIN32
#define NOMINMAX
#include <winsock2.h>
#else
#include <sys/socket.h>
#include <netinet/in.h>
#include <poll.h>
#endif
#include "Network.hpp"
#include "utils/Log.hpp"

namespace ouzel
{
    namespace network
    {
        Network::Network()
        {
        }

        Network::~Network()
        {
            WSACleanup();
        }

        bool Network::init()
        {
#ifdef _WIN32
            WORD sockVersion = MAKEWORD(2, 2);
            WSADATA wsaData;
            int error = WSAStartup(sockVersion, &wsaData);
            if (error != 0)
            {
                Log(Log::Level::ERR) << "Failed to start Winsock failed, error: " << error;
                return false;
            }

            if (wsaData.wVersion != sockVersion)
            {
                Log(Log::Level::ERR) << "Incorrect Winsock version";
                WSACleanup();
                return false;
            }
#endif

            return true;
        }
    } // namespace network
} // namespace ouzel

Initialize Winsock only on Windows

Initialize Winsock only on Windows


#include "Database.h"

#include <iostream>
#include <sqlite3.h>
#include <string>
#include <vector>

using namespace std;

Database::Database(string filename) {
  char filenameCharArray[100];
  strcpy(filenameCharArray, filename.c_str());
  sqlite3_open(filenameCharArray, &db);
}

Database::~Database() { sqlite3_close(db); }

int callback(void *res, int columns, char **data, char **) {
  vector<vector<string>> &results =
      *(static_cast<vector<vector<string>> *>(res));
  vector<string> row;

  for (int i = 0; i < columns; i++) {
    row.push_back(data[i] ? data[i] : "NULL");
    cout << data[i] << " ";
  }

  results.push_back(row);

  return 0;
}

vector<vector<string>> Database::execute(string command) const {
  cout << "Executing command: " << command << endl;
  vector<vector<string>> results;
  sqlite3_exec(db,              /* An open database */
               command.c_str(), /* SQL to be evaluated */
               callback,        /* Callback function */
               &results,        /* 1st argument to callback */
               0                /* Error msg written here */
               );
  return results;
}

#include "Database.h"

#include <iostream>
#include <sqlite3.h>
#include <string>
#include <vector>

using namespace std;

Database::Database(string filename) {
  char filenameCharArray[100];
  strcpy(filenameCharArray, filename.c_str());
  sqlite3_open(filenameCharArray, &db);
}

Database::~Database() { sqlite3_close(db); }

int callback(void *res, int columns, char **data, char **) {
  vector<vector<string>> &results =
      *(static_cast<vector<vector<string>> *>(res));
  vector<string> row;

  for (int i = 0; i < columns; i++) {
    row.push_back(data[i] ? data[i] : "NULL");
    cout << data[i] << ", ";
  }

  results.push_back(row);

  return 0;
}

vector<vector<string>> Database::execute(string command) const {
  cout << "Executing SQL: " << command << endl;
  cout << "Data: ";
  vector<vector<string>> results;
  char *err;
  int status = sqlite3_exec(db,              /* An open database */
                            command.c_str(), /* SQL to be evaluated */
                            callback,        /* Callback function */
                            &results,        /* 1st argument to callback */
                            &err             /* Error msg written here */
                            );

  cout << endl;
  cout << "DB status: " << status;
  if (err) {
    cout << ", Error: " << err;
    sqlite3_free(err);
  }
  cout << endl;

  return results;
}

Add error messages for sqlite

Add error messages for sqlite


#include <QtGui>
#include "mdi_background.h"

void QMdiAreaWBackground::resizeEvent(QResizeEvent *reEvent)
{
        size = reEvent->size();
        resize(size);
        QMdiArea::resizeEvent(reEvent);
}

void QMdiAreaWBackground::resize(QSize& size)
{
        setBackground(i.scaled(size));//,Qt::KeepAspectRatio);
}

void QMdiAreaWBackground::setBackgroundPath(QString& str) {
        i = QImage(str);
        resize(size);
}

QMdiAreaWBackground::QMdiAreaWBackground(QString& str)
{
        i = QImage(str);
}

#include <QtGui>
#include "mdi_background.h"

void QMdiAreaWBackground::resizeEvent(QResizeEvent *reEvent)
{
	size = reEvent->size();
	resize(size);
	QMdiArea::resizeEvent(reEvent);
}

void QMdiAreaWBackground::resize(QSize& size)
{
	/* XXX Conversion of image to the ARGB32 format is placed here because of setBackroung() works on Embox correctly
	 * only if the image is not opaque. I've looked for the method in which Qt determines that image is opaque,
	 * and discovered that ARGB32 format is a workaround for this problem.
	 * Also it is not obviously for me why _opaque_ images is not drawn while not-opaque is drawn... -- Alexander */
	setBackground((i.scaled(size)).convertToFormat(QImage::Format_ARGB32));//,Qt::KeepAspectRatio);
}

void QMdiAreaWBackground::setBackgroundPath(QString& str) {
	i = QImage(str);
	resize(size);
}

QMdiAreaWBackground::QMdiAreaWBackground(QString& str)
{
	i = QImage(str);
}

Change of wallpaper works on vnc

qt: Change of wallpaper works on vnc


#include <cstring>

#include <Bull/Core/Log/Log.hpp>
#include <Bull/Core/Support/Win32/Windows.hpp>

#include <Bull/Core/System/Win32/ClipboardImpl.hpp>

namespace Bull
{
    namespace prv
    {
        void ClipboardImpl::flush()
        {
            if(OpenClipboard(nullptr))
            {
                EmptyClipboard();
            }
        }

        void ClipboardImpl::setContent(const String& content)
        {
            flush();

            if(!OpenClipboard(nullptr))
            {
                Log::getInstance()->error("Failed to open clipboard");
            }

            std::size_t size = (content.getSize() + 1) * sizeof(char);
            HANDLE handler = GlobalAlloc(CF_UNICODETEXT, size);

            if(handler)
            {
                std::memcpy(GlobalLock(handler), content.getBuffer(), size);
                GlobalUnlock(handler);
                SetClipboardData(CF_UNICODETEXT, handler);
            }

            CloseClipboard();
        }

        String ClipboardImpl::getContent()
        {
            String text;
            HANDLE clipboard;

            if(!OpenClipboard(nullptr))
            {
                Log::getInstance()->error("Failed to open clipboard");

                return text;
            }

            clipboard = GetClipboardData(CF_UNICODETEXT);

            if(clipboard)
            {
                Log::getInstance()->error("Failed to open clipboard");

                CloseClipboard();

                return text;
            }

            text = String(static_cast<const char*>(GlobalLock(clipboard)));
            GlobalUnlock(clipboard);

            CloseClipboard();

            return text;
        }
    }
}

#include <cstring>

#include <Bull/Core/Exception/Throw.hpp>
#include <Bull/Core/Support/Win32/Win32Error.hpp>
#include <Bull/Core/Support/Win32/Windows.hpp>
#include <Bull/Core/System/Win32/ClipboardImpl.hpp>

namespace Bull
{
    namespace prv
    {
        void ClipboardImpl::flush()
        {
            if(OpenClipboard(nullptr))
            {
                EmptyClipboard();
            }
        }

        void ClipboardImpl::setContent(const String& content)
        {
            flush();

            if(!OpenClipboard(nullptr))
            {
                Throw(Win32Error, "ClipboardImpl::setContent", "Failed to open clipboard");
            }

            std::size_t size = (content.getSize() + 1) * sizeof(char);
            HANDLE handler = GlobalAlloc(CF_UNICODETEXT, size);

            if(handler)
            {
                std::memcpy(GlobalLock(handler), content.getBuffer(), size);
                GlobalUnlock(handler);
                SetClipboardData(CF_UNICODETEXT, handler);
            }

            CloseClipboard();
        }

        String ClipboardImpl::getContent()
        {
            String text;
            HANDLE clipboard;

            if(!OpenClipboard(nullptr))
            {
                Throw(Win32Error, "ClipboardImpl::getContent", "Failed to open clipboard");
            }

            clipboard = GetClipboardData(CF_UNICODETEXT);

            if(clipboard)
            {
                Throw(Win32Error, "ClipboardImpl::getContent", "Failed to get clipboard content");
            }

            text = String(static_cast<const char*>(GlobalLock(clipboard)));
            GlobalUnlock(clipboard);

            CloseClipboard();

            return text;
        }
    }
}

[Core/Clipboard] Throw Win32Error in case of failure instead of just writing the log


//=======================================================================
// Copyright Baptiste Wicht 2013-2014.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
//  http://www.boost.org/LICENSE_1_0.txt)
//=======================================================================

typedef unsigned int uint8_t __attribute__((__mode__(__QI__)));
typedef unsigned int uint16_t __attribute__ ((__mode__ (__HI__)));
typedef unsigned int uint32_t __attribute__ ((__mode__ (__SI__)));
typedef unsigned int uint64_t __attribute__ ((__mode__ (__DI__)));

uint8_t make_color(uint8_t fg, uint8_t bg){
    return fg | bg << 4;
}

uint16_t make_vga_entry(char c, uint8_t color){
    uint16_t c16 = c;
    uint16_t color16 = color;
    return c16 | color16 << 8;
}

int main(){
    uint16_t* vga_buffer = reinterpret_cast<uint16_t*>(0x0B8000);

    vga_buffer[10 * 80 + 40] = make_vga_entry('1', make_color(15, 0));

    return 0;
}

Modify one to use system call

Modify one to use system call


#define BOOST_TEST_MODULE Gridcoin Test Suite
#include <boost/test/unit_test.hpp>

#include "db.h"
#include "main.h"
#include "wallet.h"

CWallet* pwalletMain;
CClientUIInterface uiInterface;

extern bool fPrintToConsole;
extern void noui_connect();

struct TestingSetup {
    TestingSetup() {
        fPrintToDebugger = true; // don't want to write to debug.log file
        noui_connect();
        bitdb.MakeMock();
        LoadBlockIndex(true);
        bool fFirstRun;
        pwalletMain = new CWallet("wallet.dat");
        pwalletMain->LoadWallet(fFirstRun);
        RegisterWallet(pwalletMain);
    }
    ~TestingSetup()
    {
        delete pwalletMain;
        pwalletMain = NULL;
        bitdb.Flush(true);
    }
};

BOOST_GLOBAL_FIXTURE(TestingSetup);

void Shutdown(void* parg)
{
  exit(0);
}

void StartShutdown()
{
  exit(0);
}

#define BOOST_TEST_MODULE Gridcoin Test Suite
#include <boost/test/unit_test.hpp>

#include "db.h"
#include "main.h"
#include "wallet.h"

CWallet* pwalletMain;
CClientUIInterface uiInterface;

extern bool fPrintToConsole;
extern void noui_connect();

struct TestingSetup {
    TestingSetup() {
        fPrintToDebugger = true; // don't want to write to debug.log file
        fUseFastIndex = true; // Don't verify block hashes when loading
        noui_connect();
        bitdb.MakeMock();
        LoadBlockIndex(true);
        bool fFirstRun;
        pwalletMain = new CWallet("wallet.dat");
        pwalletMain->LoadWallet(fFirstRun);
        RegisterWallet(pwalletMain);
    }
    ~TestingSetup()
    {
        delete pwalletMain;
        pwalletMain = NULL;
        bitdb.Flush(true);
    }
};

BOOST_GLOBAL_FIXTURE(TestingSetup);

void Shutdown(void* parg)
{
  exit(0);
}

void StartShutdown()
{
  exit(0);
}

Use fast block indices for faster test runner loading.


#include <Arduino.h>

//TODO(edcoyne): remove this when it is present upstream.
// Currently this is needed to use std::string on Arduino.
namespace std{
void __throw_out_of_range(const char* str) {
    panic();
}
}

#include <Arduino.h>

//TODO(edcoyne): remove this when it is present upstream.
// Currently this is needed to use std::string on Arduino.
namespace std{
void __attribute__((weak)) __throw_out_of_range(const char* str) {
    panic();
}
}

Change function to weak declaration

Change function to weak declaration


#include <omp.h>

#include "proctor/detector.h"
#include "proctor/proctor.h"
#include "proctor/scanning_model_source.h"

using pcl::proctor::Detector;
//using pcl::proctor::ProctorMPI;
using pcl::proctor::Proctor;
using pcl::proctor::ScanningModelSource;

Detector detector;
Proctor proctor;

int main(int argc, char **argv) {
  unsigned int model_seed = 2;
  unsigned int test_seed = 0; //time(NULL);
  if (argc >= 2) model_seed = atoi(argv[1]);
  if (argc >= 3) test_seed = atoi(argv[2]);

  ScanningModelSource model_source("Princeton", "/home/justin/Documents/benchmark/db");
  model_source.loadModels();

  //detector.enableVisualization();
  proctor.setModelSource(&model_source);
  proctor.train(detector);
  proctor.test(detector, test_seed);
  proctor.printResults(detector);

  while (true) {}

  return 0;
}

#include <omp.h>

#include "proctor/detector.h"
#include "proctor/proctor.h"
#include "proctor/scanning_model_source.h"

using pcl::proctor::Detector;
//using pcl::proctor::ProctorMPI;
using pcl::proctor::Proctor;
using pcl::proctor::ScanningModelSource;

Detector detector;
Proctor proctor;

int main(int argc, char **argv) {
  unsigned int model_seed = 2;
  unsigned int test_seed = 0; //time(NULL);
  if (argc >= 2) model_seed = atoi(argv[1]);
  if (argc >= 3) test_seed = atoi(argv[2]);

  ScanningModelSource model_source("Princeton", "/home/justin/Documents/benchmark/db");
  model_source.loadModels();

  //detector.enableVisualization();
  proctor.setModelSource(&model_source);
  proctor.train(detector);
  proctor.test(detector, test_seed);
  proctor.printResults(detector);

  sleep(100000);

  return 0;
}

Use sleep instead of a busy-wait while loop to retain the output.

git-svn-id: 5398946ba177a3e438c2dae55e2cdfc2fb96c905@3867 a9d63959-f2ad-4865-b262-bf0e56cfafb6


/******************************************************************************

  nomlib - C++11 cross-platform game engine

Copyright (c) 2013, Jeffrey Carpenter <jeffrey.carp@gmail.com>
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this
   list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
   this list of conditions and the following disclaimer in the documentation
   and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

******************************************************************************/

// This file is auto-generated by CMake at build time
#include "nomlib/version.hpp"

const std::string NOMLIB_INSTALL_PREFIX = "/Users/jeff/Library/Frameworks";
const std::string NOMLIB_BUNDLE_IDENTIFIER = "org.i8degrees.nomlib";

/******************************************************************************

  nomlib - C++11 cross-platform game engine

Copyright (c) 2013, Jeffrey Carpenter <jeffrey.carp@gmail.com>
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this
   list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
   this list of conditions and the following disclaimer in the documentation
   and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

******************************************************************************/

// This file is auto-generated by CMake at build time
#include "nomlib/version.hpp"

#if defined (NOM_PLATFORM_WINDOWS)
  const std::string NOMLIB_INSTALL_PREFIX = "C:/";
#endif

const std::string NOMLIB_BUNDLE_IDENTIFIER = "org.i8degrees.nomlib";

Add conditional preprocessor for nomlib's install prefix under Windows


#include <emscripten/bind.h>

#include "libcellml/logger.h"

using namespace emscripten;

EMSCRIPTEN_BINDINGS(libcellml_logger) {

    class_<libcellml::Logger>("Logger")
        .function("addIssue", &libcellml::Logger::addIssue)
        .function("removeAllIssues", &libcellml::Logger::removeAllIssues)
        .function("error", &libcellml::Logger::error)
        .function("warning", &libcellml::Logger::warning)
        .function("hint", &libcellml::Logger::hint)
    ;
}

#include <emscripten/bind.h>

#include "libcellml/logger.h"

using namespace emscripten;

EMSCRIPTEN_BINDINGS(libcellml_logger) {

    class_<libcellml::Logger>("Logger")
        .function("addIssue", &libcellml::Logger::addIssue)
        .function("removeAllIssues", &libcellml::Logger::removeAllIssues)
        .function("error", &libcellml::Logger::error)
        .function("warning", &libcellml::Logger::warning)
        .function("hint", &libcellml::Logger::hint)
        .function("issueCount", &libcellml::Logger::issueCount)
        .function("errorCount", &libcellml::Logger::errorCount)
        .function("warningCount", &libcellml::Logger::warningCount)
        .function("hintCount", &libcellml::Logger::hintCount)
    ;
}

Add missing API from Javascript bindings Logger class.


// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "base/command_line.h"
#include "chrome/browser/extensions/extension_apitest.h"
#include "chrome/common/chrome_switches.h"

#if defined(TOOLKIT_VIEWS) || defined(OS_MACOSX)
#define MAYBE_Infobars Infobars
#else
// Need to finish port to Linux. See http://crbug.com/39916 for details.
#define MAYBE_Infobars DISABLED_Infobars
#endif

IN_PROC_BROWSER_TEST_F(ExtensionApiTest, MAYBE_Infobars) {
  // TODO(finnur): Remove once infobars are no longer experimental (bug 39511).
  CommandLine::ForCurrentProcess()->AppendSwitch(
      switches::kEnableExperimentalExtensionApis);

  ASSERT_TRUE(RunExtensionTest("infobars")) << message_;
}

// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "base/command_line.h"
#include "chrome/browser/extensions/extension_apitest.h"
#include "chrome/common/chrome_switches.h"

#if defined(TOOLKIT_VIEWS)
#define MAYBE_Infobars Infobars
#else
// Need to finish port to Linux. See http://crbug.com/39916 for details.
// Also disabled on mac.  See http://crbug.com/60990.
#define MAYBE_Infobars DISABLED_Infobars
#endif

IN_PROC_BROWSER_TEST_F(ExtensionApiTest, MAYBE_Infobars) {
  // TODO(finnur): Remove once infobars are no longer experimental (bug 39511).
  CommandLine::ForCurrentProcess()->AppendSwitch(
      switches::kEnableExperimentalExtensionApis);

  ASSERT_TRUE(RunExtensionTest("infobars")) << message_;
}

Disable ExtensionApiTest.Infobars on Mac, as it is flaky.

BUG=60990
TEST=ExtensionApiTest.Infobars
Review URL: http://codereview.chromium.org/6798005

git-svn-id: dd90618784b6a4b323ea0c23a071cb1c9e6f2ac7@80553 4ff67af0-8c30-449e-8e8b-ad334ec8d88c


#include <gtest/gtest.h>

#ifndef NDEBUG
#define NDEBUG
#endif
#define SM_ALWAYS_ASSERT
#include <sm/assert_macros.hpp>

TEST(SmCommonTestSuite,testAssertMacrosAlwaysAssert)
{
  SM_DEFINE_EXCEPTION(Exception, std::runtime_error);
  EXPECT_THROW( SM_ASSERT_TRUE_DBG(Exception, false, ""), Exception);
}

#include <gtest/gtest.h>

#ifndef NDEBUG
#define NDEBUG
#endif
#ifndef SM_ALWAYS_ASSERT
#define SM_ALWAYS_ASSERT
#endif
#include <sm/assert_macros.hpp>

TEST(SmCommonTestSuite,testAssertMacrosAlwaysAssert)
{
  SM_DEFINE_EXCEPTION(Exception, std::runtime_error);
  EXPECT_THROW( SM_ASSERT_TRUE_DBG(Exception, false, ""), Exception);
}

Add another guard against multiple definition


/**
 * Appcelerator Titanium Mobile
 * Copyright (c) 2009-2012 by Appcelerator, Inc. All Rights Reserved.
 * Licensed under the terms of the Apache Public License
 * Please see the LICENSE included with this distribution for details.
 */

#include "NativeLabelObject.h"
#include <bb/cascades/Color>
#include <QColor>

NativeLabelObject::NativeLabelObject(TiObject* tiObject)
    : NativeAbstractTextControlObject(tiObject, N_TYPE_LABEL)
{
    label_ = NULL;
}

NativeLabelObject::~NativeLabelObject()
{
}

NativeLabelObject* NativeLabelObject::createLabel(TiObject* tiObject)
{
    return new NativeLabelObject(tiObject);
}

NATIVE_TYPE NativeLabelObject::getObjectType() const
{
    return N_TYPE_LABEL;
}

int NativeLabelObject::initialize()
{
    label_ = bb::cascades::Label::create();
    setTextControl(label_);
    // TODO: Set label layout here
    return NATIVE_ERROR_OK;
}

int NativeLabelObject::setWordWrap(TiObject* obj)
{
	bool multilined;
    getBoolean(obj, &multilined);

	label_->setMultiline(multilined);
    return NATIVE_ERROR_OK;
}

/**
 * Appcelerator Titanium Mobile
 * Copyright (c) 2009-2012 by Appcelerator, Inc. All Rights Reserved.
 * Licensed under the terms of the Apache Public License
 * Please see the LICENSE included with this distribution for details.
 */

#include "NativeLabelObject.h"
#include <bb/cascades/Color>
#include <QColor>

NativeLabelObject::NativeLabelObject(TiObject* tiObject)
    : NativeAbstractTextControlObject(tiObject, N_TYPE_LABEL)
{
    label_ = NULL;
}

NativeLabelObject::~NativeLabelObject()
{
}

NativeLabelObject* NativeLabelObject::createLabel(TiObject* tiObject)
{
    return new NativeLabelObject(tiObject);
}

NATIVE_TYPE NativeLabelObject::getObjectType() const
{
    return N_TYPE_LABEL;
}

int NativeLabelObject::initialize()
{
    label_ = bb::cascades::Label::create();
	label_->setMultiline(true);
    setTextControl(label_);
    // TODO: Set label layout here
    return NATIVE_ERROR_OK;
}

int NativeLabelObject::setWordWrap(TiObject* obj)
{
	bool multilined;
    getBoolean(obj, &multilined);

	label_->setMultiline(multilined);
    return NATIVE_ERROR_OK;
}

Set multiline on labels default

[TIMOB-14131] Set multiline on labels default


// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "chrome/browser/browser_process.h"

#include "chrome/browser/printing/print_job_manager.h"
#include "ui/base/l10n/l10n_util.h"

BrowserProcess* g_browser_process = NULL;

BrowserProcess::BrowserProcess() {
  g_browser_process = this;

  print_job_manager_.reset(new printing::PrintJobManager);
}

BrowserProcess::~BrowserProcess() {
  g_browser_process = NULL;
}

std::string BrowserProcess::GetApplicationLocale() {
  return l10n_util::GetApplicationLocale("");
}

printing::PrintJobManager* BrowserProcess::print_job_manager() {
  return print_job_manager_.get();
}

// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "chrome/browser/browser_process.h"

#include "chrome/browser/printing/print_job_manager.h"
#include "ui/base/l10n/l10n_util.h"

BrowserProcess* g_browser_process = NULL;

BrowserProcess::BrowserProcess()
    : print_job_manager_(new printing::PrintJobManager) {
  g_browser_process = this;
}

BrowserProcess::~BrowserProcess() {
  g_browser_process = NULL;
}

std::string BrowserProcess::GetApplicationLocale() {
  return l10n_util::GetApplicationLocale("");
}

printing::PrintJobManager* BrowserProcess::print_job_manager() {
  return print_job_manager_.get();
}

Reorder BrowserProcess constructor to avoid invalid memory


#include <algorithm>

#include "env.hh"
#include "parse_args.hh"
#include "consumer.hh"

using namespace std;
using namespace boost::filesystem;

int main(int argc, char** argv) {
    argc--;
    argv++;

    vector<path> files;
    string playlist;
    parse_args(argc, argv, files, playlist);

    Consumer consumer(std::move(playlist));
    for (auto& file : files) {
        consumer.consume(std::move(file));
    }
}

#include <algorithm>

#include "env.hh"
#include "parse_args.hh"
#include "consumer.hh"

using namespace std;
using namespace boost::filesystem;

int main(int argc, char** argv) {
    argc--;
    argv++;

    vector<path> files;
    string playlist;
    parse_args(argc, argv, files, playlist);

    Consumer consumer(std::move(playlist));
    for (const auto& file : files) {
        consumer.consume(file);
    }
}

Revert "Move each `file` into the `Consumer::consume` method."

This reverts commit 5a9c22010bef1772dfd0efd379822582c3d3b9b0.

Undo so previous edit works correctly


#include "perf_precomp.hpp"

using namespace std;
using namespace cv;
using namespace perf;

typedef TestBaseWithParam< pair<string, string> > ImagePair;

pair<string, string> impair(const char* im1, const char* im2)
{
    return make_pair(string(im1), string(im2));
}

PERF_TEST_P(ImagePair, OpticalFlowDual_TVL1, testing::Values(impair("cv/optflow/RubberWhale1.png", "cv/optflow/RubberWhale2.png")))
{
    declare.time(40);

    Mat frame1 = imread(getDataPath(GetParam().first), IMREAD_GRAYSCALE);
    Mat frame2 = imread(getDataPath(GetParam().second), IMREAD_GRAYSCALE);
    ASSERT_FALSE(frame1.empty());
    ASSERT_FALSE(frame2.empty());

    Mat flow;

    OpticalFlowDual_TVL1 tvl1;

    TEST_CYCLE()
    {
        tvl1(frame1, frame2, flow);
    }

    SANITY_CHECK(flow, 0.02);
}

#include "perf_precomp.hpp"

using namespace std;
using namespace cv;
using namespace perf;

typedef TestBaseWithParam< pair<string, string> > ImagePair;

pair<string, string> impair(const char* im1, const char* im2)
{
    return make_pair(string(im1), string(im2));
}

PERF_TEST_P(ImagePair, OpticalFlowDual_TVL1, testing::Values(impair("cv/optflow/RubberWhale1.png", "cv/optflow/RubberWhale2.png")))
{
    declare.time(40);

    Mat frame1 = imread(getDataPath(GetParam().first), IMREAD_GRAYSCALE);
    Mat frame2 = imread(getDataPath(GetParam().second), IMREAD_GRAYSCALE);
    ASSERT_FALSE(frame1.empty());
    ASSERT_FALSE(frame2.empty());

    Mat flow;

    OpticalFlowDual_TVL1 tvl1;

    TEST_CYCLE()
    {
        tvl1(frame1, frame2, flow);
    }

    SANITY_CHECK(flow, 0.5);
}

Set sanity threshold for TVL1 optical flow to 0.5


#include "bitfield.h"
#include "canutil_lpc17xx.h"
#include "canutil.h"
#include "canwrite.h"
#include "log.h"
#include <stdbool.h>

void copyToMessageBuffer(uint64_t source, uint8_t* a, uint8_t* b) {
    for(int i = 0, j = 4; i < 3 && j < 8; i++, j++) {
        a[i] = nthByte(source, i);
        b[i] = nthByte(source, j);
    }
}

bool sendCanMessage(CanBus* bus, CanMessage request) {
    CAN_MSG_Type message;
    message.id =  request.id;
    message.len = 8;
    message.type = DATA_FRAME;
    message.format = STD_ID_FORMAT;
    copyToMessageBuffer(request.data, message.dataA, message.dataB);

    return CAN_SendMsg(CAN_CONTROLLER(bus), &message) == SUCCESS;
}

#include "bitfield.h"
#include "canutil_lpc17xx.h"
#include "canutil.h"
#include "canwrite.h"
#include "log.h"
#include <stdbool.h>

void copyToMessageBuffer(uint64_t source, uint8_t* a, uint8_t* b) {
    for(int i = 0, j = 4; i < 4 && j < 8; i++, j++) {
        a[3 - i] = nthByte(source, j);
        b[3 - i] = nthByte(source, i);
    }
}

bool sendCanMessage(CanBus* bus, CanMessage request) {
    CAN_MSG_Type message;
    message.id =  request.id;
    message.len = 8;
    message.type = DATA_FRAME;
    message.format = STD_ID_FORMAT;
    copyToMessageBuffer(request.data, message.dataA, message.dataB);

    return CAN_SendMsg(CAN_CONTROLLER(bus), &message) == SUCCESS;
}

Fix byte order when writing CAN messages on LPC17xx.

Fixed #87.


// RUN: %clang_cc1 -fsyntax-only -Wconditional-uninitialized -fsyntax-only %s -verify

class Foo {
public:
  Foo();
  ~Foo();
  operator bool();
};

int bar();
int baz();
int init(double *);

// This case flags a false positive under -Wconditional-uninitialized because
// the destructor in Foo fouls about the minor bit of path-sensitivity in
// -Wuninitialized.
double test() {
  double x; // expected-note {{variable 'x' is declared here}} expected-note{{add initialization to silence this warning}}
  if (bar() || baz() || Foo() || init(&x)) {
    return x; // expected-warning {{variable 'x' is possibly uninitialized when used here}}
  }
  return 1.0;
}

// RUN: %clang_cc1 -fsyntax-only -Wconditional-uninitialized -fsyntax-only %s -verify

class Foo {
public:
  Foo();
  ~Foo();
  operator bool();
};

int bar();
int baz();
int init(double *);

// This case flags a false positive under -Wconditional-uninitialized because
// the destructor in Foo fouls about the minor bit of path-sensitivity in
// -Wuninitialized.
double test() {
  double x; // expected-note {{variable 'x' is declared here}} expected-note{{add initialization to silence this warning}}
  if (bar() || baz() || Foo() || init(&x))
    return 1.0;

  return x; // expected-warning {{variable 'x' is possibly uninitialized when used here}}
}

Fix test to test the right thing.

Fix test to test the right thing.

git-svn-id: ffe668792ed300d6c2daa1f6eba2e0aa28d7ec6c@127803 91177308-0d34-0410-b5e6-96231b3b80d8


#include <QApplication>

#include "mainwindow.h"

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);

    MainWindow w;
    w.show();

    return a.exec();
}

#include <QApplication>

#include "mainwindow.h"

int main(int argc, char *argv[])
{
    QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);

    QApplication a(argc, argv);

    MainWindow w;
    w.show();

    return a.exec();
}

Enable HiDPI for the demo app.

Enable HiDPI for the demo app.


// RUN: %clang_cc1 -triple=x86_64-apple-darwin -fsyntax-only -verify %s
//
// Ensure that when we use builtins in C++ code with templates that compute the
// valid immediate, the dead code with the invalid immediate doesn't error.

typedef short __v8hi __attribute__((__vector_size__(16)));

template <int Imm>
__v8hi test(__v8hi a) {
    if (Imm < 4)
      return __builtin_ia32_pshuflw(a, 0x55 * Imm);
    else
      return __builtin_ia32_pshuflw(a, 0x55 * (Imm - 4));
}

template __v8hi test<0>(__v8hi);
template __v8hi test<1>(__v8hi);
template __v8hi test<2>(__v8hi);
template __v8hi test<3>(__v8hi);
template __v8hi test<4>(__v8hi);
template __v8hi test<5>(__v8hi);
template __v8hi test<6>(__v8hi);
template __v8hi test<7>(__v8hi);

// RUN: %clang_cc1 -triple=x86_64-apple-darwin -fsyntax-only -verify %s
//
// Ensure that when we use builtins in C++ code with templates that compute the
// valid immediate, the dead code with the invalid immediate doesn't error.
// expected-no-diagnostics

typedef short __v8hi __attribute__((__vector_size__(16)));

template <int Imm>
__v8hi test(__v8hi a) {
    if (Imm < 4)
      return __builtin_ia32_pshuflw(a, 0x55 * Imm);
    else
      return __builtin_ia32_pshuflw(a, 0x55 * (Imm - 4));
}

template __v8hi test<0>(__v8hi);
template __v8hi test<1>(__v8hi);
template __v8hi test<2>(__v8hi);
template __v8hi test<3>(__v8hi);
template __v8hi test<4>(__v8hi);
template __v8hi test<5>(__v8hi);
template __v8hi test<6>(__v8hi);
template __v8hi test<7>(__v8hi);

[x86] Fix a tiny bug in my test case in r335309 by marking that we don't
expect any diagnostics.

git-svn-id: ffe668792ed300d6c2daa1f6eba2e0aa28d7ec6c@335310 91177308-0d34-0410-b5e6-96231b3b80d8


// RUN: %clang_cc1 -fsyntax-only -verify %s

class Base { };
class Derived1 : public Base { };
class Derived2 : public Base { };

void f0(volatile Base *b, Derived1 *d1, const Derived2 *d2) {
  if (b > d1)
    return;
  if (d1 <= b)
    return;
  if (b > d2)
    return;
  if (d1 >= d2) // expected-error{{comparison of distinct}}
    return;
}

void f1(volatile Base *b, Derived1 *d1, const Derived2 *d2) {
  if (b == d1)
    return;
  if (d1 == b)
    return;
  if (b != d2)
    return;
  if (d1 == d2) // expected-error{{comparison of distinct}}
    return;
}

// PR4691
int ptrcmp1(void *a, int *b) {
  return a < b;
}
int ptrcmp2(long *a, int *b) {
  return a < b; // expected-error{{distinct}}
}

// PR5509 - Multi-level pointers
int f2() {
  typedef int *IntPtr;
  typedef IntPtr *IntPtrPtr;
  typedef IntPtr const *IntPtrConstPtr;
  IntPtrConstPtr i = 0;
  IntPtrPtr j = 0;
  return i != j;
}

// PR5763
typedef double Matrix4[4][4];

bool f(Matrix4 m1, const Matrix4 m2) {
  return m1 != m2;
}

Add test case from PR5763

Add test case from PR5763

git-svn-id: ffe668792ed300d6c2daa1f6eba2e0aa28d7ec6c@93190 91177308-0d34-0410-b5e6-96231b3b80d8


#include <Halide.h>
#include <stdio.h>

using namespace Halide;

int main(int argc, char **argv) {
    Func f;
    Var x;

    ImageParam input(Float(32), 1);

    f(x) = input(cast<int>(round(0.3f * ceil(0.4f * floor(x * 22.5f)))));

    f.infer_input_bounds(10);

    Image<float> in = input.get();

    int correct = roundf(0.3f * ceilf(0.4f * floorf(9 * 22.5f))) + 1;
    if (in.width() != correct) {
        printf("Width is %d instead of %d\n", in.width(), correct);
        return -1;
    }

    printf("Success!\n");
    return 0;
}

#include <Halide.h>
#include <stdio.h>

using namespace Halide;

int main(int argc, char **argv) {
    Func f;
    Var x;

    ImageParam input(Float(32), 1);

    f(x) = input(cast<int>(ceil(0.3f * ceil(0.4f * floor(x * 22.5f)))));

    f.infer_input_bounds(10);

    Image<float> in = input.get();

    int correct = 26;
    if (in.width() != correct) {
        printf("Width is %d instead of %d\n", in.width(), correct);
        return -1;
    }

    printf("Success!\n");
    return 0;
}

Remove roundf from test because windows

Remove roundf from test because windows


#define CATCH_CONFIG_RUNNER
#include <catch.hpp>
#include <iostream>
#include <mipp.h>

int main(int argc, char* argv[])
{
	std::cout << "MIPP tests" << std::endl;
	std::cout << "----------" << std::endl << std::endl;

	std::cout << "Instr. type:       " << mipp::InstructionType                  << std::endl;
	std::cout << "Instr. full type:  " << mipp::InstructionFullType              << std::endl;
	std::cout << "Instr. version:    " << mipp::InstructionVersion               << std::endl;
	std::cout << "Instr. size:       " << mipp::RegisterSizeBit       << " bits" << std::endl;
	std::cout << "Instr. lanes:      " << mipp::Lanes                            << std::endl;
	std::cout << "64-bit support:    " << (mipp::Support64Bit    ? "yes" : "no") << std::endl;
	std::cout << "Byte/word support: " << (mipp::SupportByteWord ? "yes" : "no") << std::endl;
	std::cout << std::endl;

	int result = Catch::Session().run(argc, argv);

	return result;
}

#define CATCH_CONFIG_RUNNER
#include <catch.hpp>
#include <iostream>
#include <mipp.h>

int main(int argc, char* argv[])
{
	std::cout << "MIPP tests" << std::endl;
	std::cout << "----------" << std::endl << std::endl;

	std::cout << "Instr. type:       " << mipp::InstructionType                  << std::endl;
	std::cout << "Instr. full type:  " << mipp::InstructionFullType              << std::endl;
	std::cout << "Instr. version:    " << mipp::InstructionVersion               << std::endl;
	std::cout << "Instr. size:       " << mipp::RegisterSizeBit       << " bits" << std::endl;
	std::cout << "Instr. lanes:      " << mipp::Lanes                            << std::endl;
	std::cout << "64-bit support:    " << (mipp::Support64Bit    ? "yes" : "no") << std::endl;
	std::cout << "Byte/word support: " << (mipp::SupportByteWord ? "yes" : "no") << std::endl;
	auto ext = mipp::InstructionExtensions();
	if (ext.size() > 0)
	{
		std::cout << "Instr. extensions: {";
		for (auto i = 0; i < (int)ext.size(); i++)
			std::cout << ext[i] << (i < ((int)ext.size() -1) ? ", " : "");
		std::cout << "}" << std::endl;
	}
	std::cout << std::endl;

	int result = Catch::Session().run(argc, argv);

	return result;
}

Put back the extensions display.

Put back the extensions display.


// Copyright (c) 2013, Zeex
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice,
//    this list of conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright notice,
//    this list of conditions and the following disclaimer in the documentation
//    and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.

#include <ctime>
#include <iostream>
#include <vector>
#include "statistics_writer.h"

namespace amx_profiler {

StatisticsWriter::StatisticsWriter()
	: print_date_(false)
{
}

} // namespace amx_profiler

// Copyright (c) 2013, Zeex
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice,
//    this list of conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright notice,
//    this list of conditions and the following disclaimer in the documentation
//    and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.

#include <ctime>
#include <iostream>
#include <vector>
#include "statistics_writer.h"

namespace amx_profiler {

StatisticsWriter::StatisticsWriter()
	: stream_(0)
	, print_date_(false)
	, print_run_time_(false)
{
}

} // namespace amx_profiler

Fix members of StatisticsWriter not being initialized


// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include <vespa/vespalib/testkit/test_kit.h>

using namespace vespalib;

void testDebug() {
    TEST_DEBUG("lhs.out", "rhs.out");
    EXPECT_EQUAL("a\n"
               "b\n"
               "c\n",

               "a\n"
               "b\n"
               "c\n"
               "d\n");
    EXPECT_EQUAL("a\n"
               "d\n"
               "b\n"
               "c\n",

               "a\n"
               "b\n"
               "c\n"
               "d\n");
    EXPECT_EQUAL(1, 2);
    EXPECT_EQUAL("foo", "bar");
}

TEST_MAIN() {
    testDebug();
}

// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include <vespa/vespalib/testkit/test_kit.h>

using namespace vespalib;

void testDebug() {
    TEST_DEBUG("lhs.out", "rhs.out");
    EXPECT_EQUAL(string("a\n"
                        "b\n"
                        "c\n"),

                string("a\n"
                       "b\n"
                       "c\n"
                       "d\n"));
    EXPECT_EQUAL(string("a\n"
                        "d\n"
                        "b\n"
                        "c\n"),

                 string("a\n"
                        "b\n"
                        "c\n"
                        "d\n"));
    EXPECT_EQUAL(1, 2);
    EXPECT_EQUAL(string("foo"), string("bar"));
}

TEST_MAIN() {
    testDebug();
}

Stop trying to compare arrays (deprecated in C++20)


// Copyright (c) 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "chrome/browser/metrics/variations/variations_request_scheduler.h"

namespace chrome_variations {

namespace {

// Time between seed fetches, in hours.
const int kSeedFetchPeriodHours = 5;

}  // namespace

VariationsRequestScheduler::VariationsRequestScheduler(
    const base::Closure& task) : task_(task) {
}

VariationsRequestScheduler::~VariationsRequestScheduler() {
}

void VariationsRequestScheduler::Start() {
  // Call the task and repeat it periodically.
  task_.Run();
  timer_.Start(FROM_HERE, base::TimeDelta::FromHours(kSeedFetchPeriodHours),
               task_);
}

void VariationsRequestScheduler::Reset() {
  if (timer_.IsRunning())
    timer_.Reset();
}

base::Closure VariationsRequestScheduler::task() const {
  return task_;
}

#if !defined(OS_ANDROID)
// static
VariationsRequestScheduler* VariationsRequestScheduler::Create(
    const base::Closure& task,
    PrefService* local_state) {
  return new VariationsRequestScheduler(task);
}
#endif  // !defined(OS_ANDROID)

}  // namespace chrome_variations

// Copyright (c) 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "chrome/browser/metrics/variations/variations_request_scheduler.h"

namespace chrome_variations {

namespace {

// Time between seed fetches, in hours.
const int kSeedFetchPeriodHours = 5;

}  // namespace

VariationsRequestScheduler::VariationsRequestScheduler(
    const base::Closure& task) : task_(task) {
}

VariationsRequestScheduler::~VariationsRequestScheduler() {
}

void VariationsRequestScheduler::Start() {
  // Call the task and repeat it periodically.
  task_.Run();
  timer_.Start(FROM_HERE, base::TimeDelta::FromHours(kSeedFetchPeriodHours),
               task_);
}

void VariationsRequestScheduler::Reset() {
  if (timer_.IsRunning())
    timer_.Reset();
}

base::Closure VariationsRequestScheduler::task() const {
  return task_;
}

#if !defined(OS_ANDROID) && !defined(OS_IOS)
// static
VariationsRequestScheduler* VariationsRequestScheduler::Create(
    const base::Closure& task,
    PrefService* local_state) {
  return new VariationsRequestScheduler(task);
}
#endif  // !defined(OS_ANDROID) && !defined(OS_IOS)

}  // namespace chrome_variations

Use the correct VariationsRequestScheduler on iOS.

We were missing an ifdef iOS and for some reason
the iOS build wasn't failing due to multiple
Create() functions existing.

This change ensures that VariationsRequestSchedulerMobile
(already being compiled on iOS) gets used.

BUG=248262

Review URL: https://chromiumcodereview.appspot.com/15981012

git-svn-id: de016e52bd170d2d4f2344f9bf92d50478b649e0@205539 0039d316-1c4b-4281-b951-d872f2087c98


// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/WebKit/WebKit/chromium/public/WebView.h"
#include "webkit/tools/test_shell/test_shell_test.h"

using WebKit::WebView;

class WebViewTest : public TestShellTest {
};

TEST_F(WebViewTest, GetContentAsPlainText) {
  WebView* view = test_shell_->webView();
  ASSERT_TRUE(view != 0);

  view->setIsActive(true);
  EXPECT_TRUE(view->isActive());

  view->setIsActive(false);
  EXPECT_FALSE(view->isActive());

  view->setIsActive(true);
  EXPECT_TRUE(view->isActive());
}

// TODO(viettrungluu): add more tests

// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/WebKit/WebKit/chromium/public/WebView.h"
#include "webkit/tools/test_shell/test_shell_test.h"

using WebKit::WebView;

class WebViewTest : public TestShellTest {
};

TEST_F(WebViewTest, ActiveState) {
  WebView* view = test_shell_->webView();
  ASSERT_TRUE(view != 0);

  view->setIsActive(true);
  EXPECT_TRUE(view->isActive());

  view->setIsActive(false);
  EXPECT_FALSE(view->isActive());

  view->setIsActive(true);
  EXPECT_TRUE(view->isActive());
}

// TODO(viettrungluu): add more tests

Rename unit test: WebViewTest.GetContentAsPlainText -> WebViewTest.ActiveState.

I'm responsible for misnaming it in the first place (cut-and-paste error). Oops.

BUG=23501
TEST=none

Review URL: http://codereview.chromium.org/414034

git-svn-id: de016e52bd170d2d4f2344f9bf92d50478b649e0@32612 0039d316-1c4b-4281-b951-d872f2087c98


// RUN: c-index-test -test-load-source all -c %s -fsyntax-only -target x86_64-apple-darwin9 -fcoroutines-ts -std=c++1z -I%S/../SemaCXX/Inputs | FileCheck %s
#include "std-coroutine.h"

using std::experimental::suspend_always;
using std::experimental::suspend_never;

struct promise_void {
  void get_return_object();
  suspend_always initial_suspend();
  suspend_always final_suspend();
  void return_void();
  void unhandled_exception();
};

template <>
struct std::experimental::coroutine_traits<void> { using promise_type = promise_void; };

void CoroutineTestRet() {
  co_return;
}
// CHECK: [[@LINE-3]]:25: UnexposedStmt=
// CHECK-SAME: [[@LINE-4]]:25 - [[@LINE-2]]:2]
// CHECK: [[@LINE-4]]:5: UnexposedStmt=
// CHECK-SAME: [[@LINE-5]]:5 - [[@LINE-5]]:14]

// RUN: c-index-test -test-load-source all -c %s -fsyntax-only -target x86_64-apple-darwin9 -fcoroutines-ts -std=c++1z -I%S/../SemaCXX/Inputs | FileCheck %s
#include "std-coroutine.h"

using std::experimental::suspend_always;
using std::experimental::suspend_never;

struct promise_void {
  void get_return_object();
  suspend_always initial_suspend();
  suspend_always final_suspend();
  void return_void();
  void unhandled_exception();
};

template <>
struct std::experimental::coroutine_traits<void> { using promise_type = promise_void; };

void CoroutineTestRet() {
  co_return;
}
// CHECK: [[@LINE-3]]:25: UnexposedStmt=
// CHECK-SAME: [[@LINE-4]]:25 - [[@LINE-2]]:2]
// CHECK: [[@LINE-4]]:3: UnexposedStmt=
// CHECK-SAME: [[@LINE-5]]:3 - [[@LINE-5]]:12]

Fix incorrect column numbers in test from r350282.

After the test was reformatted using clang-format the numbers became invalid.

git-svn-id: ffe668792ed300d6c2daa1f6eba2e0aa28d7ec6c@350283 91177308-0d34-0410-b5e6-96231b3b80d8


#include "main_state.hpp"
#include "system_movement.hpp"
#include "system_draw.hpp"
#include "entityx/entityx.h"
#include <SDL2/SDL.h>

MainState::MainState(Game *game) : m_game(game) {}

MainState::~MainState(){}

int MainState::init() {
	m_systems.add<MovementSystem>();
	m_systems.add<DrawSystem>(m_game);
    return 0;
}

void MainState::update(double dt) {
    SDL_Event e;
    while (SDL_PollEvent(&e)) {
        if (e.type == SDL_QUIT) {
            m_game->shutdown();
        }
        if (e.type == SDL_KEYDOWN) {
            if(e.key.keysym.sym == SDLK_ESCAPE) {
                m_game->shutdown();
            }
        }
    }

    SDL_SetRenderDrawColor(m_game->get_renderer(), 0, 100, 200, 255);
    SDL_RenderClear(m_game->get_renderer());
    SDL_RenderPresent(m_game->get_renderer());

    m_systems.update<MovementSystem>(dt);
    m_systems.update<DrawSystem>(dt);
}

#include "main_state.hpp"
#include "system_movement.hpp"
#include "system_draw.hpp"
#include "entityx/entityx.h"
#include <SDL2/SDL.h>

MainState::MainState(Game *game) : m_game(game) {}

MainState::~MainState(){}

int MainState::init() {
	m_systems.add<MovementSystem>();
	m_systems.add<DrawSystem>(m_game);
    m_systems.configure();
    return 0;
}

void MainState::update(double dt) {
    SDL_Event e;
    while (SDL_PollEvent(&e)) {
        if (e.type == SDL_QUIT) {
            m_game->shutdown();
        }
        if (e.type == SDL_KEYDOWN) {
            if(e.key.keysym.sym == SDLK_ESCAPE) {
                m_game->shutdown();
            }
        }
    }

    SDL_SetRenderDrawColor(m_game->get_renderer(), 0, 100, 200, 255);
    SDL_RenderClear(m_game->get_renderer());
    SDL_RenderPresent(m_game->get_renderer());

    m_systems.update<MovementSystem>(dt);
    m_systems.update<DrawSystem>(dt);
}

Configure entityx systems after init

Configure entityx systems after init


///////////////////////////////////////////////////////////////////////
// File:        dotproduct.h
// Description: Native dot product function.
//
// (C) Copyright 2018, Google Inc.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
///////////////////////////////////////////////////////////////////////

#include "dotproduct.h"

namespace tesseract {

// Computes and returns the dot product of the two n-vectors u and v.
double DotProductNative(const double *u, const double *v, int n) {
  double total = 0.0;
#if defined(OPENMP_SIMD)
#pragma omp simd reduction(+:total)
#endif
  for (int k = 0; k < n; ++k) {
    total += u[k] * v[k];
  }
  return total;
}

} // namespace tesseract

///////////////////////////////////////////////////////////////////////
// File:        dotproduct.h
// Description: Native dot product function.
//
// (C) Copyright 2018, Google Inc.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
///////////////////////////////////////////////////////////////////////

#include "dotproduct.h"

namespace tesseract {

// Computes and returns the dot product of the two n-vectors u and v.
double DotProductNative(const double *u, const double *v, int n) {
  double total = 0.0;
#if defined(OPENMP_SIMD) || defined(_OPENMP)
#pragma omp simd reduction(+:total)
#endif
  for (int k = 0; k < n; ++k) {
    total += u[k] * v[k];
  }
  return total;
}

} // namespace tesseract

Enable pragma for SIMD also when _OPENMP is defined

Signed-off-by: Stefan Weil <8d4c780fcfdc41841e5070f4c43da8958ba6aec0@weilnetz.de>


// This is the starting point
//
#include <iostream>

int main() {
    std::string greeting("Welcome to RGrep-CPP");
    std::cout << greeting << std::endl;
    std::string firstInputString;
    std::string secondInputString;

    std::cout << "Enter the first string" << std::endl;
    std::cin >> firstInputString;
    std::cout << "Enter the second string" << std::endl;
    std::cin >> secondInputString;

    if (firstInputString == secondInputString) {
        std::cout << "Match!" << std::endl;

    }

    return 0;
}

// This is the starting point
//
#include <iostream>
#include <fstream>
#include <sstream>

int main() {
    std::string greeting("Welcome to RGrep-CPP");
    std::cout << greeting << std::endl;
    std::string firstInputString;
    std::string secondInputString;

    std::cout << "Enter the first string" << std::endl;
    std::cin >> firstInputString;
    std::cout << "Enter the second string" << std::endl;
    std::cin >> secondInputString;

    if (firstInputString == secondInputString) {
        std::cout << "Match!" << std::endl;
    }

    std::string fileName;
    std::cout << "Enter a filename in which to look for the string" << std::endl;
    std::cin >> fileName;

    std::ifstream fileInputStream(fileName);
    std::string line;
    if (fileInputStream.is_open()) {
        std::cout << "Successfully opened " << fileName << std::endl;
        while(true) {
            if (fileInputStream.fail()) {
                std::cout << "The file input stream went into an error state" << std::endl;
                break;
            }
            getline(fileInputStream, line);
            std::cout << line << std::endl;
            if (firstInputString == line) {
                std::cout << "Match!" << std::endl;
            }
        }
    } else {
        std::cout << "Could not open file for reading" << std::endl;
    }

    return 0;
}

Add funtionality to match in files

Add funtionality to match in files


//===- llvm/System/Darwin/Path.cpp - Linux Path Implementation --*- C++ -*-===//
//
//                     The LLVM Compiler Infrastructure
//
// This file was developed by Reid Spencer and is distributed under the
// University of Illinois Open Source License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file provides the Darwin specific implementation of the Path class.
//
//===----------------------------------------------------------------------===//

//===----------------------------------------------------------------------===//
//=== WARNING: Implementation here must contain only Darwin specific code
//===          and must not be generic UNIX code (see ../Unix/Path.cpp)
//===----------------------------------------------------------------------===//

// Include the generic unix implementation
#include "../Unix/Path.cpp"

namespace llvm {
using namespace sys;

bool
Path::is_valid() const {
  if (path.empty())
    return false;
  if (path.length() >= MAXPATHLEN)
    return false;
  return true;
}

Path
Path::GetTemporaryDirectory() {
  char pathname[MAXPATHLEN];
  strcpy(pathname,"/tmp/llvm_XXXXXX");
  if (0 == mkdtemp(pathname))
    ThrowErrno(std::string(pathname) + ": Can't create temporary directory");
  Path result;
  result.set_directory(pathname);
  assert(result.is_valid() && "mkdtemp didn't create a valid pathname!");
  return result;
}

std::string
Path::GetDLLSuffix() {
  return "dyld";
}

}

// vim: sw=2 smartindent smarttab tw=80 autoindent expandtab

//===- llvm/System/Darwin/Path.cpp - Linux Path Implementation --*- C++ -*-===//
//
//                     The LLVM Compiler Infrastructure
//
// This file was developed by Reid Spencer and is distributed under the
// University of Illinois Open Source License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file provides the Darwin specific implementation of the Path class.
//
//===----------------------------------------------------------------------===//

//===----------------------------------------------------------------------===//
//=== WARNING: Implementation here must contain only Darwin specific code
//===          and must not be generic UNIX code (see ../Unix/Path.cpp)
//===----------------------------------------------------------------------===//

// Include the generic unix implementation
#include "../Unix/Path.cpp"

namespace llvm {
using namespace sys;

bool
Path::is_valid() const {
  if (path.empty())
    return false;
  if (path.length() >= MAXPATHLEN)
    return false;
  return true;
}

Path
Path::GetTemporaryDirectory() {
  char pathname[MAXPATHLEN];
  strcpy(pathname,"/tmp/llvm_XXXXXX");
  if (0 == mkdtemp(pathname))
    ThrowErrno(std::string(pathname) + ": Can't create temporary directory");
  Path result;
  result.set_directory(pathname);
  assert(result.is_valid() && "mkdtemp didn't create a valid pathname!");
  return result;
}

std::string
Path::GetDLLSuffix() {
  return "dylib";
}

}

// vim: sw=2 smartindent smarttab tw=80 autoindent expandtab

Correct the dynamic lib suffix on Darwin.

git-svn-id: 0ff597fd157e6f4fc38580e8d64ab130330d2411@16293 91177308-0d34-0410-b5e6-96231b3b80d8


/*
 * DialogPassword.cpp
 *
 *  Created on: 01.01.2017
 *      Author: felix
 */

#include <QtWidgets/QHBoxLayout>
#include <QtWidgets/QLabel>
#include <QtWidgets/QVBoxLayout>
#include <frontend/DialogPassword.h>

namespace Flix {

DialogPassword::DialogPassword(QWidget *parent, Qt::WindowFlags flags):
    QDialog(parent, flags)
{
    setWindowTitle(tr("Password dialog"));
    initLayout();
}

DialogPassword::~DialogPassword()
{
}

QString DialogPassword::getPassword(void) const
{
    return editPassword->text();
}

void DialogPassword::initLayout(void)
{
    QVBoxLayout* layout = new QVBoxLayout(this);

    layout->addWidget(new QLabel(tr("Please enter the password") + ":"));

    editPassword = new QLineEdit();
    editPassword->setEchoMode(QLineEdit::EchoMode::Password);
    layout->addWidget(editPassword);

    QHBoxLayout* layoutDialogButtons = new QHBoxLayout();
    buttonOk = new QPushButton(tr("OK"));
    connect(buttonOk, SIGNAL(clicked()), this, SLOT(accept()));
    layoutDialogButtons->addWidget(buttonOk);
    buttonCancel = new QPushButton(tr("Cancel"));
    connect(buttonCancel, SIGNAL(clicked()), this, SLOT(reject()));
    layoutDialogButtons->addWidget(buttonCancel);

    layout->addLayout(layoutDialogButtons);
}

} /* namespace Flix */

/*
 * DialogPassword.cpp
 *
 *  Created on: 01.01.2017
 *      Author: felix
 */

#include <QtWidgets/QHBoxLayout>
#include <QtWidgets/QLabel>
#include <QtWidgets/QVBoxLayout>
#include <frontend/DialogPassword.h>

namespace Flix {

DialogPassword::DialogPassword(QWidget *parent, Qt::WindowFlags flags):
    QDialog(parent, flags)
{
    setWindowTitle(tr("Password dialog"));
    initLayout();
}

DialogPassword::~DialogPassword()
{
}

QString DialogPassword::getPassword(void) const
{
    return editPassword->text();
}

void DialogPassword::initLayout(void)
{
    QVBoxLayout* layout = new QVBoxLayout(this);

    layout->addWidget(new QLabel(tr("Please enter the password") + ":"));

    editPassword = new QLineEdit();
    editPassword->setEchoMode(QLineEdit::EchoMode::Password);
    layout->addWidget(editPassword);

    QHBoxLayout* layoutDialogButtons = new QHBoxLayout();
    buttonOk = new QPushButton(tr("OK"));
    connect(buttonOk, SIGNAL(clicked()), this, SLOT(accept()));
    layoutDialogButtons->addWidget(buttonOk);
    buttonCancel = new QPushButton(tr("Cancel"));
    connect(buttonCancel, SIGNAL(clicked()), this, SLOT(reject()));
    layoutDialogButtons->addWidget(buttonCancel);

    layout->addLayout(layoutDialogButtons);

    editPassword->setFocus();
}

} /* namespace Flix */

Enforce focus for the line edit.

Enforce focus for the line edit.


// RUN: %clang_cc1 -std=c++11 -verify %s

using size_t = decltype(sizeof(int));
void operator "" wibble(const char *); // expected-warning {{user-defined literal suffixes not starting with '_' are reserved; no literal will invoke this operator}}
void operator "" wibble(const char *, size_t); // expected-warning {{user-defined literal suffixes not starting with '_' are reserved; no literal will invoke this operator}}

template<typename T>
void f() {
  // A program containing a reserved ud-suffix is ill-formed.
  // FIXME: Reject these for the right reason.
  123wibble; // expected-error {{suffix 'wibble'}}
  123.0wibble; // expected-error {{suffix 'wibble'}}
  const char *p = ""wibble; // expected-error {{invalid suffix on literal; C++11 requires a space between literal and identifier}} expected-error {{expected ';'}}
  const char *q = R"x("hello")x"wibble; // expected-error {{invalid suffix on literal; C++11 requires a space between literal and identifier}} expected-error {{expected ';'}}
}

// RUN: %clang_cc1 -std=c++11 -verify %s

using size_t = decltype(sizeof(int));
void operator "" wibble(const char *); // expected-warning {{user-defined literal suffixes not starting with '_' are reserved; no literal will invoke this operator}}
void operator "" wibble(const char *, size_t); // expected-warning {{user-defined literal suffixes not starting with '_' are reserved; no literal will invoke this operator}}

template<typename T>
void f() {
  // A program containing a reserved ud-suffix is ill-formed.
  123wibble; // expected-error {{invalid suffix 'wibble'}}
  123.0wibble; // expected-error {{invalid suffix 'wibble'}}
  const char *p = ""wibble; // expected-error {{invalid suffix on literal; C++11 requires a space between literal and identifier}} expected-error {{expected ';'}}
  const char *q = R"x("hello")x"wibble; // expected-error {{invalid suffix on literal; C++11 requires a space between literal and identifier}} expected-error {{expected ';'}}
}

Remove a test FIXME for a case which is already fixed.

git-svn-id: ffe668792ed300d6c2daa1f6eba2e0aa28d7ec6c@152349 91177308-0d34-0410-b5e6-96231b3b80d8


/*
 * Copyright 2011 Google Inc.
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

struct GrGLInterface;

const GrGLInterface* GrGLDefaultInterface() {
    return NULL;
}

/*
 * Copyright 2011 Google Inc.
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

#include "GrGLInterface.h"

const GrGLInterface* GrGLDefaultInterface() {
    return NULL;
}

Include GrGLInterface.h instead of forward declaring, since we have to get NULL defined anyway.