llvm-project/clang/test/Sema/attr-external-source-symbol-cxx.cpp
Alex Lorenz c8b37e48f6 [clang] extend external_source_symbol attribute with USR clause
Allow the user to specify a concrete USR in the external_source_symbol attribute.
That will let Clang's indexer to use Swift USRs for Swift declarations that are
represented with C++ declarations.

This new clause is used by Swift when generating a C++ header representation
of a Swift module:
https://github.com/apple/swift/pull/63002

Differential Revision: https://reviews.llvm.org/D141324
2023-02-23 14:59:26 -08:00

17 lines
591 B
C++

// RUN: %clang_cc1 -fsyntax-only -fblocks -verify -fdouble-square-bracket-attributes %s
template<class T>
class Class {
public:
[[clang::external_source_symbol(language="Swift", defined_in="module", USR="test", generated_declaration)]]
void testExternalSourceSymbol();
// expected-error@+1 {{expected string literal for USR in 'external_source_symbol' attribute}}
[[clang::external_source_symbol(language="Swift", defined_in="module", USR=T, generated_declaration)]]
void testExternalSourceSymbol2();
};
template<class T>
void Class<T>::testExternalSourceSymbol() {
}