diff --git a/CMakeLists.txt b/CMakeLists.txt index 5210718005..925f6c7903 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,6 +17,19 @@ if(POLICY CMP0022) cmake_policy(SET CMP0022 NEW) # automatic when 2.8.12 is required endif() +set(_DXC_ENFORCED_POLICIES + CMP0051 # Include_DIRECTORIES target scope + CMP0056 # Honor per-config link flags + CMP0063 # Visibility presets for targets + CMP0077 # option() honors normal variables + ) +foreach(_policy IN LISTS _DXC_ENFORCED_POLICIES) + if(POLICY ${_policy}) + cmake_policy(SET ${_policy} NEW) + endif() +endforeach() +unset(_DXC_ENFORCED_POLICIES) + if(CMAKE_VERSION VERSION_LESS 3.1.20141117) set(cmake_3_2_USES_TERMINAL) else() diff --git a/tools/clang/CMakeLists.txt b/tools/clang/CMakeLists.txt index 449e6c28b4..a250c36e44 100644 --- a/tools/clang/CMakeLists.txt +++ b/tools/clang/CMakeLists.txt @@ -14,6 +14,19 @@ else() endif() endif() +set(_CLANG_ENFORCED_POLICIES + CMP0051 + CMP0056 + CMP0063 + CMP0077 + ) +foreach(_policy IN LISTS _CLANG_ENFORCED_POLICIES) + if(POLICY ${_policy}) + cmake_policy(SET ${_policy} NEW) + endif() +endforeach() +unset(_CLANG_ENFORCED_POLICIES) + # If we are not building as a part of LLVM, build Clang as an # standalone project, using LLVM as an external library: if( CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR ) diff --git a/tools/clang/lib/Frontend/Rewrite/RewriteObjC.cpp b/tools/clang/lib/Frontend/Rewrite/RewriteObjC.cpp index 204820b304..43f7d8ec05 100644 --- a/tools/clang/lib/Frontend/Rewrite/RewriteObjC.cpp +++ b/tools/clang/lib/Frontend/Rewrite/RewriteObjC.cpp @@ -11,7 +11,6 @@ // //===----------------------------------------------------------------------===// -#include "clang/Rewrite/Frontend/ASTConsumers.h" #include "clang/AST/AST.h" #include "clang/AST/ASTConsumer.h" #include "clang/AST/Attr.h" @@ -20,8 +19,10 @@ #include "clang/Basic/Diagnostic.h" #include "clang/Basic/IdentifierTable.h" #include "clang/Basic/SourceManager.h" +#include "clang/Basic/Specifiers.h" #include "clang/Lex/Lexer.h" #include "clang/Rewrite/Core/Rewriter.h" +#include "clang/Rewrite/Frontend/ASTConsumers.h" #include "llvm/ADT/DenseSet.h" #include "llvm/ADT/SmallPtrSet.h" #include "llvm/ADT/StringExtras.h" @@ -483,7 +484,8 @@ namespace { result = Context->getObjCIdType(); FunctionProtoType::ExtProtoInfo fpi; fpi.Variadic = variadic; - return Context->getFunctionType(result, args, fpi); + return Context->getFunctionType( + result, args, fpi, llvm::ArrayRef()); } // Helper function: create a CStyleCastExpr with trivial type source info.