[PATCH] D76015: [clang-tidy] Mock system headers for portability-restrict-system-includes tests.

Paula Toth via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 11 11:19:22 PDT 2020


PaulkaToast created this revision.
PaulkaToast added reviewers: RKSimon, aaron.ballman.
PaulkaToast added a project: clang-tools-extra.
Herald added subscribers: cfe-commits, xazax.hun.
Herald added a project: clang.

Didn't realize that headers such as stddef.h may not exist on all systems. This patch mocks the headers so that the check's tests work on all systems.  (:


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D76015

Files:
  clang-tools-extra/test/clang-tidy/checkers/Inputs/portability-restrict-system-includes/a.h
  clang-tools-extra/test/clang-tidy/checkers/Inputs/portability-restrict-system-includes/system/cstdarg.h
  clang-tools-extra/test/clang-tidy/checkers/Inputs/portability-restrict-system-includes/system/cstdlib.h
  clang-tools-extra/test/clang-tidy/checkers/Inputs/portability-restrict-system-includes/system/float.h
  clang-tools-extra/test/clang-tidy/checkers/Inputs/portability-restrict-system-includes/system/j.h
  clang-tools-extra/test/clang-tidy/checkers/Inputs/portability-restrict-system-includes/system/stddef.h
  clang-tools-extra/test/clang-tidy/checkers/Inputs/portability-restrict-system-includes/system/stdint.h
  clang-tools-extra/test/clang-tidy/checkers/portability-restrict-system-includes-allow.cpp
  clang-tools-extra/test/clang-tidy/checkers/portability-restrict-system-includes-disallow.cpp
  clang-tools-extra/test/clang-tidy/checkers/portability-restrict-system-includes-glob.cpp


Index: clang-tools-extra/test/clang-tidy/checkers/portability-restrict-system-includes-glob.cpp
===================================================================
--- clang-tools-extra/test/clang-tidy/checkers/portability-restrict-system-includes-glob.cpp
+++ clang-tools-extra/test/clang-tidy/checkers/portability-restrict-system-includes-glob.cpp
@@ -1,5 +1,6 @@
 // RUN: %check_clang_tidy %s portability-restrict-system-includes %t \
-// RUN:     -- -config="{CheckOptions: [{key: portability-restrict-system-includes.Includes, value: '-*,std*.h'}]}"
+// RUN:     -- -config="{CheckOptions: [{key: portability-restrict-system-includes.Includes, value: '-*,std*.h'}]}" \
+// RUN:     -- -isystem %S/Inputs/portability-restrict-system-includes/system
 
 // Test glob functionality: disallow all headers except those that match
 // pattern "std*.h".
Index: clang-tools-extra/test/clang-tidy/checkers/portability-restrict-system-includes-disallow.cpp
===================================================================
--- clang-tools-extra/test/clang-tidy/checkers/portability-restrict-system-includes-disallow.cpp
+++ clang-tools-extra/test/clang-tidy/checkers/portability-restrict-system-includes-disallow.cpp
@@ -1,5 +1,6 @@
 // RUN: %check_clang_tidy %s portability-restrict-system-includes %t \
-// RUN:     -- -config="{CheckOptions: [{key: portability-restrict-system-includes.Includes, value: '-*,stddef.h'}]}"
+// RUN:     -- -config="{CheckOptions: [{key: portability-restrict-system-includes.Includes, value: '-*,stddef.h'}]}" \
+// RUN:     -- -isystem %S/Inputs/portability-restrict-system-includes/system
 
 // Test allow-list functionality: disallow all but stddef.h.
 
Index: clang-tools-extra/test/clang-tidy/checkers/portability-restrict-system-includes-allow.cpp
===================================================================
--- clang-tools-extra/test/clang-tidy/checkers/portability-restrict-system-includes-allow.cpp
+++ clang-tools-extra/test/clang-tidy/checkers/portability-restrict-system-includes-allow.cpp
@@ -1,5 +1,6 @@
 // RUN: %check_clang_tidy %s portability-restrict-system-includes %t \
-// RUN:     -- -config="{CheckOptions: [{key: portability-restrict-system-includes.Includes, value: '*,-stddef.h'}]}"
+// RUN:     -- -config="{CheckOptions: [{key: portability-restrict-system-includes.Includes, value: '*,-stddef.h'}]}" \
+// RUN:     -- -isystem %S/Inputs/portability-restrict-system-includes/system
 
 // Test block-list functionality: allow all but stddef.h.
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D76015.249691.patch
Type: text/x-patch
Size: 2509 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200311/b4ebec01/attachment-0001.bin>


More information about the cfe-commits mailing list