================
@@ -0,0 +1,129 @@
+//===- Utils.cpp - Shared utilities for SSAF tools -----------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "clang/ScalableStaticAnalysisFramework/Tool/Utils.h"
+#include "llvm/ADT/STLExtras.h"
+#include "llvm/ADT/SmallVector.h"
+#include "llvm/Support/CommandLine.h"
+#include "llvm/Support/DynamicLibrary.h"
+#include "llvm/Support/Error.h"
+#include "llvm/Support/FormatVariadic.h"
+#include "llvm/Support/Path.h"
+#include "llvm/Support/Process.h"
+#include "llvm/Support/WithColor.h"
+#include "llvm/Support/raw_ostream.h"
+#include <cassert>
+#include <memory>
+#include <string>
+
+namespace clang::ssaf {
----------------
steakhal wrote:

The reason why it's better to just use `using namespace` and then qualified 
names for providing the definitions is because if there is a change in the 
parameter or in general to the declaration then the behavior would be different:

If you were open the namespace and just define the symbol there (like now in 
this PR), then in case of a declaration mismatch, it would work just fine. This 
declaration would be different than the one already declared; unless there was 
a call to it not even an undefined reference would be raised.

However, if you used at least partially qualified names when defining the 
function, then it would be a hard error right there due to the type mismatch.
Example:
```c++
using namespace clang;
using namespace ssaf;
llvm::StringRef ssaf::getToolName() { ... } // notice the partially qualified 
`ssaf::` prefix in the name.
```

This isn't a huge benefit, and also has the price of the "redundant" prefix 
qualifications, so I'm open for not applying it; I just wondered if you knew 
about this and you have intentionally chose doing it this way.

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

Reply via email to