summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
Diffstat (limited to 'clang')
-rw-r--r--clang/lib/ARCMigrate/ObjCMT.cpp5
-rw-r--r--clang/test/ARCMT/objcmt-ns-macros.m.result3
2 files changed, 5 insertions, 3 deletions
diff --git a/clang/lib/ARCMigrate/ObjCMT.cpp b/clang/lib/ARCMigrate/ObjCMT.cpp
index f29adb612c2..940a9c95f28 100644
--- a/clang/lib/ARCMigrate/ObjCMT.cpp
+++ b/clang/lib/ARCMigrate/ObjCMT.cpp
@@ -1737,6 +1737,11 @@ bool ObjCMigrateASTConsumer::InsertFoundation(ASTContext &Ctx,
return true;
if (Loc.isInvalid())
return false;
+ auto *nsEnumId = &Ctx.Idents.get("NS_ENUM");
+ if (PP.getMacroDefinitionAtLoc(nsEnumId, Loc)) {
+ FoundationIncluded = true;
+ return true;
+ }
edit::Commit commit(*Editor);
if (Ctx.getLangOpts().Modules)
commit.insert(Loc, "#ifndef NS_ENUM\n@import Foundation;\n#endif\n");
diff --git a/clang/test/ARCMT/objcmt-ns-macros.m.result b/clang/test/ARCMT/objcmt-ns-macros.m.result
index bcc865ce0f6..c4c40300ee6 100644
--- a/clang/test/ARCMT/objcmt-ns-macros.m.result
+++ b/clang/test/ARCMT/objcmt-ns-macros.m.result
@@ -19,9 +19,6 @@ typedef unsigned long long uint64_t;
#define NS_OPTIONS(_type, _name) enum _name : _type _name; enum _name : _type
#define DEPRECATED __attribute__((deprecated))
-#ifndef NS_ENUM
-#import <Foundation/Foundation.h>
-#endif
typedef NS_ENUM(NSInteger, wibble) {
blah,
blarg
OpenPOWER on IntegriCloud