Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
80 commits
Select commit Hold shift + click to select a range
a429dfc
[Driver][SPIR-V] Use consistent tools to convert between text and bin…
sarnex Jan 9, 2025
762f1b1
[HLSL] Make fast math the default for HLSL (#119820)
spall Jan 9, 2025
17912f3
LAA: refactor dependence class to prep for scaled strides (NFC) (#122…
artagnon Jan 9, 2025
fb03ce7
[libc++] Fix test for vector data_const.pass.cpp (#122085)
2LoS Jan 9, 2025
d056c75
[mlir][scf] Fix unrolling when the yielded value is defined above the…
pifon2a Jan 9, 2025
5e6c74d
[clang] Fix SPIR-V OpenMP test assembler check (#122310)
sarnex Jan 9, 2025
473510a
[libc++] Fix mi-mode in GDB pretty printers (#120951)
AngryLoki Jan 9, 2025
7724be9
[mlir][spirv] Do SPIR-V serialization in -test-vulkan-runner-pipeline…
andfau-amd Jan 9, 2025
89499c6
[BoundsChecking][test] Reorder RUN lines (#122229)
vitalybuka Jan 9, 2025
a7cbd41
[BoundsChecking][test] Remove duplicate RUNS
vitalybuka Jan 9, 2025
e2449f1
[SelectionDAG] Use SDNode::op_iterator instead of SDNodeIterator. NFC…
topperc Jan 9, 2025
c87ef14
[InstCombine][NFC] Precommit a test for folding a binary op of reduct…
mgudim Jan 9, 2025
f8f8598
[Exegesis] Add the ability to dry-run the measurement phase (#121991)
mshockwave Jan 9, 2025
be32621
[OpenACC] Implement 'device' and 'host' clauses for 'update'
erichkeane Jan 9, 2025
553fa20
[OpenACC] Implement 'at least one of' restriction for 'update'
erichkeane Jan 9, 2025
8ac6a6b
Reorder fields so InitDeferredFlag is destroyed last
d0k Jan 9, 2025
43e663d
[APINotes] [NFC] Add tests for SWIFT_RETURNS_(UN)RETAINED for ObjC AP…
fahadnayyar Jan 9, 2025
50ca2ef
Drop emitQuaternaryBuiltin from clang (#122169)
rampitec Jan 9, 2025
69b54c1
[libcxx][algorithm] Optimize std::stable_sort via radix sort algorith…
izvolov Jan 9, 2025
0e1c5bf
[gn build] Port 69b54c1a05c0
llvmgnsyncbot Jan 9, 2025
a6b7181
[HLSL] Move length support out of the DirectX Backend (#121611)
farzonl Jan 9, 2025
b6cda33
[Loads] Also consider getPointerAlignment when checking assumptions. …
fhahn Jan 9, 2025
6beaa45
[RISCV][VLOPT] Fix VCFCT incompatible EEW test (#122327)
michaelmaitland Jan 9, 2025
cbcb7ad
[mlir][acc] Introduce MappableType interface (#122146)
razvanlupusoru Jan 9, 2025
d514571
[RISCV][VLOPT] Add vfirst and vcpop to getOperandInfo (#122295)
michaelmaitland Jan 9, 2025
8e12037
[flang] Fix finding system install of LLVM/Clang/MLIR in standalone b…
mgorny Jan 9, 2025
3ba46dd
[AMDGPU][True16][MC][NFC] add true16/fake16 test for gfx12 vop3c/3cx …
broxigarchen Jan 9, 2025
222ff18
[AMDGPU][True16][CodeGen] Update codegen pattern for v_med3_f16 (#121…
broxigarchen Jan 9, 2025
031f33c
[RISCV] Add tests for legalization of <N x i128> and <N x i256> shuffles
preames Jan 9, 2025
c036a9a
[RISCV][VLOPT] Add vector single width floating point add subtract in…
michaelmaitland Jan 9, 2025
8beb9d3
[RISCV][VLOPT] Add vector widening floating point add subtract instru…
michaelmaitland Jan 9, 2025
a484fa1
[RISCV][VLOPT] Add floating point multiply divide instructions to get…
michaelmaitland Jan 9, 2025
b419ede
[RISCV][VLOPT] Add widening floating point multiply to isSupportedInstr
michaelmaitland Jan 9, 2025
5f70fea
[RISCV][VLOPT] Add Vector Floating-Point Compare Instructions to getS…
michaelmaitland Jan 9, 2025
ca10dea
[z/OS] Add backtrace support for z/OS. (#121826)
redstar Jan 9, 2025
c123d0c
[HLSL][NFC] Move packoffset validation to separate function and calcu…
hekota Jan 9, 2025
1c99907
[CUDA][HIP] Fix overriding of constexpr virtual function (#121986)
yxsamliu Jan 9, 2025
9ec9287
Revert "[HLSL] Move length support out of the DirectX Backend (#1216…
nico Jan 9, 2025
26aa20a
Use range-based for to iterate over fields in record layout, NFCI (#1…
rnk Jan 9, 2025
5ff3674
[SLP]Fix mask processing for reused gathered scalars
alexey-bataev Jan 9, 2025
1842a3d
Fix a cmake error when using the Xcode generator. (#119403)
paulhuggett Jan 9, 2025
2c6ed5f
[libc++][NFC] Remove trailing whitespace from release notes
ldionne Jan 9, 2025
b16777a
[RISCV] Return MILog2SEW for mask instructions getOperandLog2EEW. NFC…
topperc Jan 9, 2025
876841b
[WebAssembly] Format WebAssembly ReleaseNote entries (#122203)
aheejin Jan 9, 2025
1b897f7
[clang-tidy] Fix misc-unused-parameters on params with attrs (#122286)
emaxx-google Jan 9, 2025
0aa831e
[mlir][GPU] Implement ValueBoundsOpInterface for GPU ID operations (#…
krzysz00 Jan 9, 2025
6312bee
[SandboxVec][BottomUpVec] Use SeedCollector and slice seeds (#120826)
Jan 9, 2025
1739ba9
[OpenMP][FIX] Adjust test to be non-flaky (#122331)
jdoerfert Jan 9, 2025
b57c0ba
[OpenMP] Update atomic helpers to just use headers (#122185)
jhuber6 Jan 9, 2025
f53cb84
[OpenMP] Use __builtin_bit_cast instead of UB type punning (#122325)
jhuber6 Jan 9, 2025
3055e86
[MemProf] Disable cloning of callsites in recursive cycles by default…
teresajohnson Jan 9, 2025
218f15c
Add pre-merge workflow for HLSL testing (#122184)
llvm-beanz Jan 9, 2025
9d5299e
VT/test: pre-commit tests to enable samesign optz (#120257)
artagnon Jan 9, 2025
f791a4f
[bazel] Add missing dependency for cbcb7ad32e6faca1f4c0f2f436e6076774…
d0k Jan 9, 2025
d797d94
[bazel] Port 0aa831e0edb1c1deabb96ce2435667cc82bac79b
d0k Jan 9, 2025
8ea8e7f
[SYCL] Basic diagnostics for the sycl_kernel_entry_point attribute. (…
tahonermann Jan 9, 2025
0acdba8
[libc] Remove leftover 'gpu/' source directory (#122368)
jhuber6 Jan 9, 2025
8408722
[LLD][COFF] Emit base relocation for native CHPE metadata pointer on …
cjacek Jan 9, 2025
e8c8543
[TySan] Intercept malloc_size on Apple platforms. (#122133)
fhahn Jan 9, 2025
d01ae56
Revert "[Exegesis] Add the ability to dry-run the measurement phase (…
mshockwave Jan 9, 2025
f764e71
[Clang][TableGen] Add missing __bf16 type to the builtins parser (#12…
vmustya Jan 9, 2025
c492a22
[libc++] Add missing _LIBCPP_NODEBUG on internal aliases
ldionne Jan 9, 2025
328c3a8
[RISCV][VLOPT] Add vmerge to isSupportedInstr (#122340)
michaelmaitland Jan 9, 2025
03eb786
[SYCL] Correct misplaced sycl_kernel_entry_point attribute in a names…
tahonermann Jan 9, 2025
0efb376
[libc][test] remove C++ stdlib includes (#122369)
nickdesaulniers Jan 9, 2025
4f42e16
[hwasan] Omit tag check for null pointers (#122206)
thurstond Jan 9, 2025
7ffb691
[VPlan] Remove dead ToRemove (NFC).
fhahn Jan 9, 2025
156e605
[lld-macho] Fix branch extension thunk estimation logic (#120529)
alx32 Jan 9, 2025
3caa68a
[libc][test] fix memory leak (#122378)
nickdesaulniers Jan 9, 2025
e6d061a
[libclang/python] Add python bindings for PrintingPolicy (#120494)
efriedma-quic Jan 9, 2025
9426fdd
[libc][test] fix memory leak pt.2 (#122384)
nickdesaulniers Jan 9, 2025
ba704d5
[llvm-gsymutil] Address merged-funcs test non-determinism (#122308)
alx32 Jan 9, 2025
c1c50c7
[SDPatternMatch] Add matchers m_ExtractSubvector and m_InsertSubvecto…
cheezeburglar Jan 9, 2025
504f6ce
[clang-tidy][NFC] clean readability-use-std-min-max (#122288)
HerrCai0907 Jan 9, 2025
a6aa936
[NFC][AsmPrinter] Pass MJTI by const reference instead of const point…
mingmingl-llvm Jan 9, 2025
5d88a84
[RISCV] Simplify some RISCVInstrInfoC classes by removing arguments t…
topperc Jan 9, 2025
24bf0e4
[libc++] Disable _LIBCPP_NODEBUG temporarily (#122393)
philnik777 Jan 10, 2025
04e54cc
[RISCV][VLOPT] Add Vector Single-Width Averaging Add and Subtract to …
michaelmaitland Jan 10, 2025
d0373db
[RISCV][VLOPT] Add vadc to isSupportedInstr (#122345)
michaelmaitland Jan 10, 2025
43802e0
[AutoBump] Merge with d0373dbe (Jan 09)
jorickert Mar 18, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions .github/workflows/hlsl-matrix.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: HLSL Tests

permissions:
contents: read

on:
workflow_dispatch:
pull_request:
branches:
- main
paths:
- llvm/**/DirectX/**
- .github/workflows/hlsl*
- clang/*HLSL*/**/*
- clang/**/*HLSL*
- llvm/**/Frontend/HLSL/**/*

jobs:
HLSL-Tests:
strategy:
fail-fast: false
matrix:
runs-on:
- hlsl-macos

uses: ./.github/workflows/hlsl-test-all.yaml
with:
SKU: hlsl-macos
TestTarget: check-hlsl-clang-mtl # TODO: This target changes based on SKU
LLVM-ref: ${{ github.ref }}
87 changes: 87 additions & 0 deletions .github/workflows/hlsl-test-all.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
name: HLSL Test

permissions:
contents: read

on:
workflow_call:
inputs:
OffloadTest-branch:
description: 'Test Suite Branch'
required: false
default: 'main'
type: string
LLVM-ref:
description: 'LLVM Branch'
required: false
default: 'main'
type: string
SKU:
required: true
type: string
TestTarget:
required: false
default: 'check-hlsl'
type: string

jobs:
build:
runs-on: ${{ inputs.SKU }}
steps:
- name: Checkout DXC
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
repository: Microsoft/DirectXShaderCompiler
ref: main
path: DXC
submodules: true
- name: Checkout LLVM
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
ref: ${{ inputs.LLVM-branch }}
path: llvm-project
- name: Checkout OffloadTest
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
repository: llvm-beanz/offload-test-suite
ref: main
path: OffloadTest
- name: Checkout Golden Images
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
repository: llvm-beanz/offload-golden-images
ref: main
path: golden-images
- name: Setup Windows
if: runner.os == 'Windows'
uses: llvm/actions/setup-windows@main
with:
arch: amd64
- name: Build DXC
run: |
cd DXC
mkdir build
cd build
cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -C ${{ github.workspace }}/DXC/cmake/caches/PredefinedParams.cmake -C ${{ github.workspace }}/OffloadTest/cmake/caches/sccache.cmake -DHLSL_DISABLE_SOURCE_GENERATION=On ${{ github.workspace }}/DXC/
ninja dxv llvm-dis
- name: Build LLVM
run: |
cd llvm-project
mkdir build
cd build
cmake -G Ninja -DDXIL_DIS=${{ github.workspace }}/DXC/build/bin/llvm-dis -DLLVM_INCLUDE_DXIL_TESTS=On -DCMAKE_BUILD_TYPE=Release -C ${{ github.workspace }}/llvm-project/clang/cmake/caches/HLSL.cmake -C ${{ github.workspace }}/OffloadTest/cmake/caches/sccache.cmake -DDXC_DIR=${{ github.workspace }}/DXC/build/bin -DLLVM_EXTERNAL_OFFLOADTEST_SOURCE_DIR=${{ github.workspace }}/OffloadTest -DLLVM_EXTERNAL_PROJECTS="OffloadTest" -DLLVM_LIT_ARGS="--xunit-xml-output=testresults.xunit.xml -v" -DGOLDENIMAGE_DIR=${{ github.workspace }}/golden-images ${{ github.workspace }}/llvm-project/llvm/
ninja hlsl-test-depends llvm-test-depends clang-test-depends
- name: Run HLSL Tests
run: |
cd llvm-project
cd build
ninja check-llvm
ninja check-clang
ninja check-hlsl-unit
ninja ${{ inputs.TestTarget }}
- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action/macos@170bf24d20d201b842d7a52403b73ed297e6645b # v2
if: always() && runner.os == 'macOS'
with:
comment_mode: off
files: llvm-project/build/**/testresults.xunit.xml
19 changes: 19 additions & 0 deletions clang-tools-extra/clang-tidy/misc/UnusedParametersCheck.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,11 @@
#include "UnusedParametersCheck.h"
#include "clang/AST/ASTContext.h"
#include "clang/AST/ASTLambda.h"
#include "clang/AST/Attr.h"
#include "clang/AST/Decl.h"
#include "clang/AST/RecursiveASTVisitor.h"
#include "clang/ASTMatchers/ASTMatchFinder.h"
#include "clang/Basic/SourceManager.h"
#include "clang/Lex/Lexer.h"
#include "llvm/ADT/STLExtras.h"
#include <unordered_map>
Expand All @@ -26,6 +29,17 @@ bool isOverrideMethod(const FunctionDecl *Function) {
return MD->size_overridden_methods() > 0 || MD->hasAttr<OverrideAttr>();
return false;
}

bool hasAttrAfterParam(const SourceManager *SourceManager,
const ParmVarDecl *Param) {
for (const auto *Attr : Param->attrs()) {
if (SourceManager->isBeforeInTranslationUnit(Param->getLocation(),
Attr->getLocation())) {
return true;
}
}
return false;
}
} // namespace

void UnusedParametersCheck::registerMatchers(MatchFinder *Finder) {
Expand Down Expand Up @@ -189,6 +203,11 @@ void UnusedParametersCheck::check(const MatchFinder::MatchResult &Result) {
if (Param->isUsed() || Param->isReferenced() || !Param->getDeclName() ||
Param->hasAttr<UnusedAttr>())
continue;
if (hasAttrAfterParam(Result.SourceManager, Param)) {
// Due to how grammar works, attributes would be wrongly applied to the
// type if we remove the preceding parameter name.
continue;
}

// In non-strict mode ignore function definitions with empty bodies
// (constructor initializer counts for non-empty body).
Expand Down
20 changes: 10 additions & 10 deletions clang-tools-extra/clang-tidy/readability/UseStdMinMaxCheck.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ static bool maxCondition(const BinaryOperator::Opcode Op, const Expr *CondLhs,
return false;
}

QualType getNonTemplateAlias(QualType QT) {
static QualType getNonTemplateAlias(QualType QT) {
while (true) {
// cast to a TypedefType
if (const TypedefType *TT = dyn_cast<TypedefType>(QT)) {
Expand Down Expand Up @@ -92,15 +92,15 @@ static std::string createReplacement(const Expr *CondLhs, const Expr *CondRhs,
const llvm::StringRef AssignLhsStr = Lexer::getSourceText(
Source.getExpansionRange(AssignLhs->getSourceRange()), Source, LO);

clang::QualType GlobalImplicitCastType;
clang::QualType LhsType = CondLhs->getType()
.getCanonicalType()
.getNonReferenceType()
.getUnqualifiedType();
clang::QualType RhsType = CondRhs->getType()
.getCanonicalType()
.getNonReferenceType()
.getUnqualifiedType();
QualType GlobalImplicitCastType;
QualType LhsType = CondLhs->getType()
.getCanonicalType()
.getNonReferenceType()
.getUnqualifiedType();
QualType RhsType = CondRhs->getType()
.getCanonicalType()
.getNonReferenceType()
.getUnqualifiedType();
if (LhsType != RhsType) {
GlobalImplicitCastType = getNonTemplateAlias(BO->getLHS()->getType());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,16 @@ void f(void (*fn)()) {;}
// CHECK-MESSAGES: :[[@LINE-1]]:15: warning: parameter 'fn' is unused [misc-unused-parameters]
// CHECK-FIXES: {{^}}void f(void (* /*fn*/)()) {;}{{$}}

int *k([[clang::lifetimebound]] int *i) {;}
// CHECK-MESSAGES: :[[@LINE-1]]:38: warning: parameter 'i' is unused [misc-unused-parameters]
// CHECK-FIXES: {{^}}int *k({{\[\[clang::lifetimebound\]\]}} int * /*i*/) {;}{{$}}

#define ATTR_BEFORE(x) [[clang::lifetimebound]] x
int* m(ATTR_BEFORE(const int *i)) { return nullptr; }
// CHECK-MESSAGES: :[[@LINE-1]]:31: warning: parameter 'i' is unused [misc-unused-parameters]
// CHECK-FIXES: {{^}}int* m(ATTR_BEFORE(const int * /*i*/)) { return nullptr; }{{$}}
#undef ATTR_BEFORE

// Unchanged cases
// ===============
void f(int i); // Don't remove stuff in declarations
Expand All @@ -42,6 +52,12 @@ void s(int i[1]);
void u(void (*fn)());
void w(int i) { (void)i; } // Don't remove used parameters

// Don't reanchor the attribute to the type:
int *x(int *i [[clang::lifetimebound]]) { return nullptr; }
#define ATTR_AFTER(x) x [[clang::lifetimebound]]
int* y(ATTR_AFTER(const int *i)) { return nullptr; }
#undef ATTR_AFTER

bool useLambda(int (*fn)(int));
static bool static_var = useLambda([] (int a) { return a; });

Expand Down
83 changes: 83 additions & 0 deletions clang/bindings/python/clang/cindex.py
Original file line number Diff line number Diff line change
Expand Up @@ -1770,6 +1770,16 @@ def spelling(self):

return self._spelling

def pretty_printed(self, policy):
"""
Pretty print declarations.
Parameters:
policy -- The policy to control the entities being printed.
"""
return _CXString.from_result(
conf.lib.clang_getCursorPrettyPrinted(self, policy)
)

@property
def displayname(self):
"""
Expand Down Expand Up @@ -3699,6 +3709,72 @@ def write_main_file_to_stdout(self):
conf.lib.clang_CXRewriter_writeMainFileToStdOut(self)


class PrintingPolicyProperty(BaseEnumeration):

"""
A PrintingPolicyProperty identifies a property of a PrintingPolicy.
"""

Indentation = 0
SuppressSpecifiers = 1
SuppressTagKeyword = 2
IncludeTagDefinition = 3
SuppressScope = 4
SuppressUnwrittenScope = 5
SuppressInitializers = 6
ConstantArraySizeAsWritten = 7
AnonymousTagLocations = 8
SuppressStrongLifetime = 9
SuppressLifetimeQualifiers = 10
SuppressTemplateArgsInCXXConstructors = 11
Bool = 12
Restrict = 13
Alignof = 14
UnderscoreAlignof = 15
UseVoidForZeroParams = 16
TerseOutput = 17
PolishForDeclaration = 18
Half = 19
MSWChar = 20
IncludeNewlines = 21
MSVCFormatting = 22
ConstantsAsWritten = 23
SuppressImplicitBase = 24
FullyQualifiedName = 25


class PrintingPolicy(ClangObject):
"""
The PrintingPolicy is a wrapper class around clang::PrintingPolicy

It allows specifying how declarations, expressions, and types should be
pretty-printed.
"""

@staticmethod
def create(cursor):
"""
Creates a new PrintingPolicy
Parameters:
cursor -- Any cursor for a translation unit.
"""
return PrintingPolicy(conf.lib.clang_getCursorPrintingPolicy(cursor))

def __init__(self, ptr):
ClangObject.__init__(self, ptr)

def __del__(self):
conf.lib.clang_PrintingPolicy_dispose(self)

def get_property(self, property):
"""Get a property value for the given printing policy."""
return conf.lib.clang_PrintingPolicy_getProperty(self, property.value)

def set_property(self, property, value):
"""Set a property value for the given printing policy."""
conf.lib.clang_PrintingPolicy_setProperty(self, property.value, value)


# Now comes the plumbing to hook up the C library.

# Register callback types
Expand Down Expand Up @@ -3801,6 +3877,8 @@ def write_main_file_to_stdout(self):
("clang_getCursorExtent", [Cursor], SourceRange),
("clang_getCursorLexicalParent", [Cursor], Cursor),
("clang_getCursorLocation", [Cursor], SourceLocation),
("clang_getCursorPrettyPrinted", [Cursor, PrintingPolicy], _CXString),
("clang_getCursorPrintingPolicy", [Cursor], c_object_p),
("clang_getCursorReferenced", [Cursor], Cursor),
("clang_getCursorReferenceNameRange", [Cursor, c_uint, c_uint], SourceRange),
("clang_getCursorResultType", [Cursor], Type),
Expand Down Expand Up @@ -3924,6 +4002,9 @@ def write_main_file_to_stdout(self):
("clang_Cursor_isAnonymousRecordDecl", [Cursor], bool),
("clang_Cursor_isBitField", [Cursor], bool),
("clang_Location_isInSystemHeader", [SourceLocation], bool),
("clang_PrintingPolicy_dispose", [PrintingPolicy]),
("clang_PrintingPolicy_getProperty", [PrintingPolicy, c_int], c_uint),
("clang_PrintingPolicy_setProperty", [PrintingPolicy, c_int, c_uint]),
("clang_Type_getAlignOf", [Type], c_longlong),
("clang_Type_getClassType", [Type], Type),
("clang_Type_getNumTemplateArguments", [Type], c_int),
Expand Down Expand Up @@ -4104,6 +4185,8 @@ def function_exists(self, name: str) -> bool:
"FixIt",
"Index",
"LinkageKind",
"PrintingPolicy",
"PrintingPolicyProperty",
"RefQualifierKind",
"SourceLocation",
"SourceRange",
Expand Down
14 changes: 14 additions & 0 deletions clang/bindings/python/tests/cindex/test_cursor.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
BinaryOperator,
Config,
CursorKind,
PrintingPolicy,
PrintingPolicyProperty,
StorageClass,
TemplateArgumentKind,
TranslationUnit,
Expand Down Expand Up @@ -981,3 +983,15 @@ def test_from_result_null(self):
def test_from_cursor_result_null(self):
tu = get_tu("")
self.assertEqual(tu.cursor.semantic_parent, None)

def test_pretty_print(self):
tu = get_tu("struct X { int x; }; void f(bool x) { }", lang="cpp")
f = get_cursor(tu, "f")

self.assertEqual(f.displayname, "f(bool)")
pp = PrintingPolicy.create(f)
self.assertEqual(pp.get_property(PrintingPolicyProperty.Bool), True)
self.assertEqual(f.pretty_printed(pp), "void f(bool x) {\n}\n")
pp.set_property(PrintingPolicyProperty.Bool, False)
self.assertEqual(pp.get_property(PrintingPolicyProperty.Bool), False)
self.assertEqual(f.pretty_printed(pp), "void f(_Bool x) {\n}\n")
7 changes: 4 additions & 3 deletions clang/cmake/modules/AddClang.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -109,13 +109,14 @@ macro(add_clang_library name)
llvm_add_library(${name} ${LIBTYPE} ${ARG_UNPARSED_ARGUMENTS} ${srcs})

if(MSVC AND NOT CLANG_LINK_CLANG_DYLIB)
# Make sure all consumers also turn off visibility macros so there not trying to dllimport symbols.
# Make sure all consumers also turn off visibility macros so they're not
# trying to dllimport symbols.
target_compile_definitions(${name} PUBLIC CLANG_BUILD_STATIC)
if(TARGET "obj.${name}")
target_compile_definitions("obj.${name}" PUBLIC CLANG_BUILD_STATIC)
endif()
elseif(NOT ARG_SHARED AND NOT ARG_STATIC)
# Clang component libraries linked in to clang-cpp are declared without SHARED or STATIC
elseif(TARGET "obj.${name}" AND NOT ARG_SHARED AND NOT ARG_STATIC)
# Clang component libraries linked to clang-cpp are declared without SHARED or STATIC
target_compile_definitions("obj.${name}" PUBLIC CLANG_EXPORTS)
endif()

Expand Down
Loading