================
@@ -0,0 +1,14 @@
+// RUN: %clang_analyze_cc1 
-analyzer-checker=optin.taint,core,security.ArrayBound -analyzer-config 
assume-controlled-environment=false -analyzer-output=text -verify %s
+
+// This file is for testing enhanced diagnostics produced by the 
GenericTaintChecker
+
+// In an untrusted environment the cmd line arguments
+// are assumed to be tainted.
+int main( int argc, char *argv[], char *envp[] ) {// expected-note {{Taint 
originated in 'argc'}}
+   if (argc < 1)// expected-note {{'argc' is >= 1}}
+                // expected-note@-1 {{Taking false branch}}
+     return 1;         
----------------
steakhal wrote:

Unless there are compelling reasons for not following the llvm coding style, 
I'd advocate for honouring it even in tests. Especially for new tests.
https://llvm.org/docs/CodingStandards.html#don-t-use-braces-on-simple-single-statement-bodies-of-if-else-loop-statements

```suggestion
   if (argc < 1) {
     // expected-note@-1  {{'argc' is >= 1}} expected-note@-1 {{Taking false 
branch}}
     return 1;
   }
```

As a side note, for some reasons your files contain trailing whitespaces. 
Please get rid of those.

https://github.com/llvm/llvm-project/pull/178054
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to