Skip to content

Instantly share code, notes, and snippets.

@vsapsai
Created November 11, 2021 02:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vsapsai/a2d2bd19c54c24540495fd9b262106aa to your computer and use it in GitHub Desktop.
Save vsapsai/a2d2bd19c54c24540495fd9b262106aa to your computer and use it in GitHub Desktop.
Test case for https://reviews.llvm.org/D112915 that demonstrates `isImport` needs to be tracked per submodule too.
// RUN: rm -rf %t
// RUN: split-file %s %t
// RUN: %clang_cc1 -fsyntax-only -fmodules -fimplicit-module-maps -fmodules-cache-path=%t/modules.cache -F %t/Frameworks %t/test.m
//--- Frameworks/NonModular.framework/Headers/NonModular.h
#ifdef ENUM_VALUE
// Requires to be included inside an enum with macro ENUM_VALUE defined.
ENUM_VALUE(Left, 0),
ENUM_VALUE(Right, 1),
#endif
//--- Frameworks/BrokenImporter.framework/Headers/Empty.h
// empty
//--- Frameworks/BrokenImporter.framework/Headers/Broken.h
// Broken because not defining a required macro, not in correct context and
// importing instead of including. But it shouldn't be a problem as nobody
// includes/imports this broken header.
#import <NonModular/NonModular.h>
//--- Frameworks/BrokenImporter.framework/Modules/module.modulemap
framework module BrokenImporter {
module Empty {
header "Empty.h"
}
module Broken {
header "Broken.h"
}
}
//--- test.m
#import <BrokenImporter/Empty.h>
enum FirstEnum {
#define ENUM_VALUE(name, value) FirstEnum ## name ## Value = value
#include <NonModular/NonModular.h>
#undef ENUM_VALUE
};
int test() {
return FirstEnumLeftValue;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment