|
12 | 12 |
|
13 | 13 | #include "clang/AST/RecordLayout.h"
|
14 | 14 | #include "clang/ASTMatchers/ASTMatchers.h"
|
| 15 | +#include "clang/Testing/CommandLineArgs.h" |
15 | 16 | #include "llvm/Support/SmallVectorMemoryBuffer.h"
|
16 | 17 |
|
17 | 18 | #include "clang/AST/DeclContextInternals.h"
|
@@ -7379,11 +7380,12 @@ struct ImportAttributes : public ASTImporterOptionSpecificTestBase {
|
7379 | 7380 | }
|
7380 | 7381 |
|
7381 | 7382 | template <class DT, class AT>
|
7382 |
| - void importAttr(const char *Code, AT *&FromAttr, AT *&ToAttr) { |
| 7383 | + void importAttr(const char *Code, AT *&FromAttr, AT *&ToAttr, |
| 7384 | + TestLanguage Lang = Lang_CXX11) { |
7383 | 7385 | static_assert(std::is_base_of<Attr, AT>::value, "AT should be an Attr");
|
7384 | 7386 | static_assert(std::is_base_of<Decl, DT>::value, "DT should be a Decl");
|
7385 | 7387 |
|
7386 |
| - Decl *FromTU = getTuDecl(Code, Lang_CXX11, "input.cc"); |
| 7388 | + Decl *FromTU = getTuDecl(Code, Lang, "input.cc"); |
7387 | 7389 | DT *FromD =
|
7388 | 7390 | FirstDeclMatcher<DT>().match(FromTU, namedDecl(hasName("test")));
|
7389 | 7391 | ASSERT_TRUE(FromD);
|
@@ -7669,6 +7671,13 @@ TEST_P(ImportAttributes, ImportLocksExcluded) {
|
7669 | 7671 | checkImportVariadicArg(FromAttr->args(), ToAttr->args());
|
7670 | 7672 | }
|
7671 | 7673 |
|
| 7674 | +TEST_P(ImportAttributes, ImportC99NoThrowAttr) { |
| 7675 | + NoThrowAttr *FromAttr, *ToAttr; |
| 7676 | + importAttr<FunctionDecl>("void test () __attribute__ ((__nothrow__));", |
| 7677 | + FromAttr, ToAttr, Lang_C99); |
| 7678 | + checkImported(FromAttr->getAttrName(), ToAttr->getAttrName()); |
| 7679 | +} |
| 7680 | + |
7672 | 7681 | template <typename T>
|
7673 | 7682 | auto ExtendWithOptions(const T &Values, const std::vector<std::string> &Args) {
|
7674 | 7683 | auto Copy = Values;
|
|
0 commit comments