[CMake] Use #cmakedefine01 for CLANG_ENABLE_(ARCMT|OBJC_REWRITER|STATIC_ANALYZER)
authorNAKAMURA Takumi <geek4civic@gmail.com>
Wed, 18 Oct 2017 05:21:17 +0000 (05:21 +0000)
committerNAKAMURA Takumi <geek4civic@gmail.com>
Wed, 18 Oct 2017 05:21:17 +0000 (05:21 +0000)
It'd be better that they are #cmakedefine01 rather than #cmakedefine.
(#if FOO rather than #if defined(FOO))
Then we can find missing #include "clang/Config/config.h" in the future.

Differential Revision: https://reviews.llvm.org/D35541

llvm-svn: 316061

clang/include/clang/Config/config.h.cmake
clang/lib/Frontend/Rewrite/FrontendActions.cpp
clang/lib/Frontend/Rewrite/RewriteModernObjC.cpp
clang/lib/Frontend/Rewrite/RewriteObjC.cpp
clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp
clang/tools/libclang/ARCMigrate.cpp

index 3ee7258..10074aa 100644 (file)
@@ -60,8 +60,8 @@
 #cmakedefine01 ENABLE_X86_RELAX_RELOCATIONS
 
 /* Enable each functionality of modules */
-#cmakedefine CLANG_ENABLE_ARCMT
-#cmakedefine CLANG_ENABLE_OBJC_REWRITER
-#cmakedefine CLANG_ENABLE_STATIC_ANALYZER
+#cmakedefine01 CLANG_ENABLE_ARCMT
+#cmakedefine01 CLANG_ENABLE_OBJC_REWRITER
+#cmakedefine01 CLANG_ENABLE_STATIC_ANALYZER
 
 #endif
index 5efa6ae..4d58704 100644 (file)
@@ -154,7 +154,7 @@ bool FixItRecompile::BeginInvocation(CompilerInstance &CI) {
   return true;
 }
 
-#ifdef CLANG_ENABLE_OBJC_REWRITER
+#if CLANG_ENABLE_OBJC_REWRITER
 
 std::unique_ptr<ASTConsumer>
 RewriteObjCAction::CreateASTConsumer(CompilerInstance &CI, StringRef InFile) {
index 21686b8..1954b24 100644 (file)
@@ -31,7 +31,7 @@
 #include "llvm/Support/raw_ostream.h"
 #include <memory>
 
-#ifdef CLANG_ENABLE_OBJC_REWRITER
+#if CLANG_ENABLE_OBJC_REWRITER
 
 using namespace clang;
 using llvm::utostr;
index e0d813d..096b81b 100644 (file)
@@ -30,7 +30,7 @@
 #include "llvm/Support/raw_ostream.h"
 #include <memory>
 
-#ifdef CLANG_ENABLE_OBJC_REWRITER
+#if CLANG_ENABLE_OBJC_REWRITER
 
 using namespace clang;
 using llvm::utostr;
index f35769c..4167e1f 100644 (file)
@@ -94,18 +94,18 @@ CreateFrontendBaseAction(CompilerInstance &CI) {
 
   case RewriteMacros:          return llvm::make_unique<RewriteMacrosAction>();
   case RewriteTest:            return llvm::make_unique<RewriteTestAction>();
-#ifdef CLANG_ENABLE_OBJC_REWRITER
+#if CLANG_ENABLE_OBJC_REWRITER
   case RewriteObjC:            return llvm::make_unique<RewriteObjCAction>();
 #else
   case RewriteObjC:            Action = "RewriteObjC"; break;
 #endif
-#ifdef CLANG_ENABLE_ARCMT
+#if CLANG_ENABLE_ARCMT
   case MigrateSource:
     return llvm::make_unique<arcmt::MigrateSourceAction>();
 #else
   case MigrateSource:          Action = "MigrateSource"; break;
 #endif
-#ifdef CLANG_ENABLE_STATIC_ANALYZER
+#if CLANG_ENABLE_STATIC_ANALYZER
   case RunAnalysis:            return llvm::make_unique<ento::AnalysisAction>();
 #else
   case RunAnalysis:            Action = "RunAnalysis"; break;
@@ -113,8 +113,8 @@ CreateFrontendBaseAction(CompilerInstance &CI) {
   case RunPreprocessorOnly:    return llvm::make_unique<PreprocessOnlyAction>();
   }
 
-#if !defined(CLANG_ENABLE_ARCMT) || !defined(CLANG_ENABLE_STATIC_ANALYZER) \
-  || !defined(CLANG_ENABLE_OBJC_REWRITER)
+#if !CLANG_ENABLE_ARCMT || !CLANG_ENABLE_STATIC_ANALYZER \
+  || !CLANG_ENABLE_OBJC_REWRITER
   CI.getDiagnostics().Report(diag::err_fe_action_not_available) << Action;
   return 0;
 #else
@@ -135,7 +135,7 @@ CreateFrontendAction(CompilerInstance &CI) {
     Act = llvm::make_unique<FixItRecompile>(std::move(Act));
   }
   
-#ifdef CLANG_ENABLE_ARCMT
+#if CLANG_ENABLE_ARCMT
   if (CI.getFrontendOpts().ProgramAction != frontend::MigrateSource &&
       CI.getFrontendOpts().ProgramAction != frontend::GeneratePCH) {
     // Potentially wrap the base FE action in an ARC Migrate Tool action.
@@ -228,7 +228,7 @@ bool clang::ExecuteCompilerInvocation(CompilerInstance *Clang) {
     llvm::cl::ParseCommandLineOptions(NumArgs + 1, Args.get());
   }
 
-#ifdef CLANG_ENABLE_STATIC_ANALYZER
+#if CLANG_ENABLE_STATIC_ANALYZER
   // Honor -analyzer-checker-help.
   // This should happen AFTER plugins have been loaded!
   if (Clang->getAnalyzerOpts()->ShowCheckerHelp) {
index 0f2bd06..ed2ecdb 100644 (file)
@@ -34,7 +34,7 @@ struct Remap {
 //===----------------------------------------------------------------------===//
 
 CXRemapping clang_getRemappings(const char *migrate_dir_path) {
-#ifndef CLANG_ENABLE_ARCMT
+#if !CLANG_ENABLE_ARCMT
   llvm::errs() << "error: feature not enabled in this build\n";
   return nullptr;
 #else
@@ -77,7 +77,7 @@ CXRemapping clang_getRemappings(const char *migrate_dir_path) {
 
 CXRemapping clang_getRemappingsFromFileList(const char **filePaths,
                                             unsigned numFiles) {
-#ifndef CLANG_ENABLE_ARCMT
+#if !CLANG_ENABLE_ARCMT
   llvm::errs() << "error: feature not enabled in this build\n";
   return nullptr;
 #else