p1.cpp 718 B

123456789101112131415161718
  1. // RUN: %clang_cc1 -std=c++2a -emit-header-module -fmodule-name=attrs -x c++-header %S/Inputs/empty.h %S/Inputs/attrs.h -o %t.pcm
  2. // RUN: %clang_cc1 -std=c++2a %s -fmodule-file=%t.pcm -E -verify -I%S/Inputs | FileCheck %s
  3. #define SEMI ;
  4. // expected-error@+1 {{semicolon terminating header import declaration cannot be produced by a macro}}
  5. import "empty.h" SEMI // CHECK: import attrs.{{.*}};
  6. #define IMPORT import "empty.h"
  7. IMPORT; // CHECK: import attrs.{{.*}};
  8. #define IMPORT_ANGLED import <empty.h>
  9. IMPORT_ANGLED; // CHECK: import attrs.{{.*}};
  10. // Ensure that macros only become visible at the semicolon.
  11. // CHECK: import attrs.{{.*}} ATTRS ;
  12. import "attrs.h" ATTRS ;
  13. // CHECK: {{\[\[}} ]] int n;
  14. ATTRS int n;