Skip to content

Commit

Permalink
Merged master:9ed681f9261 into amd-gfx:999cf270203
Browse files Browse the repository at this point in the history
Local branch amd-gfx 999cf27 Merged master:a38396939c5 into amd-gfx:763ce7cebd8
Remote branch master 9ed681f gn build: Merge 6d5c273
  • Loading branch information
Sw authored and Sw committed Dec 9, 2019
2 parents 999cf27 + 9ed681f commit 8980a78
Show file tree
Hide file tree
Showing 61 changed files with 1,699 additions and 203 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -407,8 +407,8 @@ TEST(SemanticHighlighting, GetsCorrectTokens) {
}
)cpp",
R"cpp(
template<typename $TemplateParameter[[T]],
void (T::*$TemplateParameter[[method]])(int)>
template<typename $TemplateParameter[[T]],
void ($TemplateParameter[[T]]::*$TemplateParameter[[method]])(int)>
struct $Class[[G]] {
void $Method[[foo]](
$TemplateParameter[[T]] *$Parameter[[O]]) {
Expand Down
6 changes: 4 additions & 2 deletions clang/include/clang/AST/RecursiveASTVisitor.h
Original file line number Diff line number Diff line change
Expand Up @@ -1162,11 +1162,13 @@ DEF_TRAVERSE_TYPELOC(LValueReferenceType,
DEF_TRAVERSE_TYPELOC(RValueReferenceType,
{ TRY_TO(TraverseTypeLoc(TL.getPointeeLoc())); })

// FIXME: location of base class?
// We traverse this in the type case as well, but how is it not reached through
// the pointee type?
DEF_TRAVERSE_TYPELOC(MemberPointerType, {
TRY_TO(TraverseType(QualType(TL.getTypePtr()->getClass(), 0)));
if (auto *TSI = TL.getClassTInfo())
TRY_TO(TraverseTypeLoc(TSI->getTypeLoc()));
else
TRY_TO(TraverseType(QualType(TL.getTypePtr()->getClass(), 0)));
TRY_TO(TraverseTypeLoc(TL.getPointeeLoc()));
})

Expand Down
1 change: 1 addition & 0 deletions clang/unittests/Tooling/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ add_clang_unittest(ToolingTests
RecursiveASTVisitorTests/LambdaDefaultCapture.cpp
RecursiveASTVisitorTests/LambdaExpr.cpp
RecursiveASTVisitorTests/LambdaTemplateParams.cpp
RecursiveASTVisitorTests/MemberPointerTypeLoc.cpp
RecursiveASTVisitorTests/NestedNameSpecifiers.cpp
RecursiveASTVisitorTests/ParenExpr.cpp
RecursiveASTVisitorTests/TemplateArgumentLocTraverser.cpp
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
//===- unittest/Tooling/RecursiveASTVisitorTests/MemberPointerTypeLoc.cpp -===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#include "TestVisitor.h"

using namespace clang;

namespace {

class MemberPointerTypeLocVisitor
: public ExpectedLocationVisitor<MemberPointerTypeLocVisitor> {
public:
bool VisitTemplateTypeParmTypeLoc(TemplateTypeParmTypeLoc TL) {
if (!TL)
return true;
Match(TL.getDecl()->getName(), TL.getNameLoc());
return true;
}
bool VisitRecordTypeLoc(RecordTypeLoc RTL) {
if (!RTL)
return true;
Match(RTL.getDecl()->getName(), RTL.getNameLoc());
return true;
}
};

TEST(RecursiveASTVisitor, VisitTypeLocInMemberPointerTypeLoc) {
MemberPointerTypeLocVisitor Visitor;
Visitor.ExpectMatch("Bar", 4, 36);
Visitor.ExpectMatch("T", 7, 23);
EXPECT_TRUE(Visitor.runOver(R"cpp(
class Bar { void func(int); };
class Foo {
void bind(const char*, void(Bar::*Foo)(int)) {}
template<typename T>
void test(void(T::*Foo)());
};
)cpp"));
}

TEST(RecursiveASTVisitor, NoCrash) {
MemberPointerTypeLocVisitor Visitor;
EXPECT_FALSE(Visitor.runOver(R"cpp(
// MemberPointerTypeLoc.getClassTInfo() is null.
class a(b(a::*)) class
)cpp"));
}

} // end anonymous namespace
25 changes: 24 additions & 1 deletion compiler-rt/lib/profile/GCDAProfiling.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,27 @@ typedef unsigned long long uint64_t;
#include "InstrProfiling.h"
#include "InstrProfilingUtil.h"

/* #define DEBUG_GCDAPROFILING */
#ifndef _WIN32
#include <pthread.h>
pthread_mutex_t gcov_flush_mutex = PTHREAD_MUTEX_INITIALIZER;
static __inline void gcov_flush_lock() {
pthread_mutex_lock(&gcov_flush_mutex);
}
static __inline void gcov_flush_unlock() {
pthread_mutex_unlock(&gcov_flush_mutex);
}
#else
#include <windows.h>
static SRWLOCK gcov_flush_mutex = SRWLOCK_INIT;
static __inline void gcov_flush_lock() {
AcquireSRWLockExclusive(&gcov_flush_mutex);
}
static __inline void gcov_flush_unlock() {
ReleaseSRWLockExclusive(&gcov_flush_mutex);
}
#endif

/* #define DEBUG_GCDAPROFILING */
/*
* --- GCOV file format I/O primitives ---
*/
Expand Down Expand Up @@ -620,12 +639,16 @@ void llvm_register_flush_function(fn_ptr fn) {
}

void __gcov_flush() {
gcov_flush_lock();

struct fn_node* curr = flush_fn_list.head;

while (curr) {
curr->fn();
curr = curr->next;
}

gcov_flush_unlock();
}

COMPILER_RT_VISIBILITY
Expand Down
2 changes: 2 additions & 0 deletions lldb/include/lldb/Symbol/ClangASTContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -644,6 +644,8 @@ class ClangASTContext : public TypeSystem {
CompilerType
GetRValueReferenceType(lldb::opaque_compiler_type_t type) override;

CompilerType GetAtomicType(lldb::opaque_compiler_type_t type) override;

CompilerType AddConstModifier(lldb::opaque_compiler_type_t type) override;

CompilerType AddVolatileModifier(lldb::opaque_compiler_type_t type) override;
Expand Down
5 changes: 5 additions & 0 deletions lldb/include/lldb/Symbol/CompilerType.h
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,11 @@ class CompilerType {
// an invalid type.
CompilerType AddVolatileModifier() const;

// Return a new CompilerType that is the atomic type of this type. If this
// type is not valid or the type system doesn't support atomic types, this
// returns an invalid type.
CompilerType GetAtomicType() const;

// Return a new CompilerType adds a restrict modifier to this type if this
// type is valid and the type system supports restrict modifiers, else return
// an invalid type.
Expand Down
4 changes: 3 additions & 1 deletion lldb/include/lldb/Symbol/Type.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,9 @@ class Type : public std::enable_shared_from_this<Type>, public UserID {
eEncodingIsLValueReferenceUID, ///< This type is L value reference to a type
/// whose UID is m_encoding_uid
eEncodingIsRValueReferenceUID, ///< This type is R value reference to a type
/// whose UID is m_encoding_uid
/// whose UID is m_encoding_uid,
eEncodingIsAtomicUID, ///< This type is the type whose UID is
/// m_encoding_uid as an atomic type.
eEncodingIsSyntheticUID
};

Expand Down
2 changes: 2 additions & 0 deletions lldb/include/lldb/Symbol/TypeSystem.h
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,8 @@ class TypeSystem : public PluginInterface {
virtual CompilerType
GetRValueReferenceType(lldb::opaque_compiler_type_t type);

virtual CompilerType GetAtomicType(lldb::opaque_compiler_type_t type);

virtual CompilerType AddConstModifier(lldb::opaque_compiler_type_t type);

virtual CompilerType AddVolatileModifier(lldb::opaque_compiler_type_t type);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
CXX_SOURCES := main.cpp
include Makefile.rules
Loading

0 comments on commit 8980a78

Please sign in to comment.