[PATCH] D41087: [Preprocessor] Implement __is_target_{arch|vendor|os|environment} function-like builtin macros

Saleem Abdulrasool via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Dec 11 21:25:27 PST 2017


compnerd added inline comments.


================
Comment at: lib/Lex/PPMacroExpansion.cpp:1923
+              Tok, *this, diag::err_feature_check_malformed);
+          return II ? getTargetInfo().getTriple().getArchName().equals_lower(
+                          II->getName())
----------------
Hmm, the one thing to consider here is the canonicalized vs spelt target.  e.g. `armv7-windows` will map to `thumbv7-unknown-windows-msvc`.


================
Comment at: test/Preprocessor/is_target.c:8
+#if __is_target_arch(arm64)
+  #error "invalid arch"
+#endif
----------------
Can you use `mismatching arch` instead?  This helps differentiate between the invalid arch case below as apposed to the condition being false.  Similar for the other warnings.


Repository:
  rC Clang

https://reviews.llvm.org/D41087





More information about the cfe-commits mailing list